Sources under BSD licenceReturn to Sources under BSD licence home page
Prefix delegation preference patch for ISC-DHCP IPv6 client (DHCPv6-PD)
My ISP recently began providing an IPv4/IPv6 dual stack for my residence. The default IPv6 address allocation consists of a /128 address for the Internet-facing network interface, and a /64 prefix delegation for the items on my household LAN.
The ISP provides the ability to request a /60 prefix delegation if I need to subnet my household LAN. In order to obtain the /60 prefix delegation, my DHCP client needs to send a request for the /60 prefix delegation (sometimes called a prefix delegation preference, PD preference, or PD hint).
RFC 3633, section 10: "...A requesting router may set the IPv6 prefix field to zero and a given value in the prefix-length field to indicate a preference for the size of the prefix to be delegated...."
This patch adds the ability for the ISC dhclient to indicate a preference for the size of the prefix to be delegated by adding a prefix delegation option to the dhclient's message to the DHCP server.
I added a command-line option to the dhclient program, -Pl (for Prefix length).
A dhclient command line excerpt might look similar to the following:
dhclient -6 -P -Pl 60 ...
which sends a request with a preference for a /60 prefix delegation to the DHCP server.
- ISC DHCP 4.3.0 distribution tar file with FreeBSD 10.0
- ISC DHCP 4.3.1 distribution tar file with FreeBSD 10.1
- ISC DHCP 4.3.2 distribution tar file with FreeBSD 10.1
- ISC DHCP 4.3.3 distribution tar file with FreeBSD 10.1, FreeBSD 10.2, OpenBSD 5.9-beta
- ISC DHCP 4.3.3P1 distribution tar file with FreeBSD 10.2, FreeBSD 10.3, OpenBSD 5.9
- ISC DHCP 4.3.4 distribution tar file with FreeBSD 10.3, OpenBSD 5.9, OpenBSD 6.0 beta
- ISC DHCP 4.3.5 distribution tar file with OpenBSD 5.9, OpenBSD 6.0, OpenBSD 6.1
- ISC DHCP 4.3.6 distribution tar file with OpenBSD 6.1, OpenBSD 6.2
This patch should work fine under other OS's, as I do not think the patch contains anything that is OS-specific.
I find that it is easiest to get the new PD preference when I have deleted the old IPv6 lease file, otherwise the prior unexpired lease apparently takes precedence and seems to interfere with the acquisition of the new PD preference lease. However, once the desired prefix length is delegated, then no further intervention is needed, i.e. the delegated prefix is renewed as appropriate.
To patch, the current working directory should be the parent directory of the includes and client directories. The following files are patched: includes/dchpd.h, client/dhc6.c and client/dhclient.c
Even though this patch has been working fine for me, I consider it a workaround until the day when this feature is added more properly to the source code base by the ISC.
This patch is offered to public domain "As-Is".
Download patch dhcl430-pdr_1-0 (2KB) for ISC DHCP 4.3.0
Download patch dhcl431-pdr_1-0 (2KB) for ISC DHCP 4.3.1
Download patch dhcl432-pdr_1-0 (2KB) for ISC DHCP 4.3.2
Please note that the dhcl432-pdr_1-0 patch is identical to the dhcl431-pdr_1-0 patch. The only difference is the change of the file name. The patch applies cleanly to the 4.3.2 source code, and visual auditing of the code indicates that there were no changes in 4.3.2 that would affect the performance of the 4.3.1 patch. The patch has been running fine on my host for two weeks, and has gone through a PD renewal process every two days without any problems.
Download patch dhcl433-pdr_1-0 (2KB) for ISC DHCP 4.3.3
The dhcl433-pdr_1-0 patch was created anew. While the earlier patches still applied OK to the 4.3.3 source code, the offset issues started to grow larger than I prefer. So I recreated the patch.
The dhcl433-pdr_1-0 patch was tested on the 4.3.3 Patch 1 source code, and it applies and has been running fine on my host.
Download patch dhcl434-pdr_1-0 (2KB) for ISC DHCP 4.3.4
The dhcl434-pdr_1-0 patch was created anew. The earlier patches had errors when applied to the 4.3.4 source code.
Download patch dhcl435-pdr_1-0 (2KB) for ISC DHCP 4.3.5
The dhcl435-pdr_1-0 patch is the prior patch (434) that was adjusted to handle an offset that was larger than I prefer.
Download patch dhcl436-pdr_1-0 (2KB) for ISC DHCP 4.3.6
The dhcl436-pdr_1-0 patch was created anew. The earlier patches had errors when applied to the 4.3.6 source code.
January 11, 2018:
As I write this, it appears that the ISC has released a beta version of DHCP 4.4.0, and that version 4.4.0 includes the ability to specify a PD preference ("hint"). So it seems my work here is done. :)
I'll leave this page available in case it is needed by anyone.
Many thanks for all the kind messages about this series of patches.
February 01, 2018
The release of the DHCP 4.4.0 occurred today. This comment will be my last comment on this page.
Once again, many thanks for all the kind messages about this series of patches.