Finally have kqueue and epoll working for a multi-process
setup.
The secret sauce was that after forking the fd for polling
is invalid and as such should not be closed blindly.
If an interface stops, it might affect the routing priority.
When dhcpcd is exiting we want to avoid this behaviour to keep
the system running as best as.
privsep: enforce message boundaries with MSG_EOR on our messages
The nature of the SOCK_SEQPACKET, that privsep modules uses, is stream.
See:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_10_06
To guarantee that a reader will never read two messages in one read
operation, the writer shall put end of record markers.
The problem exposed itself in FreeBSD 15.0 that started to follow the
specification better than before.
Other SOCK_SEQPACKET usage considerations: a) as long as our reader
provides a receive buffer that would fit the largest message our writer
would ever send, we are good with regards to not a reading a partial
message b) as long as our writer always write full messages with one
write, we don't need use of MSG_WAITALL in reader.
Fixes#530
Co-authored-by: Roy Marples <roy@marples.name>
There is no ordering requirement from any RFC other than the
recommendations in RFC 7844.
But it seems some DHCP servers really want the message type as
the first option.
Fixes#522.
This indicates an option might be truncated from it's natural
length and will be zero padded on expansion.
Only supported for the ip6address option.
While here, support 1 as a bitflag to just print the bit.
Fixes#508.
RFC2131 4.4.5 says:
The server SHOULD return T1 and T2.
Other DHCP clients don't request them by default and we can save two
bytes in the message size by not sending them.
Its return value is the opposite of consttime_memequal.
This function is available all modern BSD's except for NetBSD where
we have consttime_memequal.
850f93b changed the logic while moving things around. Restore
the original logic so we open a socket even if the address is the
same, so long as it's the first time.
Valgrind will still error by default at exit as the syscall to
unlink the pipe files is denied.
This can be avoided by compiling with -DVALGRIND.
The pipe files still won't be removed as dhcpcd has
already dropped to the non root user.
This is a Vagrind issue really.
hardened-malloc should now run as well as their documented syscalls
are now allowed by default.
Fixes#497.