Commit Graph

42 Commits

Author SHA1 Message Date
Roy Marples
1a7ff10050 Move net.c to if.c.
Ensure that if.c and if-KERNEL.c are namespaced correctly.
2014-04-25 10:42:37 +00:00
Roy Marples
34457fe661 Add -Wconversion to debug CFLAGS and fix fallout. 2014-03-27 22:14:52 +00:00
Roy Marples
94a79cea05 If not specified, Delegated Prefixes will get an automatic SLA of the
interface index. If the biggest SLA and the assigned prefix fits into a /64
then dhcpcd creates a /64 prefix so that SLAAC works. If bigger than /64
is needed then dhcpcd creates one rounded upto the nearest multiple of 8.

Unless a configured SLA of 0 is assigned, a reject route for the Delegated
Prefix is installed to stop unassigned addresses trying to be resolved upstream.

Addresses added from Delegated Prefixes now have a default address suffix of 1
instead of using a SLAAC style address.
2014-03-22 19:55:29 +00:00
Roy Marples
cda2f2a9c8 Add a reject route for the delegated prefix so that unassigned prefixes don't go back upstream. 2014-03-20 16:36:03 +00:00
Roy Marples
cc43133914 Set hoplimit by IPV6_MULTICAST_HOPS intead of each time we send. 2014-03-12 15:59:19 +00:00
Roy Marples
c12837916b Clarify hop limit 2014-03-12 00:50:02 +00:00
Roy Marples
7529fdf1af Tentative does not mean RTM_DELADDR.
This fixes RTM address handling on FreeBSD and OpenBSD.

Instead of listening for duplicate address messages for
FreeBSD and OpenBSD simply poll for the address flag changing.
This means less code to maintain and hopefully less error-prone.

Remove dead code which send a DAD as this is, and should,
be done entirely in the kernel.
2014-03-06 19:11:55 +00:00
Roy Marples
c8b42ae14d Compile and work on OpenBSD.
However, there is a problem deleting both IPv4 and IPv6 subnet routes.
Also, there is a problem opening a BPF fd in non blocking mode directly and
posix_spawn(3) fails to work so we block that in configure.
2014-03-05 18:11:22 +00:00
Roy Marples
4145d2b68a Expire DHCP lease and then run no carrier as a seperate operation.
Instead of waiting the maximum amount of time to report DAD failure/completion, poll the address flags periodically.
2014-03-03 12:10:58 +00:00
Roy Marples
0d033d1791 Fix FreeBSD compile warnings. 2014-02-13 13:23:43 +00:00
Roy Marples
298c01136e Fix compile without INET or INET6. 2014-02-13 08:15:05 +00:00
Roy Marples
4eb7b4896f Move all global variables into contexts, with a small exception for
signal handling.
This allows dhcpcd to work better in a threaded environment such as rtems.
2014-02-12 00:39:46 +00:00
Roy Marples
0acfc5e3b8 Move the kernel reporting DAD warning to ipv6nd.c to avoid compile spam 2013-11-08 09:37:44 +00:00
Roy Marples
3c3875bfa6 No need to know the ra for the route. 2013-09-03 15:17:19 +00:00
Roy Marples
5b0fe196ae Fix compile
Don't warn about BSD kernels not reporting DAD if not building IPv6
2013-08-20 10:36:49 +00:00
Roy Marples
8fdedf593b Ensure we have the correct type to send in our saved lease as the
user could change from IA_PD to IA_NA.
Re-send INFORM_REQUEST at each ROUTERADVERT.
Save some code by sharing the drop addrs loop.
2013-06-12 10:58:28 +00:00
Roy Marples
1f4c1525a5 Purge prefix list and routers at start of IPv6 for BSD.
Remove link_addr compact function as we now had a LL address list.
Fix INET and INET6 seperate compiles.
2013-06-10 00:56:54 +00:00
Roy Marples
d5690e937b Because not all OS's send RTM_NEWADDR for a refreshed RA we need
to manage a list of all IPv6 addresses on an interface so that we
can know if we need to wait for DAD to complete or not.
2013-06-09 07:31:08 +00:00
Roy Marples
e619948557 Keep state of delegated addresses
Handle RTM_NEWADDR messages a little better
Delete addresses with pltime of 0
2013-06-04 13:39:02 +00:00
Roy Marples
2bf02a2b0b Don't assume the kernel will remove or mark tentative LL addresses.
This isn't a problem as we listen to IPv6 address changes.
2013-06-03 06:49:34 +00:00
Roy Marples
22ea2b0deb Automate the assignment of SLA ids if not given for Prefix Delegation.
This means you can just request an ia_pd and let dhcpcd do the rest :)
2013-06-02 09:51:30 +00:00
Roy Marples
367f7b11b4 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
2013-06-01 21:30:18 +00:00
Roy Marples
d128d95214 Build BOUND routes before DELEGATED ones.
Use const a little more.
2013-05-31 15:01:27 +00:00
Roy Marples
373aadbd01 Use ND6_INFINITE_LIFETIME instead of ~0U
If we have an infinite lease, don't check expiry time when CONFIRMing
2013-05-31 13:40:46 +00:00
Roy Marples
46b8a6b7ae 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.
2013-05-31 13:01:54 +00:00
Roy Marples
0e906716c5 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.
2013-05-30 12:07:25 +00:00
Roy Marples
c5d2e393a5 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.
2013-05-30 05:38:21 +00:00
Roy Marples
ad574a9113 Only spam syslog if something new or unexpected happens, don't spam
it if we just maintain the status quo.
2013-05-23 21:50:34 +00:00
Roy Marples
0d0c5f6670 Remove more headers 2013-05-21 16:05:36 +00:00
Roy Marples
5331b839c9 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.
2013-05-17 23:09:36 +00:00
Roy Marples
22f64b5574 Set scope_id correctly. 2013-05-16 16:29:54 +00:00
Roy Marples
5fe587be91 Test BSD kernels for a specific version so we can listen to either
RTM_NEWADDR for duplicates, or directly on the wire with a maximum
timeout.

