#!/bin/sh # This is the interface as mentioned in the /etc/config/network file IMESH="lan" # This is the interface on which to ask for dhcp. May not be same as previous if interface is a bridge, like br-lan IDHCP="br-lan" hostname=$(uci get system.@system[0].hostname) case "$ACTION" in change) if [ "$BATTYPE" == "gw" ]; then case "$BATACTION" in add) logger "Now has a gateway available. Will request dhcp." udhcpc -i $IDHCP -h $hostname ;; del) logger "No more gateway available. Will go back to static ip." ifdown $IMESH ifup $IMESH ;; change) logger "New default gateway. Will request dhcp" udhcpc -i $IDHCP -h $hostname ;; esac fi ;; esac