`smartdns`: `dhcp_option` incorrectly includes CIDR suffix from network.lan.ipaddr
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- shell
- Domain
- networking
Research direction
Start with /etc/init.d/smartdns and inspect set_main_dns(), especially the network.lan.ipaddr lookup and dhcp_option update. Reproduce the behavior with the listed UCI commands and restart sequence. Done means DHCP option 6 contains only plain IP addresses and repeated restarts do not add invalid or duplicate entries.
Written by the indexing model from the issue text.
Description
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
- The package is maintained in this repository.
- I understand that issues related to the base OpenWrt repository or LuCI repository will be closed.
- I am reporting an issue for OpenWrt, not an unsupported fork.
- Dominant language
- Makefile
- Stars
- 4.6k
- Forks
- 4k
- Avg merge
- 3d 34m
- Merged PRs (30d)
- 115
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openwrt/packages
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug release/25.12
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
release/25.12
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug release/25.12
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
All issues in openwrt/packages
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
TheManticoreProject/Manticore#1380 ·
-
P3 sonic-vpp
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sonic-net/sonic-buildimage#29662 ·
-
support
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100