summaryrefslogtreecommitdiff
path: root/package/network/services/dnsmasq/files/dnsmasq.init
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2017-06-21 16:48:41 +0200
committerJo-Philipp Wich <jo@mein.io>2017-07-21 08:09:45 +0200
commitd0f6a514b10aece3db265d8ef1d5e3b2bce7d121 (patch)
tree535698394ffcda8502108c64a48de83084a977ac /package/network/services/dnsmasq/files/dnsmasq.init
parent99c429512622566ee2bbde69fa8efb0f2bcda33e (diff)
downloadmtk-20170518-d0f6a514b10aece3db265d8ef1d5e3b2bce7d121.zip
mtk-20170518-d0f6a514b10aece3db265d8ef1d5e3b2bce7d121.tar.gz
mtk-20170518-d0f6a514b10aece3db265d8ef1d5e3b2bce7d121.tar.bz2
dnsmasq: introduce config support for forced DHCP options
Introduce a new UCI list setting `list dhcp_option_force` which is available in sections of type `dnsmasq` and `dhcp`. The `dhcp_option_force` setting has the same semantics as `dhcp_option` but generates `dhcp-option-force` directives instead of `dhcp-option` ones in emitted native configuration. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'package/network/services/dnsmasq/files/dnsmasq.init')
-rw-r--r--package/network/services/dnsmasq/files/dnsmasq.init14
1 files changed, 9 insertions, 5 deletions
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index 6f985b2..4f539f9 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -575,7 +575,8 @@ dhcp_add() {
dhcp_option_append "option6:dns-server,$dnss" "$networkid"
fi
- dhcp_option_add "$cfg" "$networkid"
+ dhcp_option_add "$cfg" "$networkid" 0
+ dhcp_option_add "$cfg" "$networkid" 2
}
dhcp_option_append() {
@@ -591,18 +592,20 @@ dhcp_option_add() {
local cfg="$1"
local networkid="$2"
local force="$3"
+ local opt="dhcp_option"
[ "$force" = "0" ] && force=
+ [ "$force" = "2" ] && opt="dhcp_option_force"
local list_len
- config_get list_len "$cfg" dhcp_option_LENGTH
+ config_get list_len "$cfg" "${opt}_LENGTH"
if [ -n "$list_len" ]; then
- config_list_foreach "$cfg" dhcp_option dhcp_option_append "$networkid" "$force"
+ config_list_foreach "$cfg" "$opt" dhcp_option_append "$networkid" "$force"
else
- config_get dhcp_option "$cfg" dhcp_option
+ config_get dhcp_option "$cfg" "$opt"
- [ -n "$dhcp_option" ] && echo "Warning: the 'option dhcp_option' syntax is deprecated, use 'list dhcp_option'" >&2
+ [ -n "$dhcp_option" ] && echo "Warning: the 'option $opt' syntax is deprecated, use 'list $opt'" >&2
local option
for option in $dhcp_option; do
@@ -920,6 +923,7 @@ dnsmasq_start()
}
dhcp_option_add "$cfg" "" 0
+ dhcp_option_add "$cfg" "" 2
xappend "--dhcp-broadcast=tag:needs-broadcast"