Warn about this noisily as there is no reason why the kernel cannot be
easily patched to support this.
2013-05-16 14:28:42 +00:00
Roy Marples
d8194bcd39 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.
2013-05-16 10:31:21 +00:00
Roy Marples
a8df1b28fb 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.
2013-05-15 10:27:36 +00:00
Roy Marples
66fd5d67f0 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.
2013-05-03 12:11:49 +00:00
Roy Marples
8cc47ba26d White space police 2013-04-04 20:31:04 +00:00
Roy Marples
00ababe4a0 Add DHCPv6 Prefix Delegation support, RFC3633.
Add DHCPv6 Temporary Address support, RFC3315.
2013-04-01 12:15:47 +00:00
Roy Marples
aae24feb3d It's now possible to compile out IPv4 and IPv6 support by passing
--disable-ipv4 or --disable-ipv6 to configure.
2013-02-04 13:30:35 +00:00
Roy Marples
cd3612e5ca Respect the ONLINK flag the prefix option of the RA 2012-12-11 09:00:49 +00:00
Roy Marples
c2e168a8c1 Set %interface for exported IPv6 link local addresses. 2012-11-24 20:11:49 +00:00
Roy Marples
e54dee19ba Implement the core DHCPv6 client for SOLICIT, REQUEST, RENEW, CONFIRM. 2012-11-06 23:40:15 +00:00
Roy Marples
eebe9a1887 Improve IPv6 RA support by allowing dhcpcd to manage the address and routes
instead of the kernel. dhcpcd will only do this if RA is disabled in the kernel
or dhcpcd has been instructed to do this via dhcpcd.conf(5) ipv6ra_own and
ipv6ra_own_default directives.

Send and process IPv6 Neighbor Solicitions and Adverts to prove router
reachability. If a router cannot be reached in this way then it is expired.

When debugging, all ND messages are displayed which will create a lot of log
spam.

To ease packaging, ./configure now accepts LDFLAGS and --enable-static.
2012-07-05 16:37:41 +00:00