Commit Graph

101 Commits

Author SHA1 Message Date
Roy Marples
c7c1e4112a Don't hold onto an AF_INET socket for the duration of the program,
open and close it as required.
2014-02-07 11:03:39 +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
7d766720b4 Move vimaster checks to if-bsd.c
Make a note to try and support similar on Linux.
2014-01-21 16:27:47 +00:00
Roy Marples
f1c455dfbc Avoid pointer gymnastics.
Thanks to Christos Zoulas.
2013-11-14 10:29:14 +00:00
Roy Marples
27f61373d1 It seems that FreeBSD will send RTM_DELADDR + RTM_NEWADDR when
replacing an existing IPv4 address with the same values.
As such, we need to maintain a list of configured IPv4 addresses
for each interface so we know when to add it and when to skip it
to avoid receiving bogus RTM_DELADDR messages from ourself.
2013-09-06 09:38:24 +00:00
Roy Marples
13cfb3a611 Ignore all messages raised by dhcpcd. 2013-09-06 09:38:23 +00:00
Roy Marples
ecf297d6c7 Detect link address changes on Linux.
Only NetBSD emits RTM_CHGADDR for link address changes.
Sadly no other BSD emits anything for link address changes so we have
to do a full discovery on carrier up.

When a link address does change, simply carry on as we are, no need
to drop any existing lease as the carrier change will do that for us.
2013-06-25 08:31:11 +00:00
Roy Marples
bc349b8185 Add a route from the IPv4 address to the loopback address.
This allows for machine-internal communications to this address
can use the large loopback mtu.
2013-06-19 16:02: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
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
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
c2ae21d761 Fix compile on FreeBSD 2013-06-02 10:51:20 +00:00
Roy Marples
e59ebd3610 Fix an alignment error. 2013-05-31 15:18:52 +00:00
Roy Marples
fefc5353f3 Use LINK_UP/DOWN instead of magic numbers 2013-05-30 07:51:02 +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
873c6af120 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.
2013-05-23 09:55:52 +00:00
Roy Marples
4c80d49c44 Fix compile on FreeBSD
Document why we don't set IN6_IFF_TENTATIVE when adding addresses
and a possible error on FreeBSD.
2013-05-22 18:16:32 +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
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
3491ea4d56 Change from _unused to __unused to match NetBSD cdefs and avoid
a compiler failure on linux-headers-3.7
2013-04-24 09:38:18 +00:00
Roy Marples
8cc47ba26d White space police 2013-04-04 20:31:04 +00:00
Roy Marples
673e81e5b7 White space brigade 2013-04-02 07:01:11 +00:00
Roy Marples
7dab081fbe Add the noalias directive to so that when adding an IPv4 addresss
dhcpcd will overwrite a pre-existing address.

NetBSD PR/47699
2013-03-27 16:36:56 +00:00
Roy Marples
f7acdb2007 Fix compile on BSD 2013-02-19 15:28:21 +00:00
Roy Marples
969527cdec Fix compile. 2013-02-16 13:25:31 +00:00
Roy Marples
68ceb7004a Fix compile on BSD 2013-02-04 14:12:48 +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
3a83f8aced Fix compile fr systems without RTF_CLONING such as FreeBSD-8 2012-10-24 12:59:20 +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
Roy Marples
ae20b7ddab Simplify API a little. 2012-03-27 19:01:49 +00:00
roy@uberlaptop.marples.name
dcc1e564e7 Fix some valgrind errors on FreeBSD 2012-03-27 16:30:33 +00:00
Roy Marples
159cb2e6cf Fix carrier handling on BSD for interfaces that don't support link status 2012-01-31 16:32:10 +00:00
Roy Marples
7ae411d942 Fix more copyright 2012-01-31 09:51:12 +00:00
Roy Marples
c06ded74b2 Stop trunctating netmask sockaddr 2012-01-30 20:11:47 +00:00
Roy Marples
75092c2373 Optimize bitwise useage a little. 2011-11-23 11:59:53 +00:00
Roy Marples
e896947f2c Fix bitwise logic 2011-11-23 10:53:53 +00:00
Roy Marples
5f3b570cfd Fix carrier handling on BSD 2011-11-23 09:57:34 +00:00
Roy Marples
126abb55cf Respect each kernel message on carrier change instead of checking carrier
after receiving the message as it's possible for the kernel to react faster
than dhcpcd.
2011-11-23 09:03:24 +00:00
Roy Marples
eb99814091 2011 and new version. 2011-02-04 14:56:03 +00:00
Roy Marples
b92c960fe0 Use RT_ROUNDUP and friends so that we work with NetBSD 64-bit routing. 2011-02-04 14:43:51 +00:00
Roy Marples
64bc759d08 Compile on Mac OSX 10.4.
Thanks to David Brownlee.
2010-12-06 15:01:56 +00:00
Roy Marples
8349d72adf Support RTM_CHGADDR in NetBSD-6 for detecting link layer address changes. 2010-11-12 16:33:45 +00:00
Roy Marples
029821afa1 Use a dynamic buffer for managing link messages. 2010-07-21 20:45:41 +00:00
Roy Marples
7b6f803e29 These files were updated in 2010, so fix copyrights. 2010-06-04 08:33:16 +00:00
Roy Marples
d274a5320b Set the broadcast flag for interfaces that say they need it. 2010-03-05 15:47:46 +00:00
Roy Marples
255e14dab1 Enable net.ipv4.conf.$iface.promote_secondaries on Linux so that
we keep the subnet when changing addresses on the same subnet.
2010-02-26 20:37:30 +00:00