contrib/meshwizard: Add initial support for ipv6 config (with auto-ipv6-ib and dhcpv6)
[project/luci.git] / contrib / package / meshwizard / files / usr / bin / meshwizard / helpers / setup_dnsmasq.sh
1 #!/bin/sh
2
3 . /etc/functions.sh
4 . $dir/functions.sh
5
6 # Set dnsmasq config
7 handle_dhcp() {
8         if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
9                 section_rename dhcp $1 dnsmasq
10         fi
11 }
12
13 config_load dhcp
14 config_foreach handle_dhcp dnsmasq
15
16 uci batch << EOF
17         set dhcp.dnsmasq.local="/$profile_suffix/"
18         set dhcp.dnsmasq.domain="$profile_suffix"
19 EOF
20
21 config_get addnhosts dnsmasq addnhosts
22 if [ -z "${addnhosts/\var\/etc\/hosts.olsr/}" ]; then
23         uci add_list dhcp.dnsmasq.addnhosts="/var/etc/hosts.olsr"
24         if [ "$profile_ipv6" = 1 ]; then
25                 uci add_list dhcp.dnsmasq.addnhosts="/var/etc/hosts.olsr.ipv6"
26         fi
27 fi
28
29 uci_commitverbose "Setup dnsmasq" dhcp