diff options
author | Jan Huwald <jh@sotun.de> | 2012-04-27 20:44:18 (GMT) |
---|---|---|
committer | Jan Huwald <jh@sotun.de> | 2012-04-27 20:44:18 (GMT) |
commit | c90d4f95dcb8b98210b87dade1fd0a4cfe9368cb (patch) | |
tree | bf4c3fc1a903cf404c05909093c7706d1d544835 /files/common/sbin/sync_dhcp | |
parent | c3797238329c40150a308bb3a76bf90f9eb1b499 (diff) |
ccfg: sync dnsmasq dhcp config with ccfg p2ptbl
Diffstat (limited to 'files/common/sbin/sync_dhcp')
-rwxr-xr-x | files/common/sbin/sync_dhcp | 21 |
1 files changed, 21 insertions, 0 deletions
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 |