Comment 13 for bug 2042587

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Reproducing the bug

root@j-dnsmasq-2042587:~# apt-cache policy dnsmasq
dnsmasq:
  Installed: 2.86-1.1ubuntu0.4
  Candidate: 2.86-1.1ubuntu0.4
  Version table:
 *** 2.86-1.1ubuntu0.4 500
        500 http://br.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages
        100 /var/lib/dpkg/status
     2.86-1.1ubuntu0.3 500
        500 http://br.archive.ubuntu.com/ubuntu jammy-security/universe amd64 Packages
     2.86-1.1 500
        500 http://br.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages

Running the setup script:
# ./setup-and-server.sh

Cleaning up
Setting things up...

Commands to run in another terminal:

No DHCP relay:

  ip netns exec client dhclient -d -v p2

With DHCP relay set to 192.168.47.9, IP should NOT be that address:

  ip netns exec client dhclient -d -v p2 -g 192.168.47.9

Starting server, observe output and run the test commands above.
Press ctrl-c when done.

dnsmasq: started, version 2.86 cachesize 150
dnsmasq: compile time options: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 no-Lua TFTP conntrack ipset auth cryptohash DNSSEC loop-detect inotify dumpfile
dnsmasq-dhcp: DHCP, IP range 192.168.47.10 -- 192.168.47.250, lease time 12h
dnsmasq-dhcp: DHCP, sockets bound exclusively to interface p1
dnsmasq: reading /etc/resolv.conf
dnsmasq: using nameserver 127.0.0.53#53
dnsmasq: read /etc/hosts - 7 addresses

For the "no DHCP relay" case:
# ip netns exec client dhclient -d -v p2
(...)
bound to 192.168.47.209 -- renewal in 21350 seconds.

And the server logs:
dnsmasq-dhcp: DHCPDISCOVER(p1) ee:a3:dd:58:d8:35
dnsmasq-dhcp: DHCPOFFER(p1) 192.168.47.209 ee:a3:dd:58:d8:35
dnsmasq-dhcp: DHCPREQUEST(p1) 192.168.47.209 ee:a3:dd:58:d8:35
dnsmasq-dhcp: DHCPACK(p1) 192.168.47.209 ee:a3:dd:58:d8:35 j-dnsmasq-2042587
###########################
IP = 192.168.47.209
###########################

That's the correct IP we want to see. Now, on to the bug, which is WITH a DHCP relay.

We run this on the client:
# ip netns exec client dhclient -d -v p2 -g 192.168.47.9
(...)
DHCPREQUEST for 192.168.47.209 on p2 to 255.255.255.255 port 67 (xid=0x7f70085a)

And the server logs the incorrect iP:
dnsmasq-dhcp: DHCPREQUEST(p1) 192.168.47.209 ee:a3:dd:58:d8:35
dnsmasq-dhcp: DHCPACK(p1) 192.168.47.209 ee:a3:dd:58:d8:35 j-dnsmasq-2042587
###########################
IP = 192.168.47.9
TEST FAILED
###########################

Now let's use the package from proposed:

root@j-dnsmasq-2042587:~# apt-cache policy dnsmasq
dnsmasq:
  Installed: 2.86-1.1ubuntu0.5
  Candidate: 2.86-1.1ubuntu0.5
  Version table:
 *** 2.86-1.1ubuntu0.5 500
        500 http://br.archive.ubuntu.com/ubuntu jammy-proposed/universe amd64 Packages
        100 /var/lib/dpkg/status
     2.86-1.1ubuntu0.4 500
        500 http://br.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages
     2.86-1.1ubuntu0.3 500
        500 http://br.archive.ubuntu.com/ubuntu jammy-security/universe amd64 Packages
     2.86-1.1 500
        500 http://br.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages

We run the server script again:

The no-relay case:
# ip netns exec client dhclient -d -v p2
(...)
bound to 192.168.47.155 -- renewal in 19424 seconds.

Where the server logs:
(...)
dnsmasq-dhcp: DHCPACK(p1) 192.168.47.155 e2:c1:8c:88:0d:94 j-dnsmasq-2042587
###########################
IP = 192.168.47.155
###########################

Which was already working before, but now let's try the relay case, which was broken before:
# ip netns exec client dhclient -d -v p2 -g 192.168.47.9
(...)
DHCPREQUEST for 192.168.47.155 on p2 to 255.255.255.255 port 67 (xid=0x292ace5c)

Now the server logs the correct IP:
dnsmasq-dhcp: DHCPREQUEST(p1) 192.168.47.155 e2:c1:8c:88:0d:94
dnsmasq-dhcp: DHCPACK(p1) 192.168.47.155 e2:c1:8c:88:0d:94 j-dnsmasq-2042587
###########################
IP = 192.168.47.155
###########################

Jammy verification succeeded.