Re: [Dnsmasq-discuss] Possible lease matching/reuse bug
On Tue, Sep 08, 2020 at 11:31:27AM +0100, Jerome Vuarand wrote: > On Tue, 8 Sep 2020 at 09:36, john doe wrote: > >On 9/8/2020 9:19 AM, Jerome Vuarand wrote: > >> I believe I'm triggering a bug where a static dhcp-host config does't > >> seem to match the existing lease the second time that client connects. > >> > >> I'm running dnsmasq from a Raspberry Pi acting as a WiFi access point. > >> I have a mixture of IoT devices connecting to it. I'd like most > >> clients to get a dynamic IP address, but some to get a static one > >> based on their name, so I use a combination of dhcp-range and > >> dhcp-host. I have the following config: > >> > >> interface=ap0 > >> dhcp-range=192.168.4.100,192.168.4.250,255.255.255.0,24h > >> domain=example.com > >> dhcp-script=/home/pi/my_web_ui/dnsmasq_script > >> dhcp-leasefile=/var/run/dnsmasq.leases > >> dhcp-host=target ? > >> > >> And I have an entry in /etc/hosts that associate target to > >> 192.168.4.2, the dnsmasq server itself is 192.168.4.1. > >> > > > > Are you seeing the same thing if you do: > > > > 'dhcp-host=target,192.168.4.2' ??? > > The problem happens too, yes. > > > The above assumes that the hosts file does not contain the Ip in question. > > I tested both cases, and all 4 combinations are problematic. Obviously > with no hosts entry and no ip in dhcp-host dnsmaq has no way to know > what IP I want to assign, but all three other combinations have the > intermittent problem. Manual page snippet from http://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html --dhcp-host=[][,id:|*][,set:][tag:][,][,][,][,ignore] text ... allocated the same hostname, IP address ... more text ... It says provide server side with information how to identify client side so it can do the wanted assignment Groeten Geert Stappers -- Silence is hard to parse ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Possible lease matching/reuse bug
I warned you Kelleys! DON'T Cut 5G Towers Down! https://www.youtube.com/watch?v=3ZRcLOx8Ge0 From: "Jerome Vuarand" To: "john doe" Cc: dnsmasq-discuss@lists.thekelleys.org.uk Sent: Tuesday, September 8, 2020 10:31:27 AM Subject: Re: [Dnsmasq-discuss] Possible lease matching/reuse bug On Tue, 8 Sep 2020 at 09:36, john doe wrote: >On 9/8/2020 9:19 AM, Jerome Vuarand wrote: >> I believe I'm triggering a bug where a static dhcp-host config does't >> seem to match the existing lease the second time that client connects. >> >> I'm running dnsmasq from a Raspberry Pi acting as a WiFi access point. >> I have a mixture of IoT devices connecting to it. I'd like most >> clients to get a dynamic IP address, but some to get a static one >> based on their name, so I use a combination of dhcp-range and >> dhcp-host. I have the following config: >> >> interface=ap0 >> dhcp-range=192.168.4.100,192.168.4.250,255.255.255.0,24h >> domain=example.com >> dhcp-script=/home/pi/my_web_ui/dnsmasq_script >> dhcp-leasefile=/var/run/dnsmasq.leases >> dhcp-host=target >> >> And I have an entry in /etc/hosts that associate target to >> 192.168.4.2, the dnsmasq server itself is 192.168.4.1. >> > > Are you seeing the same thing if you do: > > 'dhcp-host=target,192.168.4.2' The problem happens too, yes. > The above assumes that the hosts file does not contain the Ip in question. I tested both cases, and all 4 combinations are problematic. Obviously with no hosts entry and no ip in dhcp-host dnsmaq has no way to know what IP I want to assign, but all three other combinations have the intermittent problem. ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Possible lease matching/reuse bug
On Tue, 8 Sep 2020 at 09:36, john doe wrote: >On 9/8/2020 9:19 AM, Jerome Vuarand wrote: >> I believe I'm triggering a bug where a static dhcp-host config does't >> seem to match the existing lease the second time that client connects. >> >> I'm running dnsmasq from a Raspberry Pi acting as a WiFi access point. >> I have a mixture of IoT devices connecting to it. I'd like most >> clients to get a dynamic IP address, but some to get a static one >> based on their name, so I use a combination of dhcp-range and >> dhcp-host. I have the following config: >> >> interface=ap0 >> dhcp-range=192.168.4.100,192.168.4.250,255.255.255.0,24h >> domain=example.com >> dhcp-script=/home/pi/my_web_ui/dnsmasq_script >> dhcp-leasefile=/var/run/dnsmasq.leases >> dhcp-host=target >> >> And I have an entry in /etc/hosts that associate target to >> 192.168.4.2, the dnsmasq server itself is 192.168.4.1. >> > > Are you seeing the same thing if you do: > > 'dhcp-host=target,192.168.4.2' The problem happens too, yes. > The above assumes that the hosts file does not contain the Ip in question. I tested both cases, and all 4 combinations are problematic. Obviously with no hosts entry and no ip in dhcp-host dnsmaq has no way to know what IP I want to assign, but all three other combinations have the intermittent problem. ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Possible lease matching/reuse bug
On 9/8/2020 9:19 AM, Jerome Vuarand wrote: Hi, I believe I'm triggering a bug where a static dhcp-host config does't seem to match the existing lease the second time that client connects. I'm running dnsmasq from a Raspberry Pi acting as a WiFi access point. I have a mixture of IoT devices connecting to it. I'd like most clients to get a dynamic IP address, but some to get a static one based on their name, so I use a combination of dhcp-range and dhcp-host. I have the following config: interface=ap0 dhcp-range=192.168.4.100,192.168.4.250,255.255.255.0,24h domain=example.com dhcp-script=/home/pi/my_web_ui/dnsmasq_script dhcp-leasefile=/var/run/dnsmasq.leases dhcp-host=target And I have an entry in /etc/hosts that associate target to 192.168.4.2, the dnsmasq server itself is 192.168.4.1. Are you seeing the same thing if you do: 'dhcp-host=target,192.168.4.2' The above assumes that the hosts file does not contain the Ip in question. -- John Doe ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] Possible lease matching/reuse bug
Hi, I believe I'm triggering a bug where a static dhcp-host config does't seem to match the existing lease the second time that client connects. I'm running dnsmasq from a Raspberry Pi acting as a WiFi access point. I have a mixture of IoT devices connecting to it. I'd like most clients to get a dynamic IP address, but some to get a static one based on their name, so I use a combination of dhcp-range and dhcp-host. I have the following config: interface=ap0 dhcp-range=192.168.4.100,192.168.4.250,255.255.255.0,24h domain=example.com dhcp-script=/home/pi/my_web_ui/dnsmasq_script dhcp-leasefile=/var/run/dnsmasq.leases dhcp-host=target And I have an entry in /etc/hosts that associate target to 192.168.4.2, the dnsmasq server itself is 192.168.4.1. The clients are dumb and forget their leases on reboot. I can get my setup to work the first time a client connects. However if it loses power, reconnects and asks for a new IP, it seems that dnsmasq can't match the previous lease. The first time the "target" client connects, it gets the right IP, and I get that in the lease file: 1550252252 b8:27:eb:a6:d4:d6 192.168.4.2 target ff:eb:a6:d4:d6:00:01:00:01:23:f7:fb:8a:b8:27:eb:a6:d4:d6 If I reboot it, it gets the IP 192.168.4.200, and I get two leases in the file with the same MAC address: 1550252386 b8:27:eb:a6:d4:d6 192.168.4.200 * ff:eb:a6:d4:d6:00:01:00:01:23:f7:fb:8b:b8:27:eb:a6:d4:d6 1550252252 b8:27:eb:a6:d4:d6 192.168.4.2 target ff:eb:a6:d4:d6:00:01:00:01:23:f7:fb:8a:b8:27:eb:a6:d4:d6 Then if I reboot it again, it gets the correct IP 192.168.4.2, and updates the second lease: 1550252386 b8:27:eb:a6:d4:d6 192.168.4.200 * ff:eb:a6:d4:d6:00:01:00:01:23:f7:fb:8b:b8:27:eb:a6:d4:d6 1550252496 b8:27:eb:a6:d4:d6 192.168.4.2 target ff:eb:a6:d4:d6:00:01:00:01:23:f7:fb:8a:b8:27:eb:a6:d4:d6 I did a lot of tests with different variants of dhcp-host, and I was about to report them when I realized the problem doesn't happen 100% of the time. Sometimes it takes 3 or more reboots to get the second lease in the file, and from then on it alternates between the two addresses. Whenever the wrong IP is assigned, I get an extra syslog line which reads: club dnsmasq-dhcp[1211]: not using configured address 192.168.4.2 because it is leased to b8:27:eb:a6:d4:d6 But then the next time I don't get the line and I get the correct IP. The only workaround I got so far is to put the MAC address in the dhcp-host line, but I'd really like to avoid that as they are very likely to change from time to time. The latest version on that distro is as follows: Dnsmasq version 2.80 Copyright (c) 2000-2018 Simon Kelley Compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile I don't think I would be able to compile it myself to test the latest. Cheers, Jérôme. ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss