Send dhcp-users mailing list submissions to dhcp-users@lists.isc.org
To subscribe or unsubscribe via the World Wide Web, visit https://lists.isc.org/mailman/listinfo/dhcp-users or, via email, send a message with subject or body 'help' to dhcp-users-requ...@lists.isc.org You can reach the person managing the list at dhcp-users-ow...@lists.isc.org When replying, please edit your Subject line so it is more specific than "Re: Contents of dhcp-users digest..." Today's Topics: 1. Re: Requesting a ipv6 prefix delegation via a conf file (VTwin Farriers) ---------------------------------------------------------------------- Message: 1 Date: Wed, 22 Dec 2021 08:06:51 -0500 (EST) From: VTwin Farriers <vt...@cox.net> To: dhcp-users@lists.isc.org Subject: Re: Requesting a ipv6 prefix delegation via a conf file Message-ID: <488243290.2635325.1640178412...@myemail.cox.net> Content-Type: text/plain; charset="utf-8" Glenn Satchell <glenn.satch...@uniq.com.au> writes: > Have you tried 'send dhcp6.ia-prefix 60'. Yeah, I do not feel the love :) I have reviewed the source code in client/client.c and client/dhc6.c only reference to prefix_len_hint is (in dhclient.c, please excuse the crappy code formatting) [...] int prefix_len_hint = 0; [...] } else if (!strcmp(argv[i], "--prefix-len-hint")) { if (++i == argc) { usage(use_noarg, argv[i-1]); } errno = 0; prefix_len_hint = (int)strtol(argv[i], &s, 10); if (errno || (*s != '\0') || (prefix_len_hint < 0)) { usage("Invalid value for --prefix-len-hint: %s", argv[i]); } This is in the section of code where the command-line options are interpreted. There is an additional reference in dhc6.c, where the option is used: extern int prefix_len_hint; [...] dhc6_bare_ia_xx(struct client_state *client, struct data_string *packet, int wanted, u_int16_t ia_type) { [...] /* figure out what type of option we are working with */ switch (ia_type) { case D6O_IA_NA: type_string = "IA_NA"; type_option = ia_na_option; len = IA_NA_OFFSET; break; case D6O_IA_TA: type_string = "IA_TA"; type_option = ia_ta_option; len = IA_TA_OFFSET; break; case D6O_IA_PD: type_string = "IA_PD"; type_option = ia_pd_option; len = IA_PD_OFFSET; if (prefix_len_hint > 0) { len += IASUBOPT_PD_LEN; } break; default: return (ISC_R_FAILURE); } [...] if (ia_type == D6O_IA_PD && prefix_len_hint > 0) { unsigned char *ptr = ia.buffer->data + IA_NA_OFFSET; putUShort(ptr, D6O_IAPREFIX); ptr += 2; putUShort(ptr, IASUBOPT_PD_LEN); ptr += 2; putUChar(ptr + IASUBOPT_PD_PREFLEN_OFFSET, prefix_len_hint); log_debug("XMT: | | X-- Request prefix ::/%u.", prefix_len_hint); } I did a quick recursive grep of every .c file in the source code find ./ -name *.c -exec echo searching file {} \; -exec grep prefix_len_hint {} \; and these are the only two places which reference that variable, so it isn't modified elsewhere by a subroutine in another library. Your proposed hack seems to be the only solution, since it appears development on this software has pretty much ceased (4.4.2's tarballs were dated 2020 and 4.4.2-P1 contained only a security patch. If anyone who does development work on this product is monitoring the mailing list, adding an option to the configuration file, e.g. request dhcp6.prefix-length 60 would be most helpful to people who have to provide a hint, use NetworkManager in their distribution, and do not want to have to implement/maintain a hack which could potentially break future updates (centos 8, for example, includes 4.3.6 of the dhclient by default). Based on your suggestion I implemented this script, and attempted to keep it a bit in line w/ Centos-isms (e.g. configuration stuff in /etc/sysconfig). #! /bin/sh . /etc/sysconfig/dhclient6 ADDL_OPTIONS="" if [[ "$@" == *"-6"* && "$@" == *"-P"* ]]; then ADDL_OPTIONS="--prefix-len-hint $PREFIX_LEN_HINT" fi exec /sbin/dhclient.exe $ADDL_OPTIONS $@ so I will only append the prefix length hint command-line parameter if I see this is a dhcpv6 invocation and prefix length delegation is enabled. the hint variable is in /etc/sysconfig/dhclient6: PREFIX_LEN_HINT=60 This is of course less than ideal, since dhclient could require different additional options depending on the interface in question, but without getting into complex scripting to parse the command-line options passed and determine which are switches, options, and names of interfaces (and then look for, say, a /etc/sysconfig/dhclient6-interfacename.conf file for interface-specific options, it will have to do. Thanks for your suggestion, I think it is the only option I have at the moment. -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20211222/cfdfa120/attachment-0001.htm> ------------------------------ Subject: Digest Footer _______________________________________________ ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information. dhcp-users mailing list dhcp-users@lists.isc.org https://lists.isc.org/mailman/listinfo/dhcp-users ------------------------------ End of dhcp-users Digest, Vol 158, Issue 8 ******************************************