Each lifetime has a an aquistion time so we can compare to
now to know how much of the lifetime is left.
Apply the difference when adding/changing the route just as we
do for addresses.
This allow us to work out better when we need to update the
route lifetime from a newer aquisition.
Fixes#465.
We need to make two sysctls to pull the route table from the kernel.
The first one works out the size of the buffer required and the
second one populates it.
It's possible for more routes to be added between these two calls
causing the second call to fail with ENOMEM.
If this happens, just re-query the size needed and try again.
Fixes#466.
Netmask family and length are ignored by traditional
userland tools such as route and netstat and are assumed
to match the destination sockaddr.
This is fortunate because BSD kernels use a radix tree
to store routes which adjusts the netmask at the point
of insertion where this information is lost.
We can just sub in the values from the destination address.
This is currently true for all BSD kernels.
Fixes#458.
Add many build options to the NetBSD target
Set any warnings to be errors as NetBSD should build without
any warnings. DragonFly as well, but we don't have a target for that.
This should fix dhcpcd sending the correct DHCP message type
when entering the RENEW or REBIND state.
Fixes#355.
Co-authored-by: Zikai Chen <chenzikai@google.com>
On BSD when an address is added, the interface is automatically
brought up.
We can detect this by RTM_NEWADDR, but that lacks the IFF_UP flag.
We really want to stay in sync with RTM messages for flags, but
here we need to check the interface for IFF_UP if we think it's
not there. Only set that.
This fixes NEWADDR announcements for state transitions when
the interface is currently down.
RFC8415 says client must always request Information Request refresh time
option 32.
Client has other logic for handling if server does not include this in
the reply.
Resolves#445.
Everything about IPv6 is lifetime, not expiry.
Only linux routes have an expiry.
OK, this is not consistent at all!
In the kernel RTA_EXPIRES is only set for IPv4 multicast routes
when emitting route changes and only read for IPv6 routes when
userland makes route changes.
We cannot set this for non IPv6 routes currently.
To make it worse, we set a UINT32 for IPv6 routes but read a
UINT64 for IPv4 multicast routes.
To make this even more totally bonkers, the expiry we set for
the IPv6 route can be read back via RTA_CACHEINE rta_expires
but we need to convert to divide it by hz.
Now we can read kernel route lifetime correctly, we can compare this to what we think it should be when building the routing table (allowing for some deviation due to processing time) and update if needed.
Fixes#428.
* DHCP: Add support for sending DHCP option 125 and DHCPv6 Option 17 (VSIO)
Note wireshark doesn't decode option 125 correctly when the it needs to be split into more options if it exceeds 255 bytes.
---------
Signed-off-by: Stipe Poljak (EXT) <stipe.poljak.ext@ericsson.com>
Co-authored-by: Roy Marples <roy@marples.name>