21 Commits

Author SHA1 Message Date
Nicholas J. Kain
3205f823d9 Handle DS_REBINDING and DS_RENEWING states just like DS_BOUND when the
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.
2011-07-05 15:57:11 -04:00
Nicholas J. Kain
3196ad750e cs->packetNum is not descriptive and is not used outside of state.c.
Rename it to num_dhcp_requests that is a static global to state.c.
2011-07-05 15:44:11 -04:00
Nicholas J. Kain
315cf6b135 Send probe requests in COLLISION_CHECK state in a way that is compliant with
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.
2011-07-05 15:40:57 -04:00
Nicholas J. Kain
f1fcd4dc16 Perform timeout-based ARP retransmission for AS_GW_CHECK and AS_GW_QUERY. 2011-07-05 11:07:42 -04:00
Nicholas J. Kain
a9c807c1df Rename DS_ARP_CHECK to the less confusing DS_COLLISION_CHECK.
Call arp_reopen_fd() if reading from the arp fd fails in any state other
than AS_COLLISION_CHECK or AS_GW_CHECK.
2011-07-04 22:59:07 -04:00
Nicholas J. Kain
b3acad9166 Use reinit_selecting() in arp.c. 2011-07-04 22:52:53 -04:00
Nicholas J. Kain
4453391154 Move dhcp state handling code out of netlink.c and into state.c. netlink.c
now just calls hooks exposed by state.c, just like the dhcp packet,
poll timeout, and signal code.

Make ifchange_deconfig() idempotent.
2011-07-04 22:10:14 -04:00
Nicholas J. Kain
9ef66af020 Simplify the ifchange API. 2011-07-04 20:51:27 -04:00
Nicholas J. Kain
be44bf0a04 Resequence operations in selecting_timeout() so that two packets are sent with
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().
2011-07-03 18:56:57 -04:00
Nicholas J. Kain
38ad2399ed Clean up the DHCP packet sending functions and make them more RFC-compliant.
Rename cs->requestedIP to cs->clientAddr.
Move the IFS_* defines into netlink.c.
Cosmetic cleanups.
2011-07-01 11:37:13 -04:00
Nicholas J. Kain
1f514cbb50 Hide details of the listen mode implementation in packet.c. 2011-06-30 21:33:38 -04:00
Nicholas J. Kain
6f2986803f Fix a dumb error in delay_timeout(). Return value should be ms, not s. 2011-06-30 04:12:59 -04:00
Nicholas J. Kain
e77190e2e9 Make frenew() less insane. It was most likely subtly buggy before depending
on state.
2011-06-30 03:43:09 -04:00
Nicholas J. Kain
3a81f1ea6c Use an RFC2131-compliant exponential backoff delay. 2011-06-30 03:27:57 -04:00
Nicholas J. Kain
339804856b Make the renew and rebind timeouts more strictly rfc compliant, and also
take into account the possiblity of renew times being ridiculously deferred
such that the current time is within lease expiration time.
2011-06-30 02:48:58 -04:00
Nicholas J. Kain
8fffc5721f Calculate the renewTime timeout more accurately: take the delay in ARP
checking into account.

Rename t1 and t2 to renewTime and rebindTime.
2011-06-30 01:50:50 -04:00
Nicholas J. Kain
d89e9f89c2 Rename ARP_GW_CHECK to BOUND_GW_CHECK and call anfrelease() rather than
frelease() for this state.
2011-06-30 00:39:17 -04:00
Nicholas J. Kain
3f6aafe809 Remove the DS_RENEW_REQUESTED state. 2011-06-30 00:19:59 -04:00
Nicholas J. Kain
d6fcb35903 Fold renew_requested_timeout() into requesting_timeout(). 2011-06-30 00:11:43 -04:00
Nicholas J. Kain
6ea5ac0d5d Don't special case DS_ARP_CHECK in nfrelease(). 2011-06-30 00:01:02 -04:00
Nicholas J. Kain
76ecfffce2 Centralize DHCP timeout, packet reciept, and user-demanded action handling
into state.[ch].  Remove timeout.c.
2011-06-29 23:47:31 -04:00