[Touch-packages] [Bug 2042587] [NEW] jammy's version breaks existing dhcp scripts with relay

2023-11-02 Thread Timo M
Public bug reported:

When upgrading from focal to jammy, existing dnsmasq dhcp-scripts
stopped working in an environment where a DHCP relay is in use. Instead
of the expected client IP address, the script gets the _relay_ IP
address as an argument. From dnsmasq documentation for --dhcp-script:

> The arguments to the process are "add", "old" or "del", the MAC
address of the host (or DUID for IPv6) , the IP address, and the
hostname, if known.

I believe the change has been inadverently made in upstream commit
527c3c7d0d3bb4bf5fad699f10cf0d1a45a54692
(https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blobdiff;f=src/helper.c;h=02340a01c00031db0cc682c8a4a279cfc1db574e;hp=d81de9622e6d484a264496b2cd3638b4e15e9677;hb=527c3c7d0d3bb4bf5fad699f10cf0d1a45a54692;hpb=fcb4dcaf7cc8a86ac2533b933161b6455f75bf8f)
as the commit message only speaks about inet_ntoa replacement and not
the behavioral change it also introduces (previously the relay address
was only set to the environment variable, now it effectively overrides
the prevoiusly set client's IP address).

dnsmasq 2.86-1.1ubuntu0.3 / Ubuntu 22.04

** Affects: dnsmasq (Ubuntu)
 Importance: Undecided
 Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to dnsmasq in Ubuntu.
https://bugs.launchpad.net/bugs/2042587

Title:
  jammy's version breaks existing dhcp scripts with relay

Status in dnsmasq package in Ubuntu:
  New

Bug description:
  When upgrading from focal to jammy, existing dnsmasq dhcp-scripts
  stopped working in an environment where a DHCP relay is in use.
  Instead of the expected client IP address, the script gets the _relay_
  IP address as an argument. From dnsmasq documentation for --dhcp-
  script:

  > The arguments to the process are "add", "old" or "del", the MAC
  address of the host (or DUID for IPv6) , the IP address, and the
  hostname, if known.

  I believe the change has been inadverently made in upstream commit
  527c3c7d0d3bb4bf5fad699f10cf0d1a45a54692
  
(https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blobdiff;f=src/helper.c;h=02340a01c00031db0cc682c8a4a279cfc1db574e;hp=d81de9622e6d484a264496b2cd3638b4e15e9677;hb=527c3c7d0d3bb4bf5fad699f10cf0d1a45a54692;hpb=fcb4dcaf7cc8a86ac2533b933161b6455f75bf8f)
  as the commit message only speaks about inet_ntoa replacement and not
  the behavioral change it also introduces (previously the relay address
  was only set to the environment variable, now it effectively overrides
  the prevoiusly set client's IP address).

  dnsmasq 2.86-1.1ubuntu0.3 / Ubuntu 22.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dnsmasq/+bug/2042587/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


[Touch-packages] [Bug 2042587] Re: jammy's version breaks existing dhcp scripts with relay

2023-11-06 Thread Timo M
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


** Attachment added: "archive containing docker-compose.yml and needed 
configuration files"
   
https://bugs.launchpad.net/ubuntu/+source/dnsmasq/+bug/2042587/+attachment/5716459/+files/sample.tar.gz

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to dnsmasq in Ubuntu.
https://bugs.launchpad.net/bugs/2042587

Title:
  jammy's version breaks existing dhcp scripts with relay

Status in dnsmasq package in Ubuntu:
  Incomplete

Bug description:
  When upgrading from focal to jammy, existing dnsmasq dhcp-scripts
  stopped working in an environment where a DHCP relay is in use.
  Instead of the expected client IP address, the script gets the _relay_
  IP address as an argument. From dnsmasq documentation for --dhcp-
  script:

  > The arguments to the process are "add", "old" or "del", the MAC
  address of the host (or DUID for IPv6) , the IP address, and the
  hostname, if known.

  I believe the change has been inadverently made in upstream commit
  527c3c7d0d3bb4bf5fad699f10cf0d1a45a54692
  
(https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blobdiff;f=src/helper.c;h=02340a01c00031db0cc682c8a4a279cfc1db574e;hp=d81de9622e6d484a264496b2cd3638b4e15e9677;hb=527c3c7d0d3bb4bf5fad699f10cf0d1a45a54692;hpb=fcb4dcaf7cc8a86ac2533b933161b6455f75bf8f)
  as the commit message only speaks about inet_ntoa replacement and not
  the behavioral change it also introduces (previously the relay address
  was only set to the environment variable, now it effectively overrides
  the prevoiusly set client's IP address).

  dnsmasq 2.86-1.1ubuntu0.3 / Ubuntu 22.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dnsmasq/+bug/2042587/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


[Touch-packages] [Bug 2042587] Re: jammy's version breaks existing dhcp scripts with relay

2023-11-06 Thread Timo M
..also, apologies for all the typos I managed to place there. Step 7 was
meant to say "repeat steps 4 and 5"

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to dnsmasq in Ubuntu.
https://bugs.launchpad.net/bugs/2042587

Title:
  jammy's version breaks existing dhcp scripts with relay

Status in dnsmasq package in Ubuntu:
  Incomplete

Bug description:
  When upgrading from focal to jammy, existing dnsmasq dhcp-scripts
  stopped working in an environment where a DHCP relay is in use.
  Instead of the expected client IP address, the script gets the _relay_
  IP address as an argument. From dnsmasq documentation for --dhcp-
  script:

  > The arguments to the process are "add", "old" or "del", the MAC
  address of the host (or DUID for IPv6) , the IP address, and the
  hostname, if known.

  I believe the change has been inadverently made in upstream commit
  527c3c7d0d3bb4bf5fad699f10cf0d1a45a54692
  
(https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blobdiff;f=src/helper.c;h=02340a01c00031db0cc682c8a4a279cfc1db574e;hp=d81de9622e6d484a264496b2cd3638b4e15e9677;hb=527c3c7d0d3bb4bf5fad699f10cf0d1a45a54692;hpb=fcb4dcaf7cc8a86ac2533b933161b6455f75bf8f)
  as the commit message only speaks about inet_ntoa replacement and not
  the behavioral change it also introduces (previously the relay address
  was only set to the environment variable, now it effectively overrides
  the prevoiusly set client's IP address).

  dnsmasq 2.86-1.1ubuntu0.3 / Ubuntu 22.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dnsmasq/+bug/2042587/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


[Touch-packages] [Bug 2042587] Re: jammy's version breaks existing dhcp scripts with relay

2024-01-21 Thread Timo M
Hello,

and thank you, seems to fix the issue. I updated my jammy's to dsnmasq
version 2.86-1.1ubuntu0.5, and tested with the same setup as I reported
the original bug. Can confirm that the DHCP hook script now works exatly
like it used to in focal, getting the correct IP address as an argument.


** Tags removed: verification-needed-jammy
** Tags added: verification-done-jammy

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to dnsmasq in Ubuntu.
https://bugs.launchpad.net/bugs/2042587

Title:
  jammy's version breaks existing dhcp scripts with relay

Status in dnsmasq package in Ubuntu:
  Fix Released
Status in dnsmasq source package in Jammy:
  Fix Committed

Bug description:
  [ Impact ]

  When upgrading from focal to jammy, existing dnsmasq dhcp-scripts
  stopped working in an environment where a DHCP relay is in use.
  Instead of the expected client IP address, the script gets the _relay_
  IP address as an argument.

  This was fixed in 2.87, therefore making only jammy carry an affected
  package.

  [ Test Plan ]

  To easily test this on a single machine, a test script is being
  provided to setup networking and dnsmasq configuration.

  # Launch a jammy VM

  lxc launch ubuntu-daily:jammy j-dnsmasq-2042587 --vm

  # open a root shell in that VM. All subsequent commands must be
  executed as root in that VM

  lxc shell j-dnsmasq-2042587

  # download test script

  wget
  
https://bugs.launchpad.net/ubuntu/+source/dnsmasq/+bug/2042587/+attachment/5738174/+files/setup-
  and-server.sh

  # make it executable

  chmod +x setup-and-server.sh

  # install dnsmasq. Ignore the postinst error (because systemd-resolved
  is also running and there is a port conflict)

  apt update && apt install dnsmasq -y

  # run the setup script. It will configure things and start dnsmasq
  ready to be tested

  ./setup-and-server.sh

  # in another root session inside the vm (so run "lxc shell
  j-dnsmasq-2042587" in another terminal), run the proposed commands
  from the setup script (and press ctrl-c after the result is shown):

  No DHCP relay:

    ip netns exec client dhclient -d -v p2

  The setup script should log an IP that is not a relay. For example:
  dnsmasq-dhcp: DHCPDISCOVER(p1) aa:a0:9d:00:5b:d6
  dnsmasq-dhcp: DHCPOFFER(p1) 192.168.47.150 aa:a0:9d:00:5b:d6
  dnsmasq-dhcp: DHCPREQUEST(p1) 192.168.47.150 aa:a0:9d:00:5b:d6
  dnsmasq-dhcp: DHCPACK(p1) 192.168.47.150 aa:a0:9d:00:5b:d6 j-dnsmasq-2042587
  ###
  IP = 192.168.47.150
  ###

  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

  With the affected dnsmasq package, we will see an error:
  dnsmasq-dhcp: DHCPREQUEST(p1) 192.168.47.150 aa:a0:9d:00:5b:d6
  dnsmasq-dhcp: DHCPACK(p1) 192.168.47.150 aa:a0:9d:00:5b:d6 j-dnsmasq-2042587
  ###
  IP = 192.168.47.9
  TEST FAILED
  ###

  The error is that the obtained IP is that of the dhcp relay (provided
  via the -g option).

  With the fixed dnsmasq package, "TEST FAILED" must not appear, and the
  IP should not be that of the provided dhcp relay.

  [ Where problems could occur ]

  If the fix is incorrect, it would mean the dhcp-script would get an incorrect 
IP again, or perhaps we could have crashes in dnsmasq when dealing with buffers 
and pointers if the dhcp-script option is in use.
  This fix was committed upstream a few months after the bug was introduced, so 
it took a while to be noticed.

  [ Other Info ]
  Not at this time.

  [ Original description ]

  When upgrading from focal to jammy, existing dnsmasq dhcp-scripts
  stopped working in an environment where a DHCP relay is in use.
  Instead of the expected client IP address, the script gets the _relay_
  IP address as an argument. From dnsmasq documentation for --dhcp-
  script:

  > The arguments to the process are "add", "old" or "del", the MAC
  address of the host (or DUID for IPv6) , the IP address, and the
  hostname, if known.

  I believe the change has been inadverently made in upstream commit
  527c3c7d0d3bb4bf5fad699f10cf0d1a45a54692
  
(https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blobdiff;f=src/helper.c;h=02340a01c00031db0cc682c8a4a279cfc1db574e;hp=d81de9622e6d484a264496b2cd3638b4e15e9677;hb=527c3c7d0d3bb4bf5fad699f10cf0d1a45a54692;hpb=fcb4dcaf7cc8a86ac2533b933161b6455f75bf8f)
  as the commit message only speaks about inet_ntoa replacement and not
  the behavioral change it also introduces (previously the relay address
  was only set to the environment variable, now it effectively overrides
  the prevoiusly set client's IP address).

  dnsmasq 2.86-1.1ubuntu0.3 / Ubuntu 22.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dnsmasq/+bug/2042587/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packag