Skip to content

Commit

Permalink
resolver-conf: Make setting up DNS resolver more robust
Browse files Browse the repository at this point in the history
There could be multiple dhcp_options and DNS resolver doesn't have to be
first, but at the same time, netmask could be also specified as part of
the ip setting.
  • Loading branch information
miska committed Dec 20, 2024
1 parent 1104c8b commit 6dcb067
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/resolver-conf/files/resolver-defaults
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ uci show system.ntp.server | grep -q '217\.31\.202\.100' || uci add_list system.
# Also, when we have turned the dnsmasq DNS off, ask dnsmasq to advertise us as DNS server
uci show dhcp | sed -ne 's/^dhcp\.//;s/=dhcp$//p' | while read INTERFACE ; do
# If the interface has an IP address. Otherwise, just ignore it.
IP=$(uci -q get network."$INTERFACE".ipaddr)
IP=$(uci -q get network."$INTERFACE".ipaddr | sed 's|/.*||')
if [ -n "$IP" ] ; then
OPTIONS=$(uci get dhcp."$INTERFACE".dhcp_option | grep "^6,")
OPTIONS=$(uci -d = show dhcp."$INTERFACE".dhcp_option | grep "='6,")
if [ -z "$OPTIONS" ] ; then
uci -q add_list dhcp."$INTERFACE".dhcp_option="6,$IP"
fi
Expand Down

0 comments on commit 6dcb067

Please sign in to comment.