Opened 3 years ago

Last modified 3 years ago

#18110 new defect

dnsmasq and range mismatch (off by one)

Reported by: anonymous Owned by: developers
Priority: normal Milestone:
Component: packages Version: Trunk
Keywords: dnsmasq, Cc:


While testing. I noticed a mismatch between the IP range written in /tmp/etc/dnsmasq.conf (which ends at and the one calculated by (which ends at

root@OpenWrt:/etc/config# 19 129 8061

Yet when configuring dhcp

root@OpenWrt:/etc/config# cat dhcp
config dhcp 'lan5'
	option interface 'lan5'
	option start '129'
	option limit '8061'
	option leasetime '1h'

the resulting dnsmasq config file:

root@OpenWrt:/etc/config# cat /tmp/etc/dnsmasq.conf 

the IP range in /tmp/etc/dnsmasq.conf ends at instead of as calculated by

Attachments (0)

Change History (4)

comment:1 Changed 3 years ago by bittorf@…

the reason is line 413 in '/etc/init.d/dnsmasq':

[ "$limit" -gt 0 ] && limit=$((limit-1))

it was added in '5e1086da2dea492398407519d31310f5fb61880a':

dnsmasq: Fix parameter 'limit'

'limit' is actually the number of IP addresses to serve. See the use of
For getting the expected number of IP addresses served, we have to decrement
limit by one.


comment:2 follow-up: Changed 3 years ago by bittorf@…

some month later, there was a fix in '5d2766e7eb9b0db33917522d2cdcc291ddbdc3f9': CIDR notation


The patch is based on #1260 [1], i just changed one line to calculate
the START end END ips right.

so maybe we can remove the limit-1?

comment:3 in reply to: ↑ 2 Changed 3 years ago by anonymous

Replying to bittorf@…:

so maybe we can remove the limit-1?

This seems to be the best solution.

comment:4 Changed 3 years ago by anonymous

bumping this old minor issue ...

Add Comment

Modify Ticket

as new .

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.