Package: wide-dhcpv6-client Version: 20080615-21 Severity: wishlist Tags: patch, ipv6
Please find attached a patch that adds a new feature to wide-dhcpv6-client, namely an option ("ifid-random") in the prefix-interface section of dhcp6c.conf to generate a random interface id on startup. This is useful if you wish to have the final 64 bits of your IPv6 address change from time to time - a sort of very rough equivalent of IPv6 Privacy Extensions. If you do not add "ifid-random" to the config file, then nothing about the client's current behaviour changes. Note that if your prefix-interface section has both the current "ifid X" option (where X is whatever number you want to manually assign as your interface id) and the new "ifid-random" option, then the interface id is randomized and "ifid X" is ignored. Thanks, Christopher Martin
--- a/cfparse.y +++ b/cfparse.y @@ -104,7 +104,7 @@ %token INTERFACE IFNAME %token PROFILE PROFILENAME -%token PREFIX_INTERFACE SLA_ID SLA_LEN IFID DUID_ID +%token PREFIX_INTERFACE SLA_ID SLA_LEN IFID IFID_RAND DUID_ID %token ID_ASSOC IA_PD IAID IA_NA %token ADDRESS %token REQUEST SEND ALLOW PREFERENCE @@ -1064,6 +1064,13 @@ l->num = (u_int64_t)$2; $$ = l; } + | IFID_RAND EOS + { + struct cf_list *l; + + MAKE_CFLIST(l, IFPARAM_IFID_RAND, NULL, NULL); + $$ = l; + } ; ianaconf_list: --- a/cftoken.l +++ b/cftoken.l @@ -244,6 +244,7 @@ <S_CNF>sla-id { DECHO; return (SLA_ID); } <S_CNF>sla-len { DECHO; return (SLA_LEN); } <S_CNF>ifid { DECHO; return (IFID); } +<S_CNF>ifid-random { DECHO; return (IFID_RAND); } /* duration */ <S_CNF>infinity { DECHO; return (INFINITY); } --- a/config.c +++ b/config.c @@ -521,6 +521,15 @@ } break; case IFPARAM_IFID: + if (use_default_ifid) { + for (i = sizeof(pif->ifid) - 1; i >= 0; i--) + pif->ifid[i] = (cfl->num >> 8*(sizeof(pif->ifid) - 1 - i)) & 0xff; + use_default_ifid = 0; + } + break; + case IFPARAM_IFID_RAND: + for (i = 0; i < pif->ifid_len ; i++) + cfl->num = cfl->num*2 + rand()%2; for (i = sizeof(pif->ifid) -1; i >= 0; i--) pif->ifid[i] = (cfl->num >> 8*(sizeof(pif->ifid) - 1 - i)) & 0xff; use_default_ifid = 0; --- a/config.h +++ b/config.h @@ -266,7 +266,7 @@ DECL_PREFIX, DECL_PREFERENCE, DECL_SCRIPT, DECL_DELAYEDKEY, DECL_ADDRESS, DECL_RANGE, DECL_ADDRESSPOOL, - IFPARAM_SLA_ID, IFPARAM_SLA_LEN, IFPARAM_IFID, + IFPARAM_SLA_ID, IFPARAM_SLA_LEN, IFPARAM_IFID, IFPARAM_IFID_RAND, DHCPOPT_RAPID_COMMIT, DHCPOPT_AUTHINFO, DHCPOPT_DNS, DHCPOPT_DNSNAME, DHCPOPT_IA_PD, DHCPOPT_IA_NA, DHCPOPT_NTP, --- a/dhcp6c.conf.5 +++ b/dhcp6c.conf.5 @@ -453,6 +453,15 @@ prefix and the sla-id to form a complete interface address. The default is to use the EUI-64 address of the .Ar interface . +.It Xo +.Ic ifid-random ; +.Xc +This statement instructs the client to generate a completely random +interface id. This will override the +.Ic ifid +statement, if present. The resulting random interface id will be combined +with the delegated prefix and the sla-id to form a complete interface +address. .El .El .\"