summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2016-09-02 13:51:09 +0200
committerJohn Crispin <john@phrozen.org>2016-09-19 15:30:32 +0200
commit32f4777530bc814cb878c0436bc26cded53a3a8b (patch)
tree7d34c6d127f5670ad2f81864364e0079b2bfdcfc
parent559f55dffc58b1b05f1161a2caf415568355c45b (diff)
downloadmaster-31e0f0ae-32f4777530bc814cb878c0436bc26cded53a3a8b.tar.gz
master-31e0f0ae-32f4777530bc814cb878c0436bc26cded53a3a8b.tar.bz2
master-31e0f0ae-32f4777530bc814cb878c0436bc26cded53a3a8b.zip
dnsmasq: Add match section support
Match sections allow to set a tag specified by the option networkid if the client sends an option and optionally the option value specified by the match option. The force option will convert the dhcp-option to force-dhcp-option if set to 1 in the dnsmasq config if options are specified in the dhcp_option option. config match option networkid tag option match 12,myhost option force 1 list dhcp_option '3,192.168.1.1' Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r--package/network/services/dnsmasq/files/dnsmasq.init17
1 files changed, 17 insertions, 0 deletions
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index 4cd5f673d8..69c375c395 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -351,6 +351,22 @@ dhcp_vendorclass_add() {
dhcp_option_add "$cfg" "$networkid" "$force"
}
+dhcp_match_add() {
+ local cfg="$1"
+
+ config_get networkid "$cfg" networkid
+ [ -n "$networkid" ] || return 0
+
+ config_get match "$cfg" match
+ [ -n "$match" ] || return 0
+
+ xappend "--dhcp-match=$networkid,$match"
+
+ config_get_bool force "$cfg" force 0
+
+ dhcp_option_add "$cfg" "$networkid" "$force"
+}
+
dhcp_host_add() {
local cfg="$1"
@@ -669,6 +685,7 @@ start_service() {
config_foreach dhcp_circuitid_add circuitid
config_foreach dhcp_remoteid_add remoteid
config_foreach dhcp_subscrid_add subscrid
+ config_foreach dhcp_match_add match
config_foreach dhcp_domain_add domain
config_foreach dhcp_hostrecord_add hostrecord
config_foreach dhcp_relay_add relay