summaryrefslogtreecommitdiff
path: root/package/network/services/dnsmasq/files/dnsmasq.init
diff options
context:
space:
mode:
authorGrégoire Delattre <gregoire.delattre@gmail.com>2017-06-20 11:45:49 +0200
committerHans Dedecker <dedeckeh@gmail.com>2017-06-20 22:33:41 +0200
commit680a5c5d3e4737d6d96fc1b34aba93d04d2390b3 (patch)
tree2ca5e80fa4dcb5853e22784d2abf627fbc847be2 /package/network/services/dnsmasq/files/dnsmasq.init
parente3d09e78980ee1954e536f9fccd2804f5f681973 (diff)
downloadmtk-20170518-680a5c5d3e4737d6d96fc1b34aba93d04d2390b3.zip
mtk-20170518-680a5c5d3e4737d6d96fc1b34aba93d04d2390b3.tar.gz
mtk-20170518-680a5c5d3e4737d6d96fc1b34aba93d04d2390b3.tar.bz2
dnsmasq: add dhcp-range tags configuration
dnsmasq can match tags in its dhcp-range configuration, this commit adds the option to configure it in the dhcp section uci configuration: config dhcp 'lan' option interface 'lan' list tag 'blue' list tag '!red' option start '10' option limit '150' option leasetime '12h' generated dnsmasq configuration: dhcp-range=tag:blue,tag:!red,set:lan,192.168.1.10,192.168.1.159,255.255.255.0,12h Signed-off-by: Grégoire Delattre <gregoire.delattre@gmail.com>
Diffstat (limited to 'package/network/services/dnsmasq/files/dnsmasq.init')
-rw-r--r--package/network/services/dnsmasq/files/dnsmasq.init9
1 files changed, 8 insertions, 1 deletions
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index d5177ec..065d1fd 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -440,6 +440,7 @@ dhcp_add() {
local cfg="$1"
local dhcp6range="::"
local nettag
+ local tags
config_get net "$cfg" interface
[ -n "$net" ] || return 0
@@ -491,6 +492,12 @@ dhcp_add() {
dhcp_this_host_add "$net" "$ifname" "$ADD_LOCAL_FQDN"
start="$( dhcp_calc "$start" )"
+
+ add_tag() {
+ tags="${tags}tag:$1,"
+ }
+ config_list_foreach "$cfg" tag add_tag
+
nettag="${networkid:+set:${networkid},}"
if [ "$limit" -gt 0 ] ; then
@@ -508,7 +515,7 @@ dhcp_add() {
if [ "$dhcpv4" != "disabled" ] ; then
- xappend "--dhcp-range=$nettag$START,$END,$NETMASK,$leasetime${options:+ $options}"
+ xappend "--dhcp-range=$tags$nettag$START,$END,$NETMASK,$leasetime${options:+ $options}"
fi