Roy Marples [Sat, 1 Jun 2013 21:30:18 +0000 (21:30 +0000)]
Refactor Prefix Delegation configuration so we use integers instead
of hex based arrays.
The SLA can now be applied to any router given prefix length provided the
SLA can fit into the prefix and desired prefix length.
We now wait for a carrier and LL address before adding the addresses from the
delegated prefix. Before adding this code, I added some code to generate a
LL address from the hardware address. This is now #ifdef'ed out as I don't
want to throw it away in-case dhcpcd ever needs to create LL addresses
itself.
Many thanks to Martin Husemann who developed code for these functions:
ipv6_userprefix, in6_to_h64 and h64_to_in6
which are used to generate a prefix from the delegated prefix and the SLA
Roy Marples [Fri, 31 May 2013 13:01:54 +0000 (13:01 +0000)]
Remove hardcoded IPv6 address flags and use a bitmask instead.
Only add delegated addresses once for each delegation.
When the kernel expires them we will see this via RTM_DELADDR and
remove the address from our list and thus the route.
Roy Marples [Fri, 31 May 2013 11:53:10 +0000 (11:53 +0000)]
Allow options with zero data, for example Accept Reconf (20).
Assume if no status option is present it is OK.
Based on an initial patch by pmarks@google.com
Roy Marples [Thu, 30 May 2013 22:39:17 +0000 (22:39 +0000)]
In the event DHCPv6 is started without IPv6RS, we should wait for
a LL address to appear.
Also, use DH6S_INIT or DH6S_INFORM to dhcp6_start instead of 0 or
1 for clarity.
Roy Marples [Thu, 30 May 2013 21:01:48 +0000 (21:01 +0000)]
On Linux, PPP interfaces do not have a hardware address, so
get the ifindex via if_nametoindex(3).
Also, don't record an error restoring kernel RA settings for
a removed interface.
Thanks to Sergey Fionov.
Roy Marples [Thu, 30 May 2013 12:07:25 +0000 (12:07 +0000)]
It's possible to receive an RA for an interface that has not yet
obtained a local link address to send an RS.
If this happens, we should process the RA.
Roy Marples [Thu, 30 May 2013 05:38:21 +0000 (05:38 +0000)]
Move SIOCGIFAFLAG_IN6 into if-bsd as in6_addr_flags
Add pfx_flush to flush ND6 entries when changing routes.
Both these functions only work for BSD, just stubs on Linux.
This tidies the code a little and fixes changing IPv6 routes on BSD,
although the kernel may complain network is down for a few moments.
Roy Marples [Thu, 23 May 2013 09:55:52 +0000 (09:55 +0000)]
FreeBSD isn't buggy with adding new addresses and working out
if they are new and should be tentative - it was my buggy configuraion
when I upgraded from FreeBSD 8 -> 9.
Roy Marples [Tue, 21 May 2013 09:24:49 +0000 (09:24 +0000)]
Don't actually remove unreachable routers and prefixes from the routing table.
Instead we just change the interface if they are reachable via another one.
Roy Marples [Fri, 17 May 2013 23:09:36 +0000 (23:09 +0000)]
Store IPv6 link local addresses per interface.
Listen to kernel messages to account them.
If we don't have a local link address, delay IPv6RS as it just
won#t work until we have a local link address.
Roy Marples [Thu, 16 May 2013 10:31:21 +0000 (10:31 +0000)]
Check address flags for tentative and duplicates bits for sanity.
Handle the actual trigger to callout dhcpcd-run-hooks in the DAD callback
instead of on receipt of RTM_NEWADDR directly. This is more code, but it allows
us to use our own DAD engine if we need to.
Roy Marples [Wed, 15 May 2013 10:27:36 +0000 (10:27 +0000)]
Use the kernel DAD for IPv6 addresses and finish the action once each
address DAD completes. BSD kernels will require a patch as noted within
the README. The linux netlink part still needs to be written.
Roy Marples [Fri, 3 May 2013 12:11:49 +0000 (12:11 +0000)]
Add IPv6 DAD detection.
Sadly, it seems that userland cannot send from the unspecified address.
This means that for RFC conformancy, we have to rely on the kernel
performing DAD.