ipfire 2 dnsmasq script to generate wildcard subdomains for dhcp-leases

revision a7eb6d0e2b824f25d4ae57c5603316e90cc3c686

raw

error.log

1
2
3
4
5
6
[root@ipfire cgi-bin]# /etc/init.d/dnsmasq restart
Stopping Domain Name Service Proxy... [  OK  ]
Starting Domain Name Service Proxy...
dnsmasq: recompile with HAVE_SCRIPT defined to enable lease-change scripts at line 4 of /etc/dnsmasq.conf
                                      [ FAIL ]
 
raw

etc-dnsmasq.conf

1
2
3
conf-dir=/etc/dnsmasq.d
dhcp-script=/usr/local/bin/dnsmasq-dhcp-wildcards
 
raw

usr-local-bin-dnsmasq-dhcp-wildcards.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
tld=.example
 
mode=$1
ip=$2
name=$3$tld
 
filename="/etc/dnsmasq.d/wildcard-dhcp-$name.conf"
echo $@ >> /tmp/log
if [ "$mode" == add ]; then
    echo "address=/.$name/$ip/" > "$filename"
elif [ "$mode" == del ]; then
    rm "$filename"
fi
 

History