dhcp_host_add() {
local cfg="$1"
- local hosttag nametime addrs duids macs tags
+ local hosttag nametime addrs duids macs tags mtags
config_get_bool force "$cfg" force 0
config_get duid "$cfg" duid
config_get tag "$cfg" tag
+ add_tag() {
+ mtags="${mtags}tag:$1,"
+ }
+ config_list_foreach "$cfg" match_tag add_tag
+
if [ -n "$mac" ]; then
# --dhcp-host=00:20:e0:3b:13:af,192.168.0.199,lap
# many MAC are possible to track a laptop ON/OFF dock
if [ $DNSMASQ_DHCP_VER -eq 6 ]; then
addrs="${ip:+,$ip}${hostid:+,[::$hostid]}"
- xappend "--dhcp-host=$macs${duids:+,$duids}$hosttag$addrs$nametime"
+ xappend "--dhcp-host=$mtags$macs${duids:+,$duids}$hosttag$addrs$nametime"
else
- xappend "--dhcp-host=$macs$hosttag${ip:+,$ip}$nametime"
+ xappend "--dhcp-host=$mtags$macs$hosttag${ip:+,$ip}$nametime"
fi
}