Package Name
smartdns
Maintainer
Nick Peng pymumu@gmail.com
OpenWrt Version
25.12.2
OpenWrt Target/Subtarget
mediatek/filogic
Steps to Reproduce
-
Use OpenWrt 23.x / 24.x / 25.x (DSA-based system)
-
Ensure LAN IP is in CIDR format:
uci get network.lan.ipaddr
# example output:
192.168.1.1/24
- Ensure no existing DHCP option 6 (optional, for clean test):
uci del dhcp.lan.dhcp_option
uci commit dhcp
- Restart smartdns:
/etc/init.d/smartdns restart
- Check DHCP options:
uci show dhcp | grep dhcp_option
Actual Behaviour
/etc/init.d/smartdns executes set_main_dns() (lines ~87–107):
set_main_dns() {
local hostip
hostip="$(uci -q get network.lan.ipaddr)" # retrieves LAN IP
dnsmasq_port="$(uci -q get dhcp.@dnsmasq[0].port)"
[ -z "$dnsmasq_port" ] && dnsmasq_port="53"
[ -z "$hostip" ] && return
[ "$dnsmasq_port" = "53" ] && {
uci -q set dhcp.@dnsmasq[0].port=0
uci -q add_list dhcp.lan.dhcp_option="6,$hostip" # <-- adds DHCP option
}
uci commit dhcp
}
root@OpenWrt:~# uci get network.lan.ipaddr
192.168.1.1/24
After /etc/init.d/smartdns restart
uci show dhcp | grep dhcp_option
dhcp.lan.dhcp_option='6,192.168.1.1' '6,192.168.1.1/24' # <-- invalid, breaks DHCP
Consequences:
DHCP option 6 expects plain IP addresses; /24 suffix leads to invalid DNS assignment (24.192.168.1 on clients).
Duplicate entries accumulate on multiple restarts.
Breaks DNS resolution on all DHCP clients.
Expected Behavior:
dhcp.lan.dhcp_option should only contain plain IP addresses, without CIDR.
Restarting smartdns should not introduce invalid or duplicate DHCP options.
Notes / Additional Info:
The problematic code is specific to set_main_dns() in /etc/init.d/smartdns.
Root cause: the script blindly appends network.lan.ipaddr to dhcp_option without stripping CIDR.
Confirmation Checklist
Package Name
smartdns
Maintainer
Nick Peng pymumu@gmail.com
OpenWrt Version
25.12.2
OpenWrt Target/Subtarget
mediatek/filogic
Steps to Reproduce
Use OpenWrt 23.x / 24.x / 25.x (DSA-based system)
Ensure LAN IP is in CIDR format:
Actual Behaviour
/etc/init.d/smartdns executesset_main_dns()(lines ~87–107):After
/etc/init.d/smartdns restartConsequences:
DHCP option 6 expects plain IP addresses; /24 suffix leads to invalid DNS assignment (24.192.168.1 on clients).
Duplicate entries accumulate on multiple restarts.
Breaks DNS resolution on all DHCP clients.
Expected Behavior:
dhcp.lan.dhcp_option should only contain plain IP addresses, without CIDR.
Restarting smartdns should not introduce invalid or duplicate DHCP options.
Notes / Additional Info:
The problematic code is specific to set_main_dns() in /etc/init.d/smartdns.
Root cause: the script blindly appends network.lan.ipaddr to dhcp_option without stripping CIDR.
Confirmation Checklist