I'm so sorry this is so complex, but I couldn't figure out any simpler way to reproduce as they components involved do network configuration.
Anyway, please find attached a docker compose file and related dnsmasq configurations (mapped automatically in that compose file) that helps in the reproduction by setting up two different dhcp servers based on dnsmasq (focal and jammy) and a machine that can be used to request a dhcp address.
To reproduce the bug:
1) first install everything needed by running
docker-compose up -d
2) wait until everything has been installed, check for example that the output of has something from all 3 containers and is not getting any more lines
docker-compose logs --follow
3) stop jammy version of the server with
docker-compose stop jammy-server
4) get inside client machine to run dhclient. Run it first without fake relay address, then with one (to trigger the DHCP relay behaviour in dnsmasq)
docker-compose exec client bash
dhclient -d -v
(ctrl-c after a while)
dhclient -d -v -g 192.168.0.10
(ctrl-c after a while)
5) observe server's log
dnsmasq-script-sample-focal-server-1 | dnsmasq-dhcp: DHCPREQUEST(eth0) 192.168.0.3 02:42:c0:a8:00:04
dnsmasq-script-sample-focal-server-1 | dnsmasq-dhcp: DHCPACK(eth0) 192.168.0.3 02:42:c0:a8:00:04 5a49beb3cd53
dnsmasq-script-sample-focal-server-1 | hello from dhcp hook script, IP argument is 192.168.0.3
dnsmasq-script-sample-focal-server-1 | dnsmasq-dhcp: DHCPREQUEST(eth0) 192.168.0.3 02:42:c0:a8:00:04
dnsmasq-script-sample-focal-server-1 | dnsmasq-dhcp: DHCPACK(eth0) 192.168.0.3 02:42:c0:a8:00:04 5a49beb3cd53
dnsmasq-script-sample-focal-server-1 | hello from dhcp hook script, IP argument is 192.168.0.3
6) now stop focal version of server and start jammy:
docker-compose stop focal-server
docker-compose start jammy-server
7) repeat steps 5 and 6, this time the output has the wroing ip in the 2nd hook script invocation
dnsmasq-script-sample-jammy-server-1 | dnsmasq-dhcp: DHCPREQUEST(eth0) 192.168.0.1 02:42:c0:a8:00:04
dnsmasq-script-sample-jammy-server-1 | dnsmasq-dhcp: DHCPACK(eth0) 192.168.0.1 02:42:c0:a8:00:04 5a49beb3cd53
dnsmasq-script-sample-jammy-server-1 | hello from dhcp hook script, IP argument is 192.168.0.1
dnsmasq-script-sample-jammy-server-1 | dnsmasq-dhcp: DHCPREQUEST(eth0) 192.168.0.1 02:42:c0:a8:00:04
dnsmasq-script-sample-jammy-server-1 | dnsmasq-dhcp: DHCPACK(eth0) 192.168.0.1 02:42:c0:a8:00:04 5a49beb3cd53
dnsmasq-script-sample-jammy-server-1 | hello from dhcp hook script, IP argument is 192.168.0.10
I'm so sorry this is so complex, but I couldn't figure out any simpler way to reproduce as they components involved do network configuration.
Anyway, please find attached a docker compose file and related dnsmasq configurations (mapped automatically in that compose file) that helps in the reproduction by setting up two different dhcp servers based on dnsmasq (focal and jammy) and a machine that can be used to request a dhcp address.
To reproduce the bug: script- sample- focal-server- 1 | dnsmasq-dhcp: DHCPREQUEST(eth0) 192.168.0.3 02:42:c0:a8:00:04 script- sample- focal-server- 1 | dnsmasq-dhcp: DHCPACK(eth0) 192.168.0.3 02:42:c0:a8:00:04 5a49beb3cd53 script- sample- focal-server- 1 | hello from dhcp hook script, IP argument is 192.168.0.3 script- sample- focal-server- 1 | dnsmasq-dhcp: DHCPREQUEST(eth0) 192.168.0.3 02:42:c0:a8:00:04 script- sample- focal-server- 1 | dnsmasq-dhcp: DHCPACK(eth0) 192.168.0.3 02:42:c0:a8:00:04 5a49beb3cd53 script- sample- focal-server- 1 | hello from dhcp hook script, IP argument is 192.168.0.3 script- sample- jammy-server- 1 | dnsmasq-dhcp: DHCPREQUEST(eth0) 192.168.0.1 02:42:c0:a8:00:04 script- sample- jammy-server- 1 | dnsmasq-dhcp: DHCPACK(eth0) 192.168.0.1 02:42:c0:a8:00:04 5a49beb3cd53 script- sample- jammy-server- 1 | hello from dhcp hook script, IP argument is 192.168.0.1 script- sample- jammy-server- 1 | dnsmasq-dhcp: DHCPREQUEST(eth0) 192.168.0.1 02:42:c0:a8:00:04 script- sample- jammy-server- 1 | dnsmasq-dhcp: DHCPACK(eth0) 192.168.0.1 02:42:c0:a8:00:04 5a49beb3cd53 script- sample- jammy-server- 1 | hello from dhcp hook script, IP argument is 192.168.0.10
1) first install everything needed by running
docker-compose up -d
2) wait until everything has been installed, check for example that the output of has something from all 3 containers and is not getting any more lines
docker-compose logs --follow
3) stop jammy version of the server with
docker-compose stop jammy-server
4) get inside client machine to run dhclient. Run it first without fake relay address, then with one (to trigger the DHCP relay behaviour in dnsmasq)
docker-compose exec client bash
dhclient -d -v
(ctrl-c after a while)
dhclient -d -v -g 192.168.0.10
(ctrl-c after a while)
5) observe server's log
dnsmasq-
dnsmasq-
dnsmasq-
dnsmasq-
dnsmasq-
dnsmasq-
6) now stop focal version of server and start jammy:
docker-compose stop focal-server
docker-compose start jammy-server
7) repeat steps 5 and 6, this time the output has the wroing ip in the 2nd hook script invocation
dnsmasq-
dnsmasq-
dnsmasq-
dnsmasq-
dnsmasq-
dnsmasq-