Integrated patch #6721: new option to adjust the time when DHCP gives over to AUTOIP and some improvements in DHCP/AUTOIP cooperation

This commit is contained in:
goldsimon 2009-04-28 19:29:46 +00:00
parent 4b8255a588
commit 3b5993e6ee
3 changed files with 26 additions and 3 deletions

View File

@ -95,6 +95,9 @@ HISTORY
++ Bugfixes: ++ Bugfixes:
2009-04-28 Simon Goldschmidt, Jakob Stoklund Olesen
* dhcp.c: patch #6721: Some small fixes to DHCP and DHCP/AUTOIP cooperation
2009-04-25 Simon Goldschmidt, Oleg Tyshev 2009-04-25 Simon Goldschmidt, Oleg Tyshev
* tcp_out.c: bug #24212: Deadlocked tcp_retransmit due to exceeded pcb->cwnd * tcp_out.c: bug #24212: Deadlocked tcp_retransmit due to exceeded pcb->cwnd
Fixed by sorting the unsent and unacked queues (segments are inserted at the Fixed by sorting the unsent and unacked queues (segments are inserted at the

View File

@ -817,8 +817,7 @@ dhcp_discover(struct netif *netif)
} }
dhcp->tries++; dhcp->tries++;
#if LWIP_DHCP_AUTOIP_COOP #if LWIP_DHCP_AUTOIP_COOP
/* that means we waited 57 seconds */ if(dhcp->tries >= LWIP_DHCP_AUTOIP_COOP_TRIES && dhcp->autoip_coop_state == DHCP_AUTOIP_COOP_STATE_OFF) {
if(dhcp->tries >= 9 && dhcp->autoip_coop_state == DHCP_AUTOIP_COOP_STATE_OFF) {
dhcp->autoip_coop_state = DHCP_AUTOIP_COOP_STATE_ON; dhcp->autoip_coop_state = DHCP_AUTOIP_COOP_STATE_ON;
autoip_start(netif); autoip_start(netif);
} }
@ -899,6 +898,13 @@ dhcp_bind(struct netif *netif)
gw_addr.addr |= htonl(0x00000001); gw_addr.addr |= htonl(0x00000001);
} }
#if LWIP_DHCP_AUTOIP_COOP
if(dhcp->autoip_coop_state == DHCP_AUTOIP_COOP_STATE_ON) {
autoip_stop(netif);
dhcp->autoip_coop_state = DHCP_AUTOIP_COOP_STATE_OFF;
}
#endif /* LWIP_DHCP_AUTOIP_COOP */
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_STATE, ("dhcp_bind(): IP: 0x%08"X32_F"\n", dhcp->offered_ip_addr.addr)); LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_STATE, ("dhcp_bind(): IP: 0x%08"X32_F"\n", dhcp->offered_ip_addr.addr));
netif_set_ipaddr(netif, &dhcp->offered_ip_addr); netif_set_ipaddr(netif, &dhcp->offered_ip_addr);
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_STATE, ("dhcp_bind(): SN: 0x%08"X32_F"\n", sn_mask.addr)); LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_STATE, ("dhcp_bind(): SN: 0x%08"X32_F"\n", sn_mask.addr));
@ -1405,7 +1411,10 @@ dhcp_create_request(struct netif *netif)
dhcp->msg_out->xid = htonl(dhcp->xid); dhcp->msg_out->xid = htonl(dhcp->xid);
dhcp->msg_out->secs = 0; dhcp->msg_out->secs = 0;
dhcp->msg_out->flags = 0; dhcp->msg_out->flags = 0;
dhcp->msg_out->ciaddr.addr = netif->ip_addr.addr; dhcp->msg_out->ciaddr.addr = 0;
if (dhcp->state==DHCP_BOUND || dhcp->state==DHCP_RENEWING || dhcp->state==DHCP_REBINDING) {
dhcp->msg_out->ciaddr.addr = netif->ip_addr.addr;
}
dhcp->msg_out->yiaddr.addr = 0; dhcp->msg_out->yiaddr.addr = 0;
dhcp->msg_out->siaddr.addr = 0; dhcp->msg_out->siaddr.addr = 0;
dhcp->msg_out->giaddr.addr = 0; dhcp->msg_out->giaddr.addr = 0;

View File

@ -542,6 +542,17 @@
#define LWIP_DHCP_AUTOIP_COOP 0 #define LWIP_DHCP_AUTOIP_COOP 0
#endif #endif
/**
* LWIP_DHCP_AUTOIP_COOP_TRIES: Set to the number of DHCP DISCOVER probes
* that should be sent before falling back on AUTOIP. This can be set
* as low as 1 to get an AutoIP address very quickly, but you should
* be prepared to handle a changing IP address when DHCP overrides
* AutoIP.
*/
#ifndef LWIP_DHCP_AUTOIP_COOP_TRIES
#define LWIP_DHCP_AUTOIP_COOP_TRIES 9
#endif
/* /*
---------------------------------- ----------------------------------
---------- SNMP options ---------- ---------- SNMP options ----------