Commit Graph

75 Commits

Author SHA1 Message Date
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
b826c088b7 Remove notion of hoplimit from DHCPv6 2014-03-12 15:39:53 +00:00
Roy Marples
32a8030a00 Whitespace 2014-03-11 23:00:14 +00:00
Roy Marples
4f422dd3bc A router with a lifetime of zero is no longer a default router.
However, the options it passes do have lifetimes which we should still
respect according to RFC4861 section 4.2.
2014-03-07 13:01:20 +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
dad4eeb21a No need for this code when we can reliably work with IPv6 RTM_DELADDR messages 2014-03-04 17:13:40 +00:00
Roy Marples
98d7a13dfa When deleting IPv6 addresses, remove them from our internal address state
as well so we perform DAD when rebinding.
Remove debug added with prior commit.
2014-03-03 13:56:49 +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
91bf55879b Correctly delete IPv6 addresses from eloop timeouts 2014-03-01 17:59:33 +00:00
Roy Marples
bb0f6a5e58 Log why we cannot delete a route 2014-02-13 13:07:44 +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
a144b30772 Changed these files in 2014. 2014-02-04 14:55:04 +00:00
Roy Marples
a9d78def54 Remove DEBUG_MEMORY guard and always free memory and resources.
Remove all atexit(3) and exit(3) calls, instead exiting via the eloop.
2014-02-04 14:39:26 +00:00
Roy Marples
5e2809cafc Detect IPv6 address flags at interface discovery on Linux. 2014-01-19 22:35:52 +00:00
Roy Marples
eea72a8a97 Don't bother managing a /128 prefix. 2013-09-07 11:13:05 +00:00
Roy Marples
3c3875bfa6 No need to know the ra for the route. 2013-09-03 15:17:19 +00:00
Roy Marples
15fc1181d5 Fix the persistent option. 2013-08-25 10:22:48 +00:00
Roy Marples
e82129a42c Reduce code size by merging IPv6 ND with RS. 2013-08-20 10:29:43 +00:00
Roy Marples
3566eb3cb5 Fix dhcpcd owning the RA if the kernel has disabled RA but there
is no directive in dhcpcd.conf
2013-07-01 19:23:19 +00:00
Roy Marples
af63ad90d6 When adding or changing routes, always supply IFP and IFA so we match
kernel messages 100%.
Restore purging kernel IPv6 routers.
2013-06-19 09:36:52 +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
184110c1f5 Fix def 2013-06-10 09:10:18 +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
4955946314 Don't delete the subnet route if we don't own IPv6RA routes. 2013-06-09 10:57:16 +00:00
Roy Marples
f3b4f2d63c Only run LL callbacks from LL addresses 2013-06-09 10:04:46 +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
91c74bf8b4 Fix IPv6 DAD test 2013-05-31 15:15:28 +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
452cf01497 Fix compile on Linux. 2013-05-31 14:24:46 +00:00
Roy Marples
be2aae010d Use PRIu32 instead of %d or %u 2013-05-31 14:14:52 +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
28bae8ce39 Fix DAD for delegated addresses. 2013-05-29 12:59:47 +00:00
Roy Marples
d2aef5a270 Optimise adding and changing ipv6 routes. 2013-05-24 08:06:57 +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
5b428df2a1 Handle an interface coming and going better with a tailq list.
Ensure we check correct options when building ipv6 routes.
2013-05-22 22:55:36 +00:00
Roy Marples
c8b9dd2dc4 Remove unreachable routers on Linux unless all routers are unreachable.
This is due to route metrics.
2013-05-22 08:11:13 +00:00
Roy Marples
0d0c5f6670 Remove more headers 2013-05-21 16:05:36 +00:00
Roy Marples
99d2575328 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.
2013-05-21 09:24:49 +00:00
Roy Marples
e5b9d60281 Use macros instead of memcmp 2013-05-18 15:37:27 +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
d914e23f55 Fix compile on Linux 2013-05-16 10:54:20 +00:00
Roy Marples
893406ef0a Fix compile on FreeBSD 2013-05-16 10:48:03 +00:00