dhcpcd-discuss

Re: Puzzled by DHCPv6 in many ways

Tobias Klausmann

Sat Jun 10 10:05:15 2017

Hi! 

On Fri, 09 Jun 2017, Tobias Klausmann wrote:
> But note how it never even tries to solicit a v6 address. I have
> searched high and low for a way to get dhcpcd to tell me *why* it
> doesn't even try, to no avail. Note that that it *used* to do so,
> but at some point it stopped. Deleting the fe80 address from the
> i/f, nuking the lease files and even the DUID file and secret did
> not help. 

I have started playing with the code and changed src/dhcpcd.c:879
as follows:

                if (!(ifo->options & DHCPCD_IPV6RS) ||
                    ifo->options & (DHCPCD_IA_FORCED | DHCPCD_INFORM6))
                {
                        ssize_t nolease;
                        loginfox("%s: rs/ia forced/inform", ifp->name);

added "|| true" --->    if (ifo->options & DHCPCD_IA_FORCED || true)
                                nolease = dhcp6_start(ifp, DH6S_INIT);
                        else if (ifo->options & DHCPCD_INFORM6)
                                nolease = dhcp6_start(ifp, DH6S_INFORM);
                        else {
                                nolease = 0;
                                loginfox("%s: nolease=0", ifp->name);
                                /* Enabling the below doesn't really make
                                 * sense as there is currently no standard
                                 * to push routes via DHCPv6.
                                 * (There is an expired working draft,
                                 * maybe abandoned?)
                                 * You can also get it to work by forcing
                                 * an IA as shown above. */
#if 0
                                /* With no RS or delegates we might
                                 * as well try and solicit a DHCPv6 address */
                                if (nolease == 0)
                                        nolease = dhcp6_start(ifp, DH6S_INIT);
#endif
                        }
                        if (nolease == -1)
                                logerr("%s: dhcp6_start", ifp->name);
                }

This results in this output:

dhcpcd-7.0.0-rc1 starting                                                        
wan1: executing `/lib/dhcpcd/dhcpcd-run-hooks' PREINIT                           
wan1: executing `/lib/dhcpcd/dhcpcd-run-hooks' CARRIER                           
DUID 00:01:00:01:20:cd:93:8a:00:0e:0c:72:4d:35                                   
wan1: IAID 0c:72:4d:35
wan1: reading lease `/var/lib/dhcpcd/wan1.lease6'
wan1: soliciting a DHCPv6 lease
wan1: delaying SOLICIT6 (xid 0xa5c0a4), next in 0.1 seconds
wan1: broadcasting SOLICIT6 (xid 0xa5c0a4), next in 0.9 seconds                  
wan1: broadcasting SOLICIT6 (xid 0xa5c0a4), next in 1.9 seconds                  
wan1: ADV 2a02:168:2000:2b:e60c:a28d:84fb:72fb/128 from fe80::523d:e5ff:fe16:55ff
wan1: broadcasting REQUEST6 (xid 0xa58371), next in 0.9 seconds                  
wan1: wrong xid 0xa5c0a4 (expecting 0xa58371) from fe80::523d:e5ff:fe16:55ff     
wan1: accepted reconfigure key                                                   
wan1: REPLY6 received from fe80::523d:e5ff:fe16:55ff
wan1: adding address 2a02:168:2000:2b:e60c:a28d:84fb:72fb/128
wan1: pltime 3600 seconds, vltime 86400 seconds
wan1: renew in 1200, rebind in 1800, expire in 86400 seconds
wan1: writing lease `/var/lib/dhcpcd/wan1.lease6'
wan1: waiting for DHCPv6 DAD to complete                                         
wan1: DHCPv6 DAD completed                                                       
wan1: executing `/lib/dhcpcd/dhcpcd-run-hooks' BOUND6
forking to background                                                            
forked to background, child pid 12103                                            

So the question is if there is a way to force the call to
dhcp6_start() *without* specifiying PD in the config file. That
latter option is the only way that I see I can usefully set
DHCPCD_IA_FORCED. AIUI, using DH6S_INFORM would mean that my host
*picks* an address and informs the DHCP server that it has done
so, which is not what I (or my ISP) want.


Ultimately, I will want PD, but that still has the
over-solicitation problem: even with denyinterfaces set, dhcpcd
immediately tries to solicit v4 leases as soon as I have a PD
like so:

interface wan1
	ipv6   # Should not be necessary, but ...
	ia_pd 2/48 lan1/1/64 wlan1/2/64

output:

wan1: waiting for carrier                                                        
wan1: carrier acquired                                                           
DUID 00:01:00:01:20:cd:93:8a:00:0e:0c:72:4d:35                                   
wan1: IAID 0c:72:4d:35
wan1: IAID 00:00:00:02
wan1: adding address fe80::20e:cff:fe72:4d35
wan1: rebinding lease of 185.72.66.139                                           
wan1: no useable IA found in lease                                               
wan1: soliciting a DHCPv6 lease                                                  
lan1: activating for delegation                                                  
lan1: carrier acquired                                                           
lan1: IAID 0c:72:4d:34                                                           
wlan1: activating for delegation                                                 
wlan1: carrier acquired                                                          
wlan1: IAID 11:e9:e4:c0                                                          
wlan1: soliciting a DHCP lease                                                   
wan1: carrier lost                                                               
wan1: deleting address fe80::20e:cff:fe72:4d35                                   
lan1: soliciting a DHCP lease                                                    
wan1: carrier acquired                                                           
wan1: IAID 0c:72:4d:35                                                           
wan1: IAID 00:00:00:02                                                           
wan1: adding address fe80::20e:cff:fe72:4d35
wan1: rebinding lease of 185.72.66.139                                           
wan1: probing address 185.72.66.139/25                                           
wan1: soliciting a DHCPv6 lease                                                  
wan1: ADV 2a02:168:9607::/48 from fe80::523d:e5ff:fe16:55ff                      
wan1: accepted reconfigure key                                                   
wan1: REPLY6 received from fe80::523d:e5ff:fe16:55ff
wan1: renew in 1200, rebind in 1800, expire in 86400 seconds
lo: adding reject route to 2a02:168:9607::/48
wan1: delegated prefix 2a02:168:9607::/48                                        
wlan1: adding address 2a02:168:9607:2::1/64                                      
wlan1: adding route to 2a02:168:9607:2::/64
lan1: adding address 2a02:168:9607:1::1/64                                       
lan1: adding route to 2a02:168:9607:1::/64                                       
forked to background, child pid 17977

Note: wlan1 and lan1 already have v4 addresses (statically, since
this machine is the DHCP server for these networks), and
soliciting addresses is not only useless but also installs a
default route back to the machine itself, wreaking havoc if wan1
is deconfigured.

Also note how this *still* doesn't get me a usable address for the
wan1 interface itself. I tried using ia_na, but that results in a
/128 and no default route. I hope not getting a /64 is just due
to the lease being stuck and that will be fixed in 30m.

Regards,
Tobias


-- 
Sent from aboard the Culture ship
	You May Not Be The Coolest Person Here

Follow-Ups:
Re: Puzzled by DHCPv6 in many waysTobias Klausmann
References:
Puzzled by DHCPv6 in many waysTobias Klausmann
Archive administrator: postmaster@marples.name