diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-05-19 20:17:56 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-05-19 20:17:56 +0000 |
commit | 97178bb0078fe52dc7ed0396845bade6064b1eac (patch) | |
tree | d71a1180ba324906cd470209bbb2f7bd5f9e3713 | |
parent | 1d7469404ca356ca9d70f2de19b5fb240e2261e4 (diff) | |
download | upstream-97178bb0078fe52dc7ed0396845bade6064b1eac.tar.gz upstream-97178bb0078fe52dc7ed0396845bade6064b1eac.tar.bz2 upstream-97178bb0078fe52dc7ed0396845bade6064b1eac.zip |
dnsmasq: allow forcing options
The option 'force' when set to '1' will transform a dhcp-option to dhcp-option-force instead in the config.
This is useful for forcing options to be sent back to a client (even options it didn't ask for).
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31816 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r-- | package/dnsmasq/files/dnsmasq.init | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/package/dnsmasq/files/dnsmasq.init b/package/dnsmasq/files/dnsmasq.init index f3d438e209..92e10ee494 100644 --- a/package/dnsmasq/files/dnsmasq.init +++ b/package/dnsmasq/files/dnsmasq.init @@ -157,7 +157,9 @@ dhcp_subscrid_add() { xappend "--dhcp-subscrid=$networkid,$subscriberid" - dhcp_option_add "$cfg" "$networkid" + config_get_bool force "$cfg" force 0 + + dhcp_option_add "$cfg" "$networkid" "$force" } dhcp_remoteid_add() { @@ -171,7 +173,9 @@ dhcp_remoteid_add() { xappend "--dhcp-remoteid=$networkid,$remoteid" - dhcp_option_add "$cfg" "$networkid" + config_get_bool force "$cfg" force 0 + + dhcp_option_add "$cfg" "$networkid" "$force" } dhcp_circuitid_add() { @@ -185,7 +189,9 @@ dhcp_circuitid_add() { xappend "--dhcp-circuitid=$networkid,$circuitid" - dhcp_option_add "$cfg" "$networkid" + config_get_bool force "$cfg" force 0 + + dhcp_option_add "$cfg" "$networkid" "$force" } dhcp_userclass_add() { @@ -199,7 +205,9 @@ dhcp_userclass_add() { xappend "--dhcp-userclass=$networkid,$userclass" - dhcp_option_add "$cfg" "$networkid" + config_get_bool force "$cfg" force 0 + + dhcp_option_add "$cfg" "$networkid" "$force" } dhcp_vendorclass_add() { @@ -213,14 +221,18 @@ dhcp_vendorclass_add() { xappend "--dhcp-vendorclass=$networkid,$vendorclass" - dhcp_option_add "$cfg" "$networkid" + config_get_bool force "$cfg" force 0 + + dhcp_option_add "$cfg" "$networkid" "$force" } dhcp_host_add() { local cfg="$1" + config_get_bool force "$cfg" force 0 + config_get networkid "$cfg" networkid - [ -n "$networkid" ] && dhcp_option_add "$cfg" "$networkid" + [ -n "$networkid" ] && dhcp_option_add "$cfg" "$networkid" "$force" config_get name "$cfg" name config_get ip "$cfg" ip @@ -282,7 +294,9 @@ dhcp_boot_add() { xappend "--dhcp-boot=${networkid:+net:$networkid,}$filename,$servername,$serveraddress" - dhcp_option_add "$cfg" "$networkid" + config_get_bool force "$cfg" force 0 + + dhcp_option_add "$cfg" "$networkid" "$force" } @@ -342,10 +356,13 @@ dhcp_add() { dhcp_option_add() { local cfg="$1" local networkid="$2" + local force="$3" + + [ "$force" = "0" ] && force= config_get dhcp_option "$cfg" dhcp_option for o in $dhcp_option; do - xappend "--dhcp-option=$networkid","$o" + xappend "--dhcp-option${force:+-force}=$networkid","$o" done } |