Roy Marples [Sun, 29 Apr 2018 20:38:58 +0000 (21:38 +0100)]
auth: allow different tokens for send and receive
It was silly of me to assume that the same key would be used for
both sending and receiving. Because token protocol is not digested,
replace the digest argument with 0x123/0x456 where 0x123 is the
sending key and 0x456 is the receiving key.
Receiving key defaults to sending key, sending key defaults to zero.
This should allow existing configurations to work as is.
Roy Marples [Sun, 29 Apr 2018 20:28:15 +0000 (21:28 +0100)]
auth: allow zero value replay detection data
It seems one ISP doesn't use Replay Data and always sets it to zero.
See the comment in the commit as to why this is technically legal,
even if it goes against the intent of the RFC.
Roy Marples [Thu, 26 Apr 2018 18:35:43 +0000 (19:35 +0100)]
RFC 3315 21.4.4.1 says that SOLICT and DELAYED authentication
should set RDM and replay data to zero.
draft-ietf-dhc-dhcpv6-clarify-auth-01 (expired) suggests that
INFORMATION REQ should be zero in this case as well.
As it's coming from a very similar angle, I agree.
Roy Marples [Wed, 28 Mar 2018 18:25:16 +0000 (18:25 +0000)]
routes: allow a head clear with a context
This is because optionally defined routes may not have an interface
at the global level.
Also, init route lists earlier so they can be freed without error.
Roy Marples [Mon, 19 Mar 2018 15:39:05 +0000 (15:39 +0000)]
link: detect buffer overflow / desync and relearn interface state
It's possible for the internal kernel buffer that reports network
events to overflow.
On Linux and NetBSD* this is handled by ENOBUFS being returned
by recv(2). On OpenBSD there is a special route(4) message RTM_DESYNC.
All other OS's don't seem to report this error, so dhcpcd cannot
detect it.
* I will commit a patch to NetBSD soon for this and will request a
pullup to NetBSD-8.
Roy Marples [Sat, 10 Mar 2018 11:50:08 +0000 (11:50 +0000)]
dhcp6: deny unicast in non master mode
It seems that some DHCP6 servers or firewalls really insist on the
client sending from the correct source port.
This is the safest thing for the time being.
Roy Marples [Tue, 13 Feb 2018 10:33:06 +0000 (10:33 +0000)]
dhcp: reset interval during init
This fixes NetBSD where the lease is persisted at carrier down.
When the carrier comes back up again we need the interval
to reset to zero so that DHCP happens quicker.
Roy Marples [Fri, 2 Feb 2018 11:24:58 +0000 (11:24 +0000)]
inet6: simplify setup of kernel
Rename if_checkipv6 to if_setup_inet6 so it's more descriptive.
simpify code as we don't really care about the result.
Restore the prior behavior of not disabling kernel RA handling
if dhcpcd is not doing it.
Roy Marples [Fri, 5 Jan 2018 17:29:27 +0000 (17:29 +0000)]
eloop-bench: fix reading the last write
The last write was never read from the pipe in the run, so many
runs filled the kernel buffer causing an error which was not seen
because the pipe was blocking.
Set the pipes to non blocking and improve the exit conditions,
also ensuring the bench returns any error back.
While here add more timings and run critera.
Roy Marples [Thu, 7 Dec 2017 15:12:18 +0000 (15:12 +0000)]
dhcp: when unicasting, don't use a L2 broadcast
This relies change now relies on the kernel supporting IP_PKTINFO
to select the correct outbound interface which may not
always be the case due to routing.
Roy Marples [Tue, 14 Nov 2017 16:41:59 +0000 (16:41 +0000)]
DHCPv6: confirm lease on carrier up
On some platforms which preserve state when carrier goes down,
such as NetBSD-8, the state does not enter the CONFIRM state.
Add more logic to dhcp6_start so that we can better control this
from the various call points.
Roy Marples [Mon, 6 Nov 2017 12:15:53 +0000 (12:15 +0000)]
dhcp6: redirect message to interface with matching xid
When unicasting and receiving unicasted messages, it's possible
that the outgoing and incoming interfaces don't match where the
address and/or prefix are.
To solve this, don't dictate the outgoing interface when unicasting
and match the incoming xid to one we have sent on another interface.