Help me decide it this is a bug or not

hello!

need some competent and qualified eye to help to decide if this is a bug or not. please take a look at this:

does it look like a bug then and now fixed? or bug now?

uci show dhcp.lan

2 Likes

From a calculator it seems a valid range.

But it still could be a issue with the configuration like others already suggested please show uci show dhcp.lan it could be as simple as a wrong broadcast address.

The only thing different I notice is that the ip starts earlier as your routers ip:

See: https://www.calculator.net/ip-subnet-calculator.html?cclass=any&csubnet=25&cip=192.168.13.13&ctype=ipv4&printit=0&x=119&y=16

I'm not sure if that could cause an issue?, I would assume that the router starts using its dhcp range at 192.168.13.13 which probably invalidates it as the calculator shows the start should be at 192.168.13.1 so the limit of the dhcp need to be decreased with a minus of 12 or leashes go beyond the subnet range :thinking:

Edit: you also need to take account for the range it shows in the calculator which is derived from the subnetmask, I believe in Luci default dhcp limit is 150 that is too much and then you also have to substract 12 aswell because the dhcp starts further in the range.

Yes it is. The issue I see is with the /var/etc/dnsmasq.conf.cfg01411c file.

It is an auto-generated config file from /etc/config/dhcp, and clearly the parsing of his dhcp-range=set:lan,19,,255.255.255.128,2m is wrong. (Missing 2.168.13.1,192.168.13.126)

This is a comma delimited list that should represent the /etc/config/dhcp range setting for each configured network.

  • interface
  • starting ip of the range
  • ending ip of the range
  • net mask
  • lease time
2 Likes

@RuralRoots here it is.

# uci show dhcp.lan
dhcp.lan=dhcp
dhcp.lan.interface='lan'
dhcp.lan.start='1'
dhcp.lan.limit='126'
dhcp.lan.leasetime='2m'
dhcp.lan.dhcpv4='server'

You defined a 255.255.255.128 netmask (126 hosts) so you have effectively exceeded your subnet by setting limit to ‘126’. Reduce your limit.

As far as the issue with /var/etc/dnsmasq.conf.cfg01411c and parsing of the dhcp-range=set:lan. What does uci show network.lan return?

are you sure? i think this is legit. calculators also show it is legit.

anyway, i reflashed 23.05 again and made additional tests.
changes only to network (initial) and dhcp files (different tests).

root@OpenWrt:/# uci show network
network.loopback=interface
network.loopback.device='lo'
network.loopback.proto='static'
network.loopback.ipaddr='127.0.0.1'
network.loopback.netmask='255.0.0.0'
network.globals=globals
network.globals.ula_prefix='fdf3:81a1:2fe0::/48'
network.@device[0]=device
network.@device[0].name='br-lan'
network.@device[0].type='bridge'
network.@device[0].ports='eth0.1'
network.lan=interface
network.lan.device='br-lan'
network.lan.proto='static'
network.lan.ipaddr='192.168.1.13'
network.lan.netmask='255.255.255.128'
network.@switch[0]=switch
network.@switch[0].name='switch0'
network.@switch[0].reset='1'
network.@switch[0].enable_vlan='1'
network.@switch_vlan[0]=switch_vlan
network.@switch_vlan[0].device='switch0'
network.@switch_vlan[0].vlan='1'
network.@switch_vlan[0].ports='1 2 3 0t'
network.wan=interface
network.wan.device='eth0.2'
network.wan.proto='dhcp'
network.@switch_vlan[1]=switch_vlan
network.@switch_vlan[1].device='switch0'
network.@switch_vlan[1].vlan='2'
network.@switch_vlan[1].ports='0t 5'
network.@switch_vlan[1].vid='2'
network.@switch_vlan[1].description='wan'

test 1) doesn't assign, router .13, range 1-120

