DHCPv6 & Duplicate Address Detection

Jiri Popelka jpopelka at redhat.com
Wed Feb 10 17:42:05 UTC 2010


Dear DHCP Workers,

RFC 3315 says:
The client SHOULD perform duplicate address detection [17] on each of
the addresses in any IAs it receives in the Reply message before
using that address for traffic.  If any of the addresses are found to
be in use on the link, the client sends a Decline message to the
server as described in section 18.1.7.

man 8 dhclient-script says:
Before actually configuring the address, dhclient-script should
somehow ARP for it and exit with a nonzero status if it receives a
reply.   In this case, the client will send a DHCPDECLINE message to
the server and acquire a different address.   This may also be done in
the RENEW, REBIND, or REBOOT states, but is not required, and indeed
may not be desirable.

AFAIK 'dhclient -4' works great.
In dhclient.c:bind_lease() there's:
     /* If the BOUND/RENEW code detects another machine using the
        offered address, it exits nonzero.  We need to send a
        DHCPDECLINE and toss the lease. */
     if (script_go (client)) {
         make_decline (client, client -> new);
         send_decline (client);
         destroy_client_lease (client -> new);
         client -> new = (struct client_lease *)0;
         state_init (client);
         return;
     }
After 'dhcpd -4' receives DHCPDECLINE, it calls dhcpdecline(), which 
calls abandon_lease().
Moreover 'dhcpd -4' pings (sends ICMP ECHO_REQUEST) the lease address 
before actually sending the offer.
So the duplicate address detection is usually not necessary on client 
side, because the server detects it before sending to client.

But I'm confused how 'dhclient/dhcpd -6' use DAD.
'dhcpd -6' looks like it knows how to handle DHCPV6_DECLINE.
There's dhcpv6.c:dhcpv6_decline() function, which declines lease when 
DHCPV6_DECLINE is received.
But I can't find where 'dhclient -6' actually sends DHCPV6_DECLINE.
Is there any reason why the script_go() return value is not checked in 
dhc6.c:start_bound() (like in the above mentioned code) ?
I'm missing something like:
if (script_go()) {
   do_decline6();
   dhc6_lease_destroy(lease, MDL);
}
in dhc6.c:start_bound().

Can somebody explain to me how to make 'dhclient -6' send DHCPV6_DECLINE
when duplicate address is detected in dhclient-script (that's how 
'dhclient -4' works) or
how the 'dhclient/dhcpd -6' actually use DAD ?

Thanks,

Jiri



More information about the dhcp-workers mailing list