ipxe / ipxe

iPXE network bootloader
https://ipxe.org
Other
1.48k stars 642 forks source link

[ipv6] Expose router address for DHCPv6 leased addresses #1245

Closed mcb30 closed 3 months ago

mcb30 commented 3 months ago

The DHCPv6 protocol does not itself provide a router address or a prefix length. This information is instead obtained from the router advertisements.

Our IPv6 minirouting table construction logic will first construct an entry for each advertised prefix, and later update the entry to include an address assigned within that prefix via stateful DHCPv6 (if applicable).

This logic fails if the address assigned via stateful DHCPv6 does not fall within any of the advertised prefixes (e.g. if the network is configured to use DHCPv6-assigned /128 addresses with no advertised on-link prefixes). We will currently treat this situation as equivalent to having a manually assigned address with no corresponding router address or prefix length: the routing table entry will use the default /64 prefix length and will not include the router address.

DHCPv6 is triggered only in response to a router advertisement with the "Managed Address Configuration (M)" or "Other Configuration (O)" flags set, and a router address is therefore available at the point that we initiate DHCPv6.

Record the router address when initiating DHCPv6, and expose this router address as part of the DHCPv6 settings block. This allows the routing table entry for any address assigned via stateful DHCPv6 to correctly include the router address, even if the assigned address does not fall within an advertised prefix.

Also provide a fixed /128 prefix length as part of the DHCPv6 settings block. When an address assigned via stateful DHCPv6 does not fall within an advertised prefix, this will cause the routing table entry to have a /128 prefix length as expected. (When such an address does fall within an advertised prefix, it will continue to use the advertised prefix length.)

Fixes: ipxe/ipxe#449 Fixes: ipxe/ipxe#1141 Fixes: ipxe/ipxe#1163

Originally-fixed-by: Guvenc Gulce guevenc.guelce@sap.com