root@OpenWrt:/# uci show dhcp
dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].domainneeded='1'
dhcp.@dnsmasq[0].boguspriv='1'
dhcp.@dnsmasq[0].filterwin2k='0'
dhcp.@dnsmasq[0].localise_queries='1'
dhcp.@dnsmasq[0].rebind_protection='1'
dhcp.@dnsmasq[0].rebind_localhost='1'
dhcp.@dnsmasq[0].local='/lan/'
dhcp.@dnsmasq[0].domain='lan'
dhcp.@dnsmasq[0].expandhosts='1'
dhcp.@dnsmasq[0].nonegcache='0'
dhcp.@dnsmasq[0].cachesize='1000'
dhcp.@dnsmasq[0].authoritative='1'
dhcp.@dnsmasq[0].readethers='1'
dhcp.@dnsmasq[0].leasefile='/tmp/dhcp.leases'
dhcp.@dnsmasq[0].resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'
dhcp.@dnsmasq[0].nonwildcard='1'
dhcp.@dnsmasq[0].localservice='1'
dhcp.@dnsmasq[0].ednspacket_max='1232'
dhcp.@dnsmasq[0].filter_aaaa='0'
dhcp.@dnsmasq[0].filter_a='0'
dhcp.@dnsmasq[0].confdir='/tmp/dnsmasq.d'
dhcp.lan=dhcp
dhcp.lan.interface='lan'
dhcp.lan.start='1'
dhcp.lan.limit='120'
dhcp.lan.leasetime='2m'
dhcp.lan.dhcpv4='server'
dhcp.lan.dhcpv6='server'
dhcp.lan.ra='server'
dhcp.lan.ra_slaac='1'
dhcp.lan.ra_flags='managed-config' 'other-config'
dhcp.wan=dhcp
dhcp.wan.interface='wan'
dhcp.wan.ignore='1'
dhcp.odhcpd=odhcpd
dhcp.odhcpd.maindhcp='0'
dhcp.odhcpd.leasefile='/tmp/hosts/odhcpd'
dhcp.odhcpd.leasetrigger='/usr/sbin/odhcpd-update'
dhcp.odhcpd.loglevel='4'
cat /var/etc/dnsmasq.conf.cfg01411c
dhcp-range=set:lan,19,,255.255.255.128,2m

test 2) does assign, router .13, range 1-12

root@OpenWrt:/# uci show dhcp
dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].domainneeded='1'
dhcp.@dnsmasq[0].boguspriv='1'
dhcp.@dnsmasq[0].filterwin2k='0'
dhcp.@dnsmasq[0].localise_queries='1'
dhcp.@dnsmasq[0].rebind_protection='1'
dhcp.@dnsmasq[0].rebind_localhost='1'
dhcp.@dnsmasq[0].local='/lan/'
dhcp.@dnsmasq[0].domain='lan'
dhcp.@dnsmasq[0].expandhosts='1'
dhcp.@dnsmasq[0].nonegcache='0'
dhcp.@dnsmasq[0].cachesize='1000'
dhcp.@dnsmasq[0].authoritative='1'
dhcp.@dnsmasq[0].readethers='1'
dhcp.@dnsmasq[0].leasefile='/tmp/dhcp.leases'
dhcp.@dnsmasq[0].resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'
dhcp.@dnsmasq[0].nonwildcard='1'
dhcp.@dnsmasq[0].localservice='1'
dhcp.@dnsmasq[0].ednspacket_max='1232'
dhcp.@dnsmasq[0].filter_aaaa='0'
dhcp.@dnsmasq[0].filter_a='0'
dhcp.@dnsmasq[0].confdir='/tmp/dnsmasq.d'
dhcp.lan=dhcp
dhcp.lan.interface='lan'
dhcp.lan.start='1'
dhcp.lan.limit='12'
dhcp.lan.leasetime='2m'
dhcp.lan.dhcpv4='server'
dhcp.lan.dhcpv6='server'
dhcp.lan.ra='server'
dhcp.lan.ra_slaac='1'
dhcp.lan.ra_flags='managed-config' 'other-config'
dhcp.wan=dhcp
dhcp.wan.interface='wan'
dhcp.wan.ignore='1'
dhcp.odhcpd=odhcpd
dhcp.odhcpd.maindhcp='0'
dhcp.odhcpd.leasefile='/tmp/hosts/odhcpd'
dhcp.odhcpd.leasetrigger='/usr/sbin/odhcpd-update'
dhcp.odhcpd.loglevel='4'
cat /var/etc/dnsmasq.conf.cfg01411c
dhcp-range=set:lan,192.168.1.1,192.168.1.12,255.255.255.128,2m

test 3) does assign, router .13, range 14-126

