#!/bin/sh
# WireGuard kernel: DNS cua VPN nghe cong 53 tren IP cua interface VPN, dnsmasq
# (bind-dynamic) cung mo cong 53 tren moi interface moi. Ben nao len sau se loi
# (dnsmasq: "Address in use", FAILED to start up). Khong cho dnsmasq nghe tren do.
iface="$(uci -q get isecurity.settings.interface_name)"
iface="${iface:-wt0}"
uci -q get dhcp.@dnsmasq[0] >/dev/null || exit 0
uci -q get dhcp.@dnsmasq[0].notinterface | grep -qw "$iface" && exit 0
uci add_list dhcp.@dnsmasq[0].notinterface="$iface"
uci commit dhcp
exit 0
