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.
Roy Marples [Wed, 25 Oct 2017 13:56:23 +0000 (14:56 +0100)]
DHCPv6: listen on all IPv6 addresses for active interface
Simplify the process of selecting addresses to listen for DHCPv6
replies on by listening on all addresses for active interfaces
when not in master mode.
Always send from a socket not bound to an address to ensure
unicast in non master mode works fine. The downside of this approach
is that we no longer send from the DHCPv6 client port, but this
seems to work fine, at least with ISC DHCPd.
Roy Marples [Tue, 24 Oct 2017 22:11:15 +0000 (23:11 +0100)]
bpf: store flags in state for a better abort
There are cases when dhcp may close and open an ARP socket
during an ARP read. This means the fd will not be -1, so we need
to set BPF_EOF when closing the socket.
Roy Marples [Mon, 23 Oct 2017 23:13:09 +0000 (00:13 +0100)]
dhcp: arp announce existing address before reboot
This updates upstream ARP tables to send their ACK to the
interface we want to receive the message on and not one
which is not in use but has the same IP address.
Doing this means we no longer need to open DHCP sockets for
interfaces we're not interested in.
Roy Marples [Thu, 5 Oct 2017 07:05:08 +0000 (08:05 +0100)]
We don't actually care about the number of added routes, just
it we failed or not.
So just return 0 on success and -1 on failure to work around
a gcc check where signed int could overflow.
This should be impossible anyway due to the protocol limits of
DHCP and RA.
Roy Marples [Tue, 3 Oct 2017 14:50:27 +0000 (15:50 +0100)]
Compile eloop with config.h by default and bring in compat modules.
This allows us to build this test AND dhcpcd exactly the same,
which is important as they build eloop.o in the same place.
Roy Marples [Tue, 3 Oct 2017 11:00:52 +0000 (12:00 +0100)]
Don't special case not deleteing the IPv6 default route.
dhcpcd now manages this the same as any other route as dhcpcd is
either in charge of IPv6 or it's not.
Roy Marples [Fri, 15 Sep 2017 11:56:09 +0000 (12:56 +0100)]
arp: RFC5227 kernels need to send ARP too
Now that IP address sharing is handled with ARP announcements.
This fixes the issue where RFC5227 kernels would fail to compile
if not compiled for ARPING as well.
Roy Marples [Mon, 28 Aug 2017 22:43:19 +0000 (23:43 +0100)]
dhcp6: listen to each DHCP address for messages
Summary:
This allows dhcpcd to receive unicast DHCPv6 messages to non LL
addresses in non master mode.
Fixes T123.
Test Plan:
* Setup your DHCPv6 server to send the unicast option
* Start dhcpcd for a specific interface
* Watch it ask for confirmation and receive replies to messages
Roy Marples [Tue, 25 Jul 2017 10:43:12 +0000 (11:43 +0100)]
Persist shared IP address on interfaces.
Summary:
Send unicast DHCP messages by BPF rather than a UDP socket.
Open a BPF socket for all interfaces whether active or not.
Redirect packets to the correct interface based on xid and chaddr.
Announce the primary address via ARP when any address is added or deleted.
Remove the now redundant prefer another address code.
Fixes T126.
Test Plan:
Setup your DHCP server to assign the same address to many interfaces
on the same host.
On the host, start dhcpcd and bring up/down/activate the interfaces
in a random order.
Pinging another host on the network should be possible at all times
if any interface is up.
Roy Marples [Tue, 25 Jul 2017 10:00:44 +0000 (11:00 +0100)]
dhcp6: implement lastlease and lastleaseextend
Summary:
This has resulted in a fair churn of code, but in summary:
* TIMEDOUT state introduced
* lease binding split out from handledata
* generic fail function introduced to attempt rebind
of lastlease
* extended addresses are remembered and purged when a
lease is re-negotiated
* defaults of 0 are no longer hard coded for most timers
Fixes T128.
Test Plan:
Obtain a dhcp6 lease, kill dhcpcd and the dhcp6 server.
run with `--lastlease` and check it's applied correctly.
Also, observe timers to ensure it renews, rebinds and expires.
Do same, but now with `--lastleaseextend as well`.
Observe same timers, but it should not expire but become an
infinite lease until a new one appears.
Roy Marples [Tue, 25 Jul 2017 09:14:06 +0000 (10:14 +0100)]
dhcpcd starts inactive interfaces erroneously.
Summary: If ifp->active is not IF_ACTIVE_USER only find DHCPv6 delegations for the interface on carrier up.
Test Plan:
Allow DHCP on all interfaces, but set one interface in denyinterfaces.
Assign this interface a delegation from another interface.
This interface should not start DHCP.