root@OpenWrt:/# uci show dhcp
dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].domainneeded='1'
dhcp.@dnsmasq[0].boguspriv='1'
dhcp.@dnsmasq[0].filterwin2k='0'
dhcp.@dnsmasq[0].localise_queries='1'
dhcp.@dnsmasq[0].rebind_protection='1'
dhcp.@dnsmasq[0].rebind_localhost='1'
dhcp.@dnsmasq[0].local='/lan/'
dhcp.@dnsmasq[0].domain='lan'
dhcp.@dnsmasq[0].expandhosts='1'
dhcp.@dnsmasq[0].nonegcache='0'
dhcp.@dnsmasq[0].cachesize='1000'
dhcp.@dnsmasq[0].authoritative='1'
dhcp.@dnsmasq[0].readethers='1'
dhcp.@dnsmasq[0].leasefile='/tmp/dhcp.leases'
dhcp.@dnsmasq[0].resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'
dhcp.@dnsmasq[0].nonwildcard='1'
dhcp.@dnsmasq[0].localservice='1'
dhcp.@dnsmasq[0].ednspacket_max='1232'
dhcp.@dnsmasq[0].filter_aaaa='0'
dhcp.@dnsmasq[0].filter_a='0'
dhcp.@dnsmasq[0].confdir='/tmp/dnsmasq.d'
dhcp.lan=dhcp
dhcp.lan.interface='lan'
dhcp.lan.start='14'
dhcp.lan.limit='126'
dhcp.lan.leasetime='2m'
dhcp.lan.dhcpv4='server'
dhcp.lan.dhcpv6='server'
dhcp.lan.ra='server'
dhcp.lan.ra_slaac='1'
dhcp.lan.ra_flags='managed-config' 'other-config'
dhcp.wan=dhcp
dhcp.wan.interface='wan'
dhcp.wan.ignore='1'
dhcp.odhcpd=odhcpd
dhcp.odhcpd.maindhcp='0'
dhcp.odhcpd.leasefile='/tmp/hosts/odhcpd'
dhcp.odhcpd.leasetrigger='/usr/sbin/odhcpd-update'
dhcp.odhcpd.loglevel='4'
cat /var/etc/dnsmasq.conf.cfg01411c
dhcp-range=set:lan,192.168.1.14,192.168.1.126,255.255.255.128,2m

test 4) does assign, router .13, range 124-126

root@OpenWrt:/# uci show dhcp
dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].domainneeded='1'
dhcp.@dnsmasq[0].boguspriv='1'
dhcp.@dnsmasq[0].filterwin2k='0'
dhcp.@dnsmasq[0].localise_queries='1'
dhcp.@dnsmasq[0].rebind_protection='1'
dhcp.@dnsmasq[0].rebind_localhost='1'
dhcp.@dnsmasq[0].local='/lan/'
dhcp.@dnsmasq[0].domain='lan'
dhcp.@dnsmasq[0].expandhosts='1'
dhcp.@dnsmasq[0].nonegcache='0'
dhcp.@dnsmasq[0].cachesize='1000'
dhcp.@dnsmasq[0].authoritative='1'
dhcp.@dnsmasq[0].readethers='1'
dhcp.@dnsmasq[0].leasefile='/tmp/dhcp.leases'
dhcp.@dnsmasq[0].resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'
dhcp.@dnsmasq[0].nonwildcard='1'
dhcp.@dnsmasq[0].localservice='1'
dhcp.@dnsmasq[0].ednspacket_max='1232'
dhcp.@dnsmasq[0].filter_aaaa='0'
dhcp.@dnsmasq[0].filter_a='0'
dhcp.@dnsmasq[0].confdir='/tmp/dnsmasq.d'
dhcp.lan=dhcp
dhcp.lan.interface='lan'
dhcp.lan.start='124'
dhcp.lan.limit='126'
dhcp.lan.leasetime='2m'
dhcp.lan.dhcpv4='server'
dhcp.lan.dhcpv6='server'
dhcp.lan.ra='server'
dhcp.lan.ra_slaac='1'
dhcp.lan.ra_flags='managed-config' 'other-config'
dhcp.wan=dhcp
dhcp.wan.interface='wan'
dhcp.wan.ignore='1'
dhcp.odhcpd=odhcpd
dhcp.odhcpd.maindhcp='0'
dhcp.odhcpd.leasefile='/tmp/hosts/odhcpd'
dhcp.odhcpd.leasetrigger='/usr/sbin/odhcpd-update'
dhcp.odhcpd.loglevel='4'

ifconfig [...] ens6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.126 netmask 255.255.255.128 broadcast 192.168.1.127 [...]

test 5) does not assign, router .13, range 1-20

root@OpenWrt:/# uci show dhcp
dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].domainneeded='1'
dhcp.@dnsmasq[0].boguspriv='1'
dhcp.@dnsmasq[0].filterwin2k='0'
dhcp.@dnsmasq[0].localise_queries='1'
dhcp.@dnsmasq[0].rebind_protection='1'
dhcp.@dnsmasq[0].rebind_localhost='1'
dhcp.@dnsmasq[0].local='/lan/'
dhcp.@dnsmasq[0].domain='lan'
dhcp.@dnsmasq[0].expandhosts='1'
dhcp.@dnsmasq[0].nonegcache='0'
dhcp.@dnsmasq[0].cachesize='1000'
dhcp.@dnsmasq[0].authoritative='1'
dhcp.@dnsmasq[0].readethers='1'
dhcp.@dnsmasq[0].leasefile='/tmp/dhcp.leases'
dhcp.@dnsmasq[0].resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'
dhcp.@dnsmasq[0].nonwildcard='1'
dhcp.@dnsmasq[0].localservice='1'
dhcp.@dnsmasq[0].ednspacket_max='1232'
dhcp.@dnsmasq[0].filter_aaaa='0'
dhcp.@dnsmasq[0].filter_a='0'
dhcp.@dnsmasq[0].confdir='/tmp/dnsmasq.d'
dhcp.lan=dhcp
dhcp.lan.interface='lan'
dhcp.lan.start='1'
dhcp.lan.limit='20'
dhcp.lan.leasetime='2m'
dhcp.lan.dhcpv4='server'
dhcp.lan.dhcpv6='server'
dhcp.lan.ra='server'
dhcp.lan.ra_slaac='1'
dhcp.lan.ra_flags='managed-config' 'other-config'
dhcp.wan=dhcp
dhcp.wan.interface='wan'
dhcp.wan.ignore='1'
dhcp.odhcpd=odhcpd
dhcp.odhcpd.maindhcp='0'
dhcp.odhcpd.leasefile='/tmp/hosts/odhcpd'
dhcp.odhcpd.leasetrigger='/usr/sbin/odhcpd-update'
dhcp.odhcpd.loglevel='4'
cat /var/etc/dnsmasq.conf.cfg01411c
dhcp-range=set:lan,19,,255.255.255.128,2m

based on the conversation in other topic i want to partially answer my question. I wouldn't call i a bug now. one user made a fair statement about the error message that this change introduces and he somehow convinced me.

i need to rephrase my doubts to: it is likely not a bug. for some reason it was needed feature. what was the reason it is not explained in the comment for this commit. this check forces some kind of configuration, probably a kind that represents vast majority of the configurations ever done. this feature breaks some configuration allowable by RFCs, usually considered as unusual, but not forbidden.

RFCs are really not (always) the bee's knees; there are quite crappy ones out there (as well as very good ones, my point is, just because it is in a RFC or BCP, does not mean we should accept it without scrutiny). Also RFCs do not cover every eventuality, occasionally things that seem obvious are not included in an RFC. Whether any of this applies here I have no opinion on yet.

The point about your configuration to me mainly is, that the DHCP server typically does not know about IP addresses assigned manually, so if you manually assign the router's IP address you might at least create a static DHCP lease for that IP address just to avoid having the server trying to hand out that address. At that point it seems considerably simpler to follow the 'classical' approach, reserve an address range for static manual assignments that will be used for the router among others and that is excluded fro0m the dhcp range, as well as a dhcp range of the appropriate size. Yes that is not the only permissible configuration but a pretty sane one...
My take on your configuration is that it seemingly relies on second round error checking, that is the dhcpd has no idea about that address from its range being used (as it has not handed out that address) I assume what happens if a client gets this address it will check whether this address is unique and since it is already in use this check will fail and the client will reject that DHCP address and request another one. This seems less like a reasonably permitted 'lawful' configuration but rather a mis-configuration considered likely enough to add work-around code...

Theory.

Because your static router ip on x.x.x.13 counts as ip 1 of the 126 pool range, you should reduce the dynamic leases that can be served by 1.

have you seen my other tests posted above? it is not a matter of range, it is a matter of router ip being within the range.

I was just replying to the logic of 126 pool addresses + 1 static in the pool. In theory because I’ve never seen anybody actually attempt to do this in practice.

To answer your question, yes I did, and they confirmed your router ip being in the range was an issue as I originally pointed out in post #4 here. (Before @dave14305 ’s post in your companion thread).

Frankly, I didn’t see any value responding to your tests as it became pretty clear in your companion
thread, (After @dave14305 ’s post about mods to ipcalc.sh) that this was your issue and this thread was now moot.