Use a separate state machine for the arp handling. It's loosely coupled to
the dhcp code, and is thus much easier to reason about than the previous
approach that made the arp code use the dhcp state.
Add a BPF and C emulation of the BPF for RFC5227-style address defense. Allow
switchable BPF filters for the arp socket.
Fix a regression introduced in the arp announcement commit. Contrary to
RFC5227, the 'h_dest' field in the ARP packet should be set to all 0xff
for wildcard semantics, not all 0x00.
Keep track of the millisecond timestamp of the most recent ARP packet that has
been sent as well as the total number of packets that have been sent in
the current ARP state. Use these values to implement time-based ARP
retransmit.
When querying the default gateway/router, use ARP packets that have the
source IP set to the client lease IP rather than 0.0.0.0.
Combine common code in the arp sending functions into arp_send().
Resequence the arp_announcement() in arp_success() so that it happens after
the interface is configured by ifchange() / ifchd.
Get rid of layering hack in ifchange.c to set the router address in the
client state. Do it in the proper place in arp.c.
Add an early exit before ifchd_cmd() in ifchange.c. This change prevents
sending a ':' to ifchd for a string type option with no string content.
corresponding waits for responses rather than sending two packets and
immediately backgrounding or failing after the second is sent without waiting
for a response.
Set sll_pkttype = PACKET_BROADCAST on outgoing raw dhcp packets.
Condense arguments for send_dhcp_cooked().
initialization. Fetching if/address/index/mac mappings is done only once at
program init, so it is done synchronously as an exception to this rule.
Rewrite the netlink handling. Now uses NIH code that should be safe, small,
and correct. No external deps FTW.
running. ndhc does its job entirely with raw sockets before a lease is
established, so it will work just fine, and this change allows for the dhcp
client to be re-run without causing downtime on an interface.
are discarded, and the UDP length, IP length, and IP header size fields are
validated for consistency.
Keep track of whether the DHCP BPF has been successfully installed. If it has,
then don't perform redundant checks in DHCP validation.
Take advantage of that feature in ndhc.c when initializing the state
and config structures.
Fix some seriously stupid typos in the commit before the previous one.
is received that is discarded by ndhc's basic checks and provokes a busy
loop in the main program loop because epoll_wait() constantly sees data that
is never drained from the socket buffer since arp_offset exceeds the
maximum size of an ARP packet and would overflow the packet buffer.