diff options
-rw-r--r-- | files/common/etc/dnsmasq.conf | 5 | ||||
-rwxr-xr-x | files/common/sbin/sync_dhcp | 21 |
2 files changed, 26 insertions, 0 deletions
diff --git a/files/common/etc/dnsmasq.conf b/files/common/etc/dnsmasq.conf new file mode 100644 index 0000000..85547e5 --- /dev/null +++ b/files/common/etc/dnsmasq.conf @@ -0,0 +1,5 @@ +dhcp-hostsfile=/tmp/dhcp.hostconfig + +tag-if=set:wrong-if,tag:br-lan,tag:only-wifi +tag-if=set:wrong-if,tag:br-mesh,tag:only-wire +dhcp-ignore=tag:wrong-if diff --git a/files/common/sbin/sync_dhcp b/files/common/sbin/sync_dhcp new file mode 100755 index 0000000..bb9b7ba --- /dev/null +++ b/files/common/sbin/sync_dhcp @@ -0,0 +1,21 @@ +#!/bin/sh -e + +dst=/tmp/dhcp.hostconfig + +add_tbl() { + p2ptbl show /tmp/p2ptbl/ccfg_$1 \ + | tr '\t' ',' \ + | cut -f 1,2,5 -d, \ + | while IFS=, read mac name ip; do + [ -z "$name$ip" ] && continue + echo "$mac,set:only-$1${ip:+,$ip}${name:+,$name}" + done >> $dst~ +} + +rm -f $dst~ +add_tbl wifi +add_tbl wire +mv $dst~ $dst + +# trigger reload of dhcp-hosts-file +killall -SIGHUP dnsmasq
\ No newline at end of file |