Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DHCP limit can be set over safe value, causing router to not boot up #4469

Closed
okias opened this issue Sep 24, 2020 · 2 comments
Closed

DHCP limit can be set over safe value, causing router to not boot up #4469

okias opened this issue Sep 24, 2020 · 2 comments

Comments

@okias
Copy link
Contributor

okias commented Sep 24, 2020

Luci allow setting DHCP out-of-range, which leads to state, where DHCP won't start next boot. (since 100+250 > 255).

For many routers, there is definition of DHCP range by start and end address, which can be easily overlooked / mistaken on luci.

I propose to check with some easy math JS, which will restrict start + limit < 255, otherwise changes field color to red.
luci_out_of_range

@jow-
Copy link
Contributor

jow- commented Sep 24, 2020

Works fine for me, ipcalc.sh, which is used by the dnsmasq init script, is capping the value to the maximum allowed value within the subnet mask:

root@jj:~# ipcalc.sh 10.11.12.13 255.255.255.0 100 250
IP=10.11.12.13
NETMASK=255.255.255.0
BROADCAST=10.11.12.255
NETWORK=10.11.12.0
PREFIX=24
START=10.11.12.100
END=10.11.12.254

I also did put option limit 250 into /etc/config/dhcp and restarted dnsmasq which worked fine.
The generated config also contained a sane value:

root@jj:~# grep dhcp-range /var/etc/dnsmasq.conf.cfg01411c 
dhcp-range=set:lan,10.11.12.100,10.11.12.254,255.255.255.0,12h

I propose to check with some easy math JS, which will restrict start + limit < 255, otherwise changes field color to red.

Such a solution would be wrong as the limit is not 255 but actually depending on the interface subnet size. This is also the reason why OpenWrt uses start, limit notation and not "last digit of IP" since we do not presume fixed /24 subnets.

@okias
Copy link
Contributor Author

okias commented Sep 24, 2020

Maybe my "not working DHCP" issue was caused by something else, since it was production router, when I changed value back and it booted, I haven't tried again. I'll try investigate more.

@jow- jow- closed this as completed Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants