Roy Marples [Tue, 8 Oct 2019 10:29:15 +0000 (11:29 +0100)]
IPv4LL: Pick a different address at conflict
The start function will be called at carrier up and may rightly
pick the last assigned address. So, we need to ensure we pick the
next address we want to try at any conflict.
DHCP: Ensure we have enough data to checksum IP and UDP
While here, only skip UDP checksum after we have verified we
have enough data to be doubly sure.
Fixes a regression introduced in dhcpcd-7.2.0 when we started
to read from the UDP socket rather than just the BPF socket
where these checks are already made.
Roy Marples [Fri, 13 Sep 2019 09:43:51 +0000 (10:43 +0100)]
DHCP: Give a better message when packet validation failes
We return ERANGE for underflow and ENOBUFS for overflow,
but these error strings could be misleading.
For EINVAL report invalid checksum, otherwise invalid UDP packet.
Roy Marples [Thu, 5 Sep 2019 09:03:13 +0000 (10:03 +0100)]
inet6: Fix default route not being installed
We need to check for global addresses on any forwarding interface,
not just the interface we received the RA on.
Otherwise this breaks routers who get a default route only
from the RA and IPv6 addresses only by prefix delegation to
other interfaces.
Roy Marples [Tue, 3 Sep 2019 20:20:57 +0000 (23:20 +0300)]
Solaris: plumb interface at init if does not exist
This makes dhcpcd go so much easier.
The only downside is that you always get an unspecified address
on the default LUN for each compiled protocol regardless of
if you use it or not.
Roy Marples [Tue, 3 Sep 2019 11:40:13 +0000 (12:40 +0100)]
DHCP: Don't listen on the unspecified address when not in master mode
Otherwise we will swallow messages for another interface.
If we fail to bind to the address:BOOTPC socket then re-open
BPF. This could be due to address sharing (which isn't supported
withoutn master mode) or even worse another DHCP client running
on the same address. In this case, re-open BPF so we can listen
to RECONFIGURE messages.
Roy Marples [Sun, 1 Sep 2019 20:29:46 +0000 (21:29 +0100)]
BSD: Handle RTM_MISS
RTM_MISS is sent when an address is not resolvable.
This means that we want to use it but don't know how to reach it
and thus is neighbour unreachable.
If it's the address a RA came from and we don't have any others
on that interface, solicit a new RA.
We still handle RTM_DELETE as RTM_MISS as the address llentry
could have been gc'ed or manually deleted and is thus
unreachable.
Roy Marples [Thu, 29 Aug 2019 18:10:53 +0000 (19:10 +0100)]
inet6: Stop listening to NA messages
This is very expensive, and we only listen for them for the
Router -> Host flag change. Linux and now NetBSD announce this
change via the netlink/routing socket so there is no longer a
need to listen for it.
RFC 4861 6.2.5 only says departing routers *SHOULD* send RA
with lifetime of zero and *MUST* send all subsequent NA messages
with the router flag unset, so dhcpcd *SHOULD* still work.
For the corner case where it doesn't, consider patching your
kernel.
Roy Marples [Thu, 29 Aug 2019 18:04:21 +0000 (19:04 +0100)]
BSD: Listen for Router -> Host messages via RTM_CHANGE
If there is a lladdr in the gateway address then the node
has become reachable. If there is no lladdr in the gateway address
then the node is no longer a router.
Unreachable is sent via RTM_DELETE and we ignore the initial
RTM_ADD without a lladdr.
Roy Marples [Sun, 25 Aug 2019 13:40:20 +0000 (14:40 +0100)]
inet6: Don't install a default route if no global address
This works around an issue where some routers advertise themselves
as a default router, but offer no address to actually use.
Thus, it is actually useless as a router.
If an address is added by any other means (DHCPv6, static, etc)
then the default route is installed once more.
This is also dynamic - dhcpcd reacts to addresses being added,
removed, duplicated, detached, etc.
Roy Marples [Sun, 25 Aug 2019 11:10:00 +0000 (12:10 +0100)]
inet6: Just solicit when a router is unreachable
We shouldn't take the default route away as there could be valid
reasons, such as the default route changing interface.
Instead, just solicit another router if there are no valid routers
on the interface.