Closed mikaabra closed 5 years ago
I wrote some implementation guidance, if that might help. My intention is for me (or someone else) to submit a pull request for this (start working on that in the next few weeks), and this was my text to the person who would create the patch. It gives some background and implementation guidance. Any feedback on this appreciated.
The feature request consists of three parts, described here (in addition to what's already in the above request):
Background:
In DHCPv6 "stateful addressing" there are two main types of addresses that can be requested. They are:
IA_NA (Internet Address - Network Address). This is a single address, very similar to what is done in DHCPv4 IA_PD (Internet Address - Prefix Delegation). This is a block of addresses, a prefix. This means a block of addresses will be routed to the client.
By default in odhcpd in OpenWrt 15 and (LEDE) 17, both of these are supported, at the same time. If the client asks for both, it will get one of each. This is not configurable and it's always on when odhcpd is running on an interface.
Now, we want to support using only IA_PD and not support IA_NA, so we need to make resource type handout configurable. This means the feature request consists of multiple things:
The changes needed are to implement the new configuration option(s) in [[https://github.com/openwrt/odhcpd/blob/master/src/config.c]] Then the variable chosen needs to be checked in [[https://github.com/openwrt/odhcpd/blob/master/src/dhcpv6-ia.c]] at some place, either whilst parsing the options or when considering to hand out the options. The options in question are The proper response to a IA_NA question with you're configured to not hand out IA_NA is to omit the option in the response, same with IA_PD. Possible implementation method could be to just ignore the NA/PD options during parsing if configured to not support them.
After interacting with some DHCPv6 experts they pointed to RFC3633 which has the following text:
If the delegating router will not assign any prefixes to any IA_PDs in a subsequent Request from the requesting router, the delegating router MUST send an Advertise message to the requesting router that includes the IA_PD with no prefixes in the IA_PD and a Status Code option in the IA_PD containing status code NoPrefixAvail and a status message for the user, a Server Identifier option with the delegating router's DUID and a Client Identifier option with the requesting router's DUID.
So it would be a perfectly valid approach to implement this in the "find free prefix/address" code part and just return the same way you could if there are no free prefix/addresses to be had (NoAddrsAvail and NoPrefixAvail) respectively, when the odhcpd is configured to not provide NA/PD respectively.
I would like to support IA_PD behind the router, but not IA_NA (and also not IA_TA either). Currently IA_NA and IA_PD seems to be conflated, but this could be fixed with a new configuration option (text below as example):
If I set RA_management to 0, if the client still asks for DHCPv6 IA_NA or PD, it's handed out. This option would also enable possibility of actually turning selected functionality off completely.