Commit Graph

3628 Commits

Author SHA1 Message Date
Roy Marples
e5fc8ac453 Allow dhcpcd to be built without Authentiction support for system media with
extreme size constraints.
2016-09-19 09:08:11 +00:00
Roy Marples
a8c0412dbe Fix compile on Linux 2016-09-16 19:41:05 +00:00
Roy Marples
b7f974d0bd ifa_msghdr does not have the alias it's for, which is bad.
This hack works around it, but it's not 100% accurate :/
2016-09-16 19:38:30 +00:00
Roy Marples
5daad0b0f3 SMALL target removes the custom logger. 2016-09-16 16:21:17 +00:00
Roy Marples
ae8cd3160c Fix compile on OpenBSD. 2016-09-16 16:03:00 +00:00
Roy Marples
b0601fe416 One BSD in the future will include address flags in ifa_msghdr.
A libc in the future will include address flags in ifaddrs.
Although this does make the code a bit more #ifdef messy, the end result
is a smaller binary, and less ioctls to make.
2016-09-16 15:49:01 +00:00
Roy Marples
ba13abcc97 When validating a lease with an OK but no IA's and in the CONFIRM phase
then look for IA's in the old lease.
This allows us to get correct expiry and rebind times from old lease but
based from the acquision time of the CONFIRM message.
2016-09-16 15:28:46 +00:00
Roy Marples
3fa8525c3b Ignore RTM versions we don't know. 2016-09-15 10:36:58 +00:00
Roy Marples
14602bba96 Solaris allows a route per gateway as well. 2016-09-12 16:03:19 +00:00
Roy Marples
ec32dc930a dhcpcd considers the link down without IFF_UP. 2016-09-12 16:02:40 +00:00
Roy Marples
71b554fcd3 OpenBSD allows many routes to the same dest with different gateways.
dhcpcd does not support this yet, so just delete the route until there is an error.
Fixes [ad8b5130d4].
2016-09-12 10:58:32 +00:00
Roy Marples
98cc5e0b72 Add the --small configure option which currently removes non essential options
from being parsed out into dhcpcd-run-hooks and removes support for
DHCPv6 Prefix Delegation.
This is mainly to build a tiny dhcpcd for install media size there are more
extreme space limitations.
2016-09-09 09:56:26 +00:00
Roy Marples
4faac32f3a Always roundup the required buffer. 2016-09-06 16:39:03 +00:00
Roy Marples
a20e56102c More assert 2016-09-06 16:14:31 +00:00
Roy Marples
5c74cceb9b Don't dispatch 0 bytes. 2016-09-06 14:58:33 +00:00
Roy Marples
7ea9fe0f6a When receiving multipart messages, receive them again until we get NLMSG_DONE. 2016-09-06 13:46:12 +00:00
Roy Marples
91bdb2797f DragonFly needs to ingore RTM_DELADDR as well. 2016-09-06 12:05:55 +00:00
Roy Marples
375aae4fbb Remove the POLLADDR check out of if-bsd.c and into ipv6.c for other OS's 2016-09-06 10:43:49 +00:00
Roy Marples
527a983d26 Rename var to avoid a global on OpenBSD. 2016-09-06 10:03:08 +00:00
Roy Marples
df46ce682b More iovec array fixes. 2016-09-05 22:48:08 +00:00
Roy Marples
70a8bd8892 Fix more iovec to arrays. 2016-09-05 22:35:29 +00:00
Roy Marples
902f2f0071 recvmsg expects an array of iovec structures, not a pointer to the first one. 2016-09-05 22:27:47 +00:00
Roy Marples
cb9ab2a804 Re-check address flags when carrier goes down if we poll for address flags. 2016-09-05 21:20:14 +00:00
Roy Marples
0cc611febe If we need to poll for address flags, do this for tentative link-local addresses too. 2016-09-05 21:19:29 +00:00
Roy Marples
41c70c8c47 Dodge more errors when deleting not available anymore. 2016-09-05 20:11:44 +00:00
Roy Marples
b1fa020896 Don't violate memory when we learn new IPv4LL addresses. 2016-09-05 20:08:46 +00:00
Roy Marples
b8f763c2ed We need a seperate iovec buffer for receiving netlink messages because
we need to send and receive before the first receive has finished.
2016-09-05 20:08:15 +00:00
Roy Marples
59d050bda8 Only callback when there is a callback. 2016-09-05 19:43:14 +00:00
Roy Marples
ee7545d027 Handle NLMSG_NOOP and NLMSG_DONE.
Move err_netlink to here as well to clarify.
2016-09-05 19:39:42 +00:00
Roy Marples
fa8901d4d5 Ensure that the IPv6 link-local address always uses the secret key at startup. 2016-09-05 15:57:30 +00:00
Roy Marples
5b7f4be8cb Remove IPv4 routes in reverse order to match IPv6.
Thanks to Guy Yur.
2016-09-03 12:23:03 +00:00
Roy Marples
cf5305c098 Test slen is not -1 before setting error on MSG_TRUNC. 2016-09-02 14:29:54 +00:00
Roy Marples
2a8cb19491 Don't call snprintf needlessly. 2016-09-02 14:02:45 +00:00
Roy Marples
86189d8e21 Check valid netmask changes. 2016-09-02 13:57:42 +00:00
Roy Marples
588dc4c044 Don't add host routes for the IPv4LL default route. 2016-09-02 13:37:07 +00:00
Roy Marples
e09e786a6a When deleting routes, delete the stored kernel route as well.
This enables IPv4LL default routes to be re-added if a DHCP lease expires.
2016-09-02 13:10:39 +00:00
Roy Marples
2b8eee9d96 Only log errors about getting address flags if the error is not address
unavailable.
2016-09-02 12:36:33 +00:00
Roy Marples
2629170f01 Remove the need for statically sized receive buffers for IPv6 ND and DHCPv6
messages.
2016-09-02 11:34:09 +00:00
Roy Marples
ec07c16ec3 Provide better commentary. 2016-09-02 10:42:09 +00:00
Roy Marples
88455ec220 Optimise recvmsg_realloc. 2016-09-02 10:20:30 +00:00
Roy Marples
33ae7008bf bytes -> len 2016-09-02 09:01:21 +00:00
Roy Marples
778de943de If more than one iovec then realloc the last one. 2016-09-02 08:16:31 +00:00
Roy Marples
c62f687eb8 Rework the recvmsg_realloc function to handle flags.
Commit also includes mistakenly added ifam_pid patch for BSD.
It does no harm being here, even though no BSD supports this yet.
2016-09-02 08:09:47 +00:00
Roy Marples
92b920ad2c Use recvmsg_alloc on Solaris too. 2016-09-01 17:12:37 +00:00
Roy Marples
ea25975d6b Linux now uses recvmsg_alloc as well, reducing duplicated code. 2016-09-01 17:01:26 +00:00
Roy Marples
87cf152170 Remove debug added accidently in last commit. 2016-09-01 14:50:28 +00:00
Roy Marples
26a52fe1a1 Use a dynamically sized buffer for reading route(4) messages on BSD
instead of a fixed 2048 byte buffer.
2016-09-01 14:37:48 +00:00
Roy Marples
8d31ed9d3c FreeBSD emits RTM_DELADDR for INET addresses that still exit,
for example when dowing the interface.
This is totally bogus, so we ignore it.

While here, only set LINK_UP for RTM_IFINFO messges when IFF_UP is also set.

This should fix dhcpcd working on FreeBSD when downing interfaces and
link is lost.
2016-09-01 13:17:07 +00:00
Roy Marples
4793785b7f Clear LL callbacks when dropping or freeing addresses. 2016-09-01 11:48:21 +00:00
Roy Marples
f6245ee8b7 Fix a dropping leases when the ip address is removed by a 3rd party. 2016-09-01 11:46:51 +00:00