opnsense / core

OPNsense GUI, API and systems backend
https://opnsense.org/
BSD 2-Clause "Simplified" License
3.27k stars 727 forks source link

Incorrect DUID displayed on DHCP6 Leases Page, adding static reservation does not work #4591

Closed user-0209 closed 3 years ago

user-0209 commented 3 years ago

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug

For certain hosts (maybe 1 of 20) the DUID displayed on the Leases page is wrong like here: displayed: b6:00:04:36:65:b3:3b:62:ec:3b:d6:d9:fe:d0:4f:dc:b6:b5:8d should be: 00:04:36:65:b3:3b:62:ec:3b:d6:d9:fe:d0:4f:dc:b6:b5:8d After correcting the DUID in the reservation, the client will pick up the defined address.

Wireshark: DHCPv6 185 Request XID: 0x7119d5 IAA: ####:####:####:38ca::2000 CID: 00043665b33b62ec3bd6d9fed04fdcb6b58d

It also happened for another host with type 2 DUID: displayed: 03:00:02:00:00:ab:11:a2:e0:f6:17:97:76:49:16 should be: 00:02:00:00:ab:11:a2:e0:f6:17:97:76:49:16

To Reproduce

  1. Enable DHCP6 on an interface
  2. Set default Lease time to 120 and Max lease time to 180
  3. Power on a host (in this case Ubuntu Desktop 20.04.1 using NetworkManager)
  4. Let it acquire an IPv6 address from the DHCP server (watch by repeatedly typing ip addr)
  5. When address was aquired, find the lease in the OpnSense Leases page
  6. Click the + button to define a reservation with some IPv6 address under the prefix
  7. On the host watch the DHCP traffic with: sudo tshark -i $ifc -f "(port 546 or port 547) and (ether src $mac or ether dst $mac)"
  8. Wait 2-3 minutes, but the address will not change, instead for address acquired previously will be renewed
  9. Go back to the reservation and correct the DUID according to the wireshark dump
  10. After lease expired (maybe twice), address as specified in the reservation will be picked up

Expected behavior

  1. The correct DUID shall be displayed in the Leases page
  2. When clicking the + button, the correct DUID shall be preset in the reservation (static mapping) form

Screenshots

Relevant log files none

Additional context

I want to stress, that implementing DHCPv6 becomes a daunting exercise, because it happens only with some hosts. However, once it happens, behaviour is very stable. I tried for 2 days all kinds of configurations on Ubuntu side without any change to the described behaviour.

I also feel, it is related to https://github.com/opnsense/core/issues/4423, although I found only the first byte wrong. What took me in the right direction was this one: https://redmine.pfsense.org/issues/2511

Environment

OPNsense 20.7.7_1-amd64 Intel(R) Core(TM) i3-4010U CPU @ 1.70GHz (4 cores)

fichtner commented 3 years ago

Would you mind posting an entry of /var/dhcpd/var/db/dhcpd6.leases that shows a wrong DUID? I don't have any such entries in mine.

Cheers, Franco

user-0209 commented 3 years ago

Would you mind posting an entry of /var/dhcpd/var/db/dhcpd6.leases that shows a wrong DUID? I don't have any such entries in mine.

Cheers, Franco

Here it is. I have removed the prefix from the address. I can confirm that this behaviour is stable on this particular machine, even if I reinstalled the OS. Maybe the second " is the culprit? Hope this helps. Don't hesitate to come back, if not. Rgds, Ronald

ia-na "\353\017\"\266\000\004\243\347\200\011\232R#\244\377\177\220\242ir\303\221" {
  cltt 4 2021/01/14 11:43:16;
  iaaddr xxxx:xxxx:xxxx:xxxx::1180 {
    binding state active;
    preferred-life 375;
    max-life 600;
    ends 4 2021/01/14 11:53:16;
  }
}
fichtner commented 3 years ago

going to #4423 in this case