when the hardware link carrier is dropped and comes back. Also, don't assume
that all networks have a default gateway.
Guard against spurious arp defense attempts that might be triggered by packets
that are still in the socket buffer from before the BPF was changed.
Split apart the AS_GW_CHECK and AS_GW_QUERY timeout handlers.
Cosmetic cleanups in state.c.
packet response functions are handled by an array of function pointers indexed
by ARP state.
Split arp_retransmit() apart into simpler functions.
Fix a typo in renewing_timeout() that would result in too-short timeouts that
would soak cpu.
Call handle_arp_timeout() from the timeout_action() function rather than
having
explicit hooks in various <dhcpstate>_timeout() functions.
Make the function pointer arrays static const.
handle_arp_response() and when opening a new arp fd. Do not clear the
arpreply buffer and offset on ARP state transitions.
Only perform ARP collision probing when binding a new lease from the
DS_REQUESTING state, or if we have renewed or rebound a lease with a different
IP than we had before.
Resequence the arp_dhcp_packet memcpy() in arp_check() so that the current
IP address is ARP checked rather than the previous one.
ifchd if it is necessary to do so, just as is the case for other keywords.
Make data sending in ifchange_*() collect all keywords into a buffer that
is sent in a single sockwrite() rather than performing a sockwrite() for
every keyword.
Minor documentation updates.
hardware link returns after having been lost.
Make the timeout action for DS_BOUND_GW_CHECK perform ARP retransmissions
rather than just sending a single query.
RFC5227. Rate-limiting is also supported.
Keep ARP stats per packet send type rather than per ARP state. Use the new
stats to replace last_def_ts.
Multiple triggers of arp_gw_check from interface-up-events in quick succession
could cause the dhcpState to become corrupt. Fix by making the ARP_GW_CHECK
be level triggered rather than edge triggered.
Make the timeout calculations in the ARP retransmission code much more
accurate.
Close the ARP fd if we give up on lease defense and go back to requesting a
new lease.
Do a second arp_announcement() after finding the default GW's hwaddr.
Clean up frenew to sanely handle the various ARP checking events. Now renew
signals will be ignored during these states. It was particularly insane
before if a renew signal were received during DS_COLLISION_CHECK.
If the hardware link carrier goes down, do not sleep. Just keep working.
Only go to sleep if the user explicitly deconfigures the interface. This
change is far more sane for non-mobile hosts, and still works fine with
roaming machines: the important thing is the gw hardware address checking that
is triggered when the interface comes back up.
state to what it was before closing the fd. It may allow the client to
continue working in the face of error, as arp functionality is not critical
for simply holding a lease.
into the BASE_ARPMSG() macro to make it more obvious what is shared.
Resequence the gateway arp address print and the arp state change to
AS_DEFENSE so that the debug prints are less confusing. No other change.
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.