mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-03 21:14:40 +08:00
Fixed some issues open after merging 'leon-dhcp'. Added new debugging.
This commit is contained in:
parent
cc31bb9358
commit
37629fc1b6
@ -75,9 +75,9 @@
|
|||||||
static u32_t xid = 0xABCD0000;
|
static u32_t xid = 0xABCD0000;
|
||||||
|
|
||||||
/** DHCP client state machine functions */
|
/** DHCP client state machine functions */
|
||||||
static void dhcp_handle_ack(struct dhcp *dhcp);
|
static void dhcp_handle_ack(struct netif *netif);
|
||||||
static void dhcp_handle_nak(struct dhcp *dhcp);
|
static void dhcp_handle_nak(struct netif *netif);
|
||||||
static void dhcp_handle_offer(struct dhcp *dhcp);
|
static void dhcp_handle_offer(struct netif *netif);
|
||||||
|
|
||||||
static err_t dhcp_discover(struct netif *netif);
|
static err_t dhcp_discover(struct netif *netif);
|
||||||
static err_t dhcp_select(struct netif *netif);
|
static err_t dhcp_select(struct netif *netif);
|
||||||
@ -99,12 +99,12 @@ static void dhcp_free_reply(struct dhcp *dhcp);
|
|||||||
|
|
||||||
/** set the DHCP timers */
|
/** set the DHCP timers */
|
||||||
static void dhcp_timeout(struct netif *netif);
|
static void dhcp_timeout(struct netif *netif);
|
||||||
static void dhcp_t1_timeout(struct dhcp *dhcp);
|
static void dhcp_t1_timeout(struct netif *netif);
|
||||||
static void dhcp_t2_timeout(struct dhcp *dhcp);
|
static void dhcp_t2_timeout(struct netif *netif);
|
||||||
|
|
||||||
/** build outgoing messages */
|
/** build outgoing messages */
|
||||||
static err_t dhcp_create_request(struct dhcp *dhcp);
|
static err_t dhcp_create_request(struct netif *netif);
|
||||||
static void dhcp_delete_request(struct dhcp *dhcp);
|
static void dhcp_delete_request(struct netif *netif);
|
||||||
static void dhcp_option(struct dhcp *dhcp, u8_t option_type, u8_t option_len);
|
static void dhcp_option(struct dhcp *dhcp, u8_t option_type, u8_t option_len);
|
||||||
static void dhcp_option_byte(struct dhcp *dhcp, u8_t value);
|
static void dhcp_option_byte(struct dhcp *dhcp, u8_t value);
|
||||||
static void dhcp_option_short(struct dhcp *dhcp, u16_t value);
|
static void dhcp_option_short(struct dhcp *dhcp, u16_t value);
|
||||||
@ -122,7 +122,7 @@ static void dhcp_option_trailer(struct dhcp *dhcp);
|
|||||||
*
|
*
|
||||||
* @param state pointer to DHCP state structure
|
* @param state pointer to DHCP state structure
|
||||||
*/
|
*/
|
||||||
static void dhcp_handle_nak(struct dhcp *dhcp) {
|
static void dhcp_handle_nak(struct netif *netif) {
|
||||||
struct dhcp *dhcp = netif->dhcp;
|
struct dhcp *dhcp = netif->dhcp;
|
||||||
u16_t msecs = 10 * 1000;
|
u16_t msecs = 10 * 1000;
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_handle_nak()"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_handle_nak()"));
|
||||||
@ -150,7 +150,7 @@ static void dhcp_check(struct netif *netif)
|
|||||||
p = etharp_query(netif, &dhcp->offered_ip_addr, NULL);
|
p = etharp_query(netif, &dhcp->offered_ip_addr, NULL);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_check(): sending ARP request len %u", p->tot_len));
|
DEBUGF(DHCP_DEBUG, ("dhcp_check(): sending ARP request len %u", p->tot_len));
|
||||||
result = dhcp->netif->linkoutput(netif, p);
|
result = netif->linkoutput(netif, p);
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
p = NULL;
|
p = NULL;
|
||||||
}
|
}
|
||||||
@ -166,8 +166,9 @@ static void dhcp_check(struct netif *netif)
|
|||||||
*
|
*
|
||||||
* @param state pointer to DHCP state structure
|
* @param state pointer to DHCP state structure
|
||||||
*/
|
*/
|
||||||
static void dhcp_handle_offer(struct dhcp *dhcp)
|
static void dhcp_handle_offer(struct netif *netif)
|
||||||
{
|
{
|
||||||
|
struct dhcp *dhcp = netif->dhcp;
|
||||||
/* obtain the server address */
|
/* obtain the server address */
|
||||||
u8_t *option_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_SERVER_ID);
|
u8_t *option_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_SERVER_ID);
|
||||||
if (option_ptr != NULL)
|
if (option_ptr != NULL)
|
||||||
@ -177,7 +178,7 @@ static void dhcp_handle_offer(struct dhcp *dhcp)
|
|||||||
/* remember offered address */
|
/* remember offered address */
|
||||||
ip_addr_set(&dhcp->offered_ip_addr, (struct ip_addr *)&dhcp->msg_in->yiaddr);
|
ip_addr_set(&dhcp->offered_ip_addr, (struct ip_addr *)&dhcp->msg_in->yiaddr);
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_handle_offer(): offer for 0x%08lx", dhcp->offered_ip_addr.addr));
|
DEBUGF(DHCP_DEBUG, ("dhcp_handle_offer(): offer for 0x%08lx", dhcp->offered_ip_addr.addr));
|
||||||
dhcp_select(dhcp);
|
dhcp_select(netif);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,14 +190,15 @@ static void dhcp_handle_offer(struct dhcp *dhcp)
|
|||||||
* @param dhcp pointer to DHCP state structure
|
* @param dhcp pointer to DHCP state structure
|
||||||
* @return lwIP specific error (see error.h)
|
* @return lwIP specific error (see error.h)
|
||||||
*/
|
*/
|
||||||
static err_t dhcp_select(struct dhcp *dhcp)
|
static err_t dhcp_select(struct netif *netif)
|
||||||
{
|
{
|
||||||
|
struct dhcp *dhcp = netif->dhcp;
|
||||||
err_t result;
|
err_t result;
|
||||||
u32_t msecs;
|
u32_t msecs;
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_select()"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_select()"));
|
||||||
|
|
||||||
/* create and initialize the DHCP message header */
|
/* create and initialize the DHCP message header */
|
||||||
result = dhcp_create_request(dhcp);
|
result = dhcp_create_request(netif);
|
||||||
if (result == ERR_OK)
|
if (result == ERR_OK)
|
||||||
{
|
{
|
||||||
dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
|
dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
|
||||||
@ -229,7 +231,7 @@ static err_t dhcp_select(struct dhcp *dhcp)
|
|||||||
udp_send(dhcp->pcb, dhcp->p_out);
|
udp_send(dhcp->pcb, dhcp->p_out);
|
||||||
/* reconnect to any (or to server here?!) */
|
/* reconnect to any (or to server here?!) */
|
||||||
udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
|
udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
|
||||||
dhcp_delete_request(dhcp);
|
dhcp_delete_request(netif);
|
||||||
}
|
}
|
||||||
dhcp->tries++;
|
dhcp->tries++;
|
||||||
msecs = dhcp->tries < 4 ? dhcp->tries * 1000 : 4 * 1000;
|
msecs = dhcp->tries < 4 ? dhcp->tries * 1000 : 4 * 1000;
|
||||||
@ -302,20 +304,21 @@ void dhcp_fine_tmr()
|
|||||||
*/
|
*/
|
||||||
static void dhcp_timeout(struct netif *netif)
|
static void dhcp_timeout(struct netif *netif)
|
||||||
{
|
{
|
||||||
|
struct dhcp *dhcp = netif->dhcp;
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_timeout()"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_timeout()"));
|
||||||
/* back-off period has passed, or server selection timed out */
|
/* back-off period has passed, or server selection timed out */
|
||||||
if ((dhcp->state == DHCP_BACKING_OFF) || (dhcp->state == DHCP_SELECTING)) {
|
if ((dhcp->state == DHCP_BACKING_OFF) || (dhcp->state == DHCP_SELECTING)) {
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_timeout(): restarting discovery"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_timeout(): restarting discovery"));
|
||||||
dhcp_discover(dhcp);
|
dhcp_discover(netif);
|
||||||
/* receiving the requested lease timed out */
|
/* receiving the requested lease timed out */
|
||||||
} else if (dhcp->state == DHCP_REQUESTING) {
|
} else if (dhcp->state == DHCP_REQUESTING) {
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_timeout(): REQUESTING, DHCP request timed out"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_timeout(): REQUESTING, DHCP request timed out"));
|
||||||
if (dhcp->tries <= 5) {
|
if (dhcp->tries <= 5) {
|
||||||
dhcp_select(dhcp);
|
dhcp_select(netif);
|
||||||
} else {
|
} else {
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_timeout(): REQUESTING, releasing, restarting"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_timeout(): REQUESTING, releasing, restarting"));
|
||||||
dhcp_release(dhcp);
|
dhcp_release(netif);
|
||||||
dhcp_discover(dhcp);
|
dhcp_discover(netif);
|
||||||
}
|
}
|
||||||
/* received no ARP reply for the offered address (which is good) */
|
/* received no ARP reply for the offered address (which is good) */
|
||||||
} else if (dhcp->state == DHCP_CHECKING) {
|
} else if (dhcp->state == DHCP_CHECKING) {
|
||||||
@ -334,16 +337,16 @@ static void dhcp_timeout(struct netif *netif)
|
|||||||
DEBUGF(DHCP_DEBUG, ("dhcp_timeout(): RENEWING, DHCP request timed out"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_timeout(): RENEWING, DHCP request timed out"));
|
||||||
/* just retry renewal */
|
/* just retry renewal */
|
||||||
/* note that the rebind timer will eventually time-out if renew does not work */
|
/* note that the rebind timer will eventually time-out if renew does not work */
|
||||||
dhcp_renew(dhcp);
|
dhcp_renew(netif);
|
||||||
/* did not get response to rebind request? */
|
/* did not get response to rebind request? */
|
||||||
} else if (dhcp->state == DHCP_REBINDING) {
|
} else if (dhcp->state == DHCP_REBINDING) {
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_timeout(): REBINDING, DHCP request timed out"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_timeout(): REBINDING, DHCP request timed out"));
|
||||||
if (dhcp->tries <= 8) {
|
if (dhcp->tries <= 8) {
|
||||||
dhcp_rebind(dhcp);
|
dhcp_rebind(netif);
|
||||||
} else {
|
} else {
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_timeout(): RELEASING, DISCOVERING"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_timeout(): RELEASING, DISCOVERING"));
|
||||||
dhcp_release(dhcp);
|
dhcp_release(netif);
|
||||||
dhcp_discover(dhcp);
|
dhcp_discover(netif);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -385,8 +388,9 @@ static void dhcp_t2_timeout(struct netif *netif)
|
|||||||
*
|
*
|
||||||
* @param dhcp pointer to DHCP state structure
|
* @param dhcp pointer to DHCP state structure
|
||||||
*/
|
*/
|
||||||
static void dhcp_handle_ack(struct dhcp *dhcp)
|
static void dhcp_handle_ack(struct netif *netif)
|
||||||
{
|
{
|
||||||
|
struct dhcp *dhcp = netif->dhcp;
|
||||||
u8_t *option_ptr;
|
u8_t *option_ptr;
|
||||||
/* clear options we might not get from the ACK */
|
/* clear options we might not get from the ACK */
|
||||||
dhcp->offered_sn_mask.addr = 0;
|
dhcp->offered_sn_mask.addr = 0;
|
||||||
@ -456,12 +460,12 @@ static void dhcp_handle_ack(struct dhcp *dhcp)
|
|||||||
* (due to unavailable memory or network resources).
|
* (due to unavailable memory or network resources).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct dhcp *dhcp_start(struct netif *netif)
|
err_t dhcp_start(struct netif *netif)
|
||||||
{
|
{
|
||||||
struct dhcp *dhcp = netif->dhcp;
|
struct dhcp *dhcp = netif->dhcp;
|
||||||
err_t result = ERR_OK;
|
err_t result = ERR_OK;
|
||||||
|
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_start(netif=%c%c%u)", netif->, netif->, netif->num));
|
DEBUGF(DHCP_DEBUG, ("dhcp_start(netif=%c%c%u)", netif->name[0], netif->name[1], netif->num));
|
||||||
|
|
||||||
if (dhcp == NULL) {
|
if (dhcp == NULL) {
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_start(): starting new DHCP client"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_start(): starting new DHCP client"));
|
||||||
@ -528,7 +532,7 @@ void dhcp_inform(struct netif *netif)
|
|||||||
}
|
}
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_inform(): created new udp pcb"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_inform(): created new udp pcb"));
|
||||||
/* create and initialize the DHCP message header */
|
/* create and initialize the DHCP message header */
|
||||||
result = dhcp_create_request(dhcp);
|
result = dhcp_create_request(netif);
|
||||||
if (result == ERR_OK) {
|
if (result == ERR_OK) {
|
||||||
|
|
||||||
dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
|
dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
|
||||||
@ -546,7 +550,7 @@ void dhcp_inform(struct netif *netif)
|
|||||||
udp_connect(dhcp->pcb, IP_ADDR_BROADCAST, DHCP_SERVER_PORT);
|
udp_connect(dhcp->pcb, IP_ADDR_BROADCAST, DHCP_SERVER_PORT);
|
||||||
udp_send(dhcp->pcb, dhcp->p_out);
|
udp_send(dhcp->pcb, dhcp->p_out);
|
||||||
udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
|
udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
|
||||||
dhcp_delete_request(dhcp);
|
dhcp_delete_request(netif);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dhcp != NULL)
|
if (dhcp != NULL)
|
||||||
@ -572,7 +576,7 @@ void dhcp_arp_reply(struct netif *netif, struct ip_addr *addr)
|
|||||||
DEBUGF(DHCP_DEBUG, ("dhcp_arp_reply(): CHECKING, arp reply for 0x%08lx", addr->addr));
|
DEBUGF(DHCP_DEBUG, ("dhcp_arp_reply(): CHECKING, arp reply for 0x%08lx", addr->addr));
|
||||||
/* did a host respond with the address we
|
/* did a host respond with the address we
|
||||||
were offered by the DHCP server? */
|
were offered by the DHCP server? */
|
||||||
if (ip_addr_cmp(addr, &dhcp->offered_ip_addr)) {
|
if (ip_addr_cmp(addr, &netif->dhcp->offered_ip_addr)) {
|
||||||
/* we will not accept the offered address */
|
/* we will not accept the offered address */
|
||||||
DEBUGF(DHCP_DEBUG, ("dhcp_arp_reply(): arp reply matched with offered address, declining"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_arp_reply(): arp reply matched with offered address, declining"));
|
||||||
dhcp_decline(netif);
|
dhcp_decline(netif);
|
||||||
@ -595,7 +599,7 @@ static err_t dhcp_decline(struct netif *netif)
|
|||||||
DEBUGF(DHCP_DEBUG, ("dhcp_decline()"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_decline()"));
|
||||||
dhcp_set_state(dhcp, DHCP_BACKING_OFF);
|
dhcp_set_state(dhcp, DHCP_BACKING_OFF);
|
||||||
/* create and initialize the DHCP message header */
|
/* create and initialize the DHCP message header */
|
||||||
result = dhcp_create_request(dhcp);
|
result = dhcp_create_request(netif);
|
||||||
if (result == ERR_OK)
|
if (result == ERR_OK)
|
||||||
{
|
{
|
||||||
dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
|
dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
|
||||||
@ -611,7 +615,7 @@ static err_t dhcp_decline(struct netif *netif)
|
|||||||
udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
|
udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
|
||||||
udp_connect(dhcp->pcb, &dhcp->server_ip_addr, DHCP_SERVER_PORT);
|
udp_connect(dhcp->pcb, &dhcp->server_ip_addr, DHCP_SERVER_PORT);
|
||||||
udp_send(dhcp->pcb, dhcp->p_out);
|
udp_send(dhcp->pcb, dhcp->p_out);
|
||||||
dhcp_delete_request(dhcp);
|
dhcp_delete_request(netif);
|
||||||
}
|
}
|
||||||
dhcp->tries++;
|
dhcp->tries++;
|
||||||
msecs = 10*1000;
|
msecs = 10*1000;
|
||||||
@ -634,7 +638,7 @@ static err_t dhcp_discover(struct netif *netif)
|
|||||||
DEBUGF(DHCP_DEBUG, ("dhcp_discover()"));
|
DEBUGF(DHCP_DEBUG, ("dhcp_discover()"));
|
||||||
ip_addr_set(&dhcp->offered_ip_addr, IP_ADDR_ANY);
|
ip_addr_set(&dhcp->offered_ip_addr, IP_ADDR_ANY);
|
||||||
/* create and initialize the DHCP message header */
|
/* create and initialize the DHCP message header */
|
||||||
result = dhcp_create_request(dhcp);
|
result = dhcp_create_request(netif);
|
||||||
if (result == ERR_OK)
|
if (result == ERR_OK)
|
||||||
{
|
{
|
||||||
dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
|
dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
|
||||||
@ -660,7 +664,7 @@ static err_t dhcp_discover(struct netif *netif)
|
|||||||
udp_send(dhcp->pcb, dhcp->p_out);
|
udp_send(dhcp->pcb, dhcp->p_out);
|
||||||
udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
|
udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
|
||||||
udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
|
udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
|
||||||
dhcp_delete_request(dhcp);
|
dhcp_delete_request(netif);
|
||||||
}
|
}
|
||||||
dhcp->tries++;
|
dhcp->tries++;
|
||||||
msecs = dhcp->tries < 4 ? (dhcp->tries + 1) * 1000 : 10 * 1000;
|
msecs = dhcp->tries < 4 ? (dhcp->tries + 1) * 1000 : 10 * 1000;
|
||||||
@ -700,7 +704,7 @@ static void dhcp_bind(struct netif *netif)
|
|||||||
ip_addr_set(&sn_mask, &dhcp->offered_sn_mask);
|
ip_addr_set(&sn_mask, &dhcp->offered_sn_mask);
|
||||||
|
|
||||||
/* subnet mask not given? */
|
/* subnet mask not given? */
|
||||||
/* TODO: this is not a valid check. what if the network mask is 0??!! */
|
/* TODO: this is not a valid check. what if the network mask is 0? */
|
||||||
if (sn_mask.addr == 0) {
|
if (sn_mask.addr == 0) {
|
||||||
/* choose a safe subnet mask given the network class */
|
/* choose a safe subnet mask given the network class */
|
||||||
u8_t first_octet = ip4_addr1(&sn_mask);
|
u8_t first_octet = ip4_addr1(&sn_mask);
|
||||||
@ -713,7 +717,7 @@ static void dhcp_bind(struct netif *netif)
|
|||||||
/* gateway address not given? */
|
/* gateway address not given? */
|
||||||
if (gw_addr.addr == 0) {
|
if (gw_addr.addr == 0) {
|
||||||
/* copy network address */
|
/* copy network address */
|
||||||
gw_addr.addr = (&dhcp->offered_ip_addr & sn_mask.addr);
|
gw_addr.addr = (dhcp->offered_ip_addr.addr & sn_mask.addr);
|
||||||
/* use first host address on network as gateway */
|
/* use first host address on network as gateway */
|
||||||
gw_addr.addr |= htonl(0x00000001);
|
gw_addr.addr |= htonl(0x00000001);
|
||||||
}
|
}
|
||||||
@ -742,7 +746,7 @@ err_t dhcp_renew(struct netif *netif)
|
|||||||
dhcp_set_state(dhcp, DHCP_RENEWING);
|
dhcp_set_state(dhcp, DHCP_RENEWING);
|
||||||
|
|
||||||
/* create and initialize the DHCP message header */
|
/* create and initialize the DHCP message header */
|
||||||
result = dhcp_create_request(dhcp);
|
result = dhcp_create_request(netif);
|
||||||
if (result == ERR_OK) {
|
if (result == ERR_OK) {
|
||||||
|
|
||||||
dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
|
dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
|
||||||
@ -769,7 +773,7 @@ err_t dhcp_renew(struct netif *netif)
|
|||||||
udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
|
udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
|
||||||
udp_connect(dhcp->pcb, &dhcp->server_ip_addr, DHCP_SERVER_PORT);
|
udp_connect(dhcp->pcb, &dhcp->server_ip_addr, DHCP_SERVER_PORT);
|
||||||
udp_send(dhcp->pcb, dhcp->p_out);
|
udp_send(dhcp->pcb, dhcp->p_out);
|
||||||
dhcp_delete_request(dhcp);
|
dhcp_delete_request(netif);
|
||||||
}
|
}
|
||||||
dhcp->tries++;
|
dhcp->tries++;
|
||||||
/* back-off on retries, but to a maximum of 20 seconds */
|
/* back-off on retries, but to a maximum of 20 seconds */
|
||||||
@ -793,7 +797,7 @@ static err_t dhcp_rebind(struct netif *netif)
|
|||||||
dhcp_set_state(dhcp, DHCP_REBINDING);
|
dhcp_set_state(dhcp, DHCP_REBINDING);
|
||||||
|
|
||||||
/* create and initialize the DHCP message header */
|
/* create and initialize the DHCP message header */
|
||||||
result = dhcp_create_request(dhcp);
|
result = dhcp_create_request(netif);
|
||||||
if (result == ERR_OK)
|
if (result == ERR_OK)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -819,7 +823,7 @@ static err_t dhcp_rebind(struct netif *netif)
|
|||||||
udp_connect(dhcp->pcb, IP_ADDR_BROADCAST, DHCP_SERVER_PORT);
|
udp_connect(dhcp->pcb, IP_ADDR_BROADCAST, DHCP_SERVER_PORT);
|
||||||
udp_send(dhcp->pcb, dhcp->p_out);
|
udp_send(dhcp->pcb, dhcp->p_out);
|
||||||
udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
|
udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
|
||||||
dhcp_delete_request(dhcp);
|
dhcp_delete_request(netif);
|
||||||
}
|
}
|
||||||
dhcp->tries++;
|
dhcp->tries++;
|
||||||
msecs = dhcp->tries < 10 ? dhcp->tries * 1000 : 10 * 1000;
|
msecs = dhcp->tries < 10 ? dhcp->tries * 1000 : 10 * 1000;
|
||||||
@ -843,7 +847,7 @@ static err_t dhcp_release(struct netif *netif)
|
|||||||
dhcp_set_state(dhcp, DHCP_OFF);
|
dhcp_set_state(dhcp, DHCP_OFF);
|
||||||
|
|
||||||
/* create and initialize the DHCP message header */
|
/* create and initialize the DHCP message header */
|
||||||
result = dhcp_create_request(dhcp);
|
result = dhcp_create_request(netif);
|
||||||
if (result == ERR_OK) {
|
if (result == ERR_OK) {
|
||||||
dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
|
dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
|
||||||
dhcp_option_byte(dhcp, DHCP_RELEASE);
|
dhcp_option_byte(dhcp, DHCP_RELEASE);
|
||||||
@ -855,7 +859,7 @@ static err_t dhcp_release(struct netif *netif)
|
|||||||
udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
|
udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
|
||||||
udp_connect(dhcp->pcb, &dhcp->server_ip_addr, DHCP_SERVER_PORT);
|
udp_connect(dhcp->pcb, &dhcp->server_ip_addr, DHCP_SERVER_PORT);
|
||||||
udp_send(dhcp->pcb, dhcp->p_out);
|
udp_send(dhcp->pcb, dhcp->p_out);
|
||||||
dhcp_delete_request(dhcp);
|
dhcp_delete_request(netif);
|
||||||
}
|
}
|
||||||
dhcp->tries++;
|
dhcp->tries++;
|
||||||
msecs = dhcp->tries < 10 ? dhcp->tries * 1000 : 10 * 1000;
|
msecs = dhcp->tries < 10 ? dhcp->tries * 1000 : 10 * 1000;
|
||||||
@ -1090,7 +1094,7 @@ static void dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_
|
|||||||
DEBUGF(DHCP_DEBUG, ("DHCP_ACK received"));
|
DEBUGF(DHCP_DEBUG, ("DHCP_ACK received"));
|
||||||
/* in requesting state? */
|
/* in requesting state? */
|
||||||
if (dhcp->state == DHCP_REQUESTING) {
|
if (dhcp->state == DHCP_REQUESTING) {
|
||||||
dhcp_handle_ack(dhcp);
|
dhcp_handle_ack(netif);
|
||||||
dhcp->request_timeout = 0;
|
dhcp->request_timeout = 0;
|
||||||
#if DHCP_DOES_ARP_CHECK
|
#if DHCP_DOES_ARP_CHECK
|
||||||
/* check if the acknowledged lease address is already in use */
|
/* check if the acknowledged lease address is already in use */
|
||||||
@ -1112,21 +1116,22 @@ static void dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_
|
|||||||
(dhcp->state == DHCP_REBINDING) || (dhcp->state == DHCP_RENEWING ))) {
|
(dhcp->state == DHCP_REBINDING) || (dhcp->state == DHCP_RENEWING ))) {
|
||||||
DEBUGF(DHCP_DEBUG, ("DHCP_NAK received"));
|
DEBUGF(DHCP_DEBUG, ("DHCP_NAK received"));
|
||||||
dhcp->request_timeout = 0;
|
dhcp->request_timeout = 0;
|
||||||
dhcp_handle_nak(dhcp);
|
dhcp_handle_nak(netif);
|
||||||
}
|
}
|
||||||
/* received a DHCP_OFFER in DHCP_SELECTING state? */
|
/* received a DHCP_OFFER in DHCP_SELECTING state? */
|
||||||
else if ((msg_type == DHCP_OFFER) && (dhcp->state == DHCP_SELECTING)) {
|
else if ((msg_type == DHCP_OFFER) && (dhcp->state == DHCP_SELECTING)) {
|
||||||
DEBUGF(DHCP_DEBUG, ("DHCP_OFFER received in DHCP_SELECTING state"));
|
DEBUGF(DHCP_DEBUG, ("DHCP_OFFER received in DHCP_SELECTING state"));
|
||||||
dhcp->request_timeout = 0;
|
dhcp->request_timeout = 0;
|
||||||
/* remember offered lease */
|
/* remember offered lease */
|
||||||
dhcp_handle_offer(dhcp);
|
dhcp_handle_offer(netif);
|
||||||
}
|
}
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static err_t dhcp_create_request(struct dhcp *dhcp)
|
static err_t dhcp_create_request(struct netif *netif)
|
||||||
{
|
{
|
||||||
|
struct dhcp *dhcp = netif->dhcp;
|
||||||
u16_t i;
|
u16_t i;
|
||||||
LWIP_ASSERT("dhcp_create_request: dhcp->p_out == NULL", dhcp->p_out == NULL);
|
LWIP_ASSERT("dhcp_create_request: dhcp->p_out == NULL", dhcp->p_out == NULL);
|
||||||
LWIP_ASSERT("dhcp_create_request: dhcp->msg_out == NULL", dhcp->msg_out == NULL);
|
LWIP_ASSERT("dhcp_create_request: dhcp->msg_out == NULL", dhcp->msg_out == NULL);
|
||||||
@ -1166,8 +1171,9 @@ static err_t dhcp_create_request(struct dhcp *dhcp)
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dhcp_delete_request(struct dhcp *dhcp)
|
static void dhcp_delete_request(struct netif *netif)
|
||||||
{
|
{
|
||||||
|
struct dhcp *dhcp = netif->dhcp;
|
||||||
LWIP_ASSERT("dhcp_free_msg: dhcp->p_out != NULL", dhcp->p_out != NULL);
|
LWIP_ASSERT("dhcp_free_msg: dhcp->p_out != NULL", dhcp->p_out != NULL);
|
||||||
LWIP_ASSERT("dhcp_free_msg: dhcp->msg_out != NULL", dhcp->msg_out != NULL);
|
LWIP_ASSERT("dhcp_free_msg: dhcp->msg_out != NULL", dhcp->msg_out != NULL);
|
||||||
pbuf_free(dhcp->p_out);
|
pbuf_free(dhcp->p_out);
|
||||||
|
@ -32,208 +32,86 @@
|
|||||||
#ifndef __LWIP_DEBUG_H__
|
#ifndef __LWIP_DEBUG_H__
|
||||||
#define __LWIP_DEBUG_H__
|
#define __LWIP_DEBUG_H__
|
||||||
|
|
||||||
#include "lwipopts.h"
|
#include "arch/cc.h"
|
||||||
|
|
||||||
#ifdef LWIP_DEBUG
|
/** lower two bits indicate debug level
|
||||||
|
* - 0 off
|
||||||
|
* - 1 warning
|
||||||
|
* - 2 serious
|
||||||
|
* - 3 severe
|
||||||
|
*/
|
||||||
|
#define DBG_MASK_LEVEL 3
|
||||||
|
|
||||||
|
/** print only debug messages with this level or higher */
|
||||||
|
#define DBG_MIN_LEVEL 0
|
||||||
|
|
||||||
|
/** flag for DEBUGF to enable the debug message */
|
||||||
|
#define DBG_ON 0x80U
|
||||||
|
/** flag for DEBUGF to disable the debug message */
|
||||||
|
#define DBG_OFF 0x00U
|
||||||
|
|
||||||
|
/** flag for DEBUGF to indicate it is a tracing message (to follow program flow) */
|
||||||
|
#define DBG_TRACE 0x40
|
||||||
|
/** flag for DEBUGF to indicate it is a state debug message (to follow states) */
|
||||||
|
#define DBG_STATE 0x20
|
||||||
|
/** flag for DEBUGF that indicates newly added code, not thoroughly tested yet */
|
||||||
|
#define DBG_FRESH 0x10
|
||||||
|
/** flag for DEBUGF to halt after printing this debug message */
|
||||||
|
#define DBG_HALT 0x08
|
||||||
|
|
||||||
#define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0)
|
#define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0)
|
||||||
#define DEBUGF(debug, x) do { if(debug) LWIP_PLATFORM_DIAG(x); } while(0)
|
/** print debug message only if debug message is enabled AND is of correct type
|
||||||
|
* AND is at least DBG_LEVEL */
|
||||||
|
#define DEBUGF(debug, x) do { if ((debug & DBG_ON) && (debug & DBG_TYPES_ON) && ((debug & DBG_MASK_LEVEL) >= DBG_MIN_LEVEL)) { LWIP_PLATFORM_DIAG(x); if (debug & DBG_HALT) while(1); } } while(0)
|
||||||
#define LWIP_ERROR(x) do { LWIP_PLATFORM_DIAG(x); } while(0)
|
#define LWIP_ERROR(x) do { LWIP_PLATFORM_DIAG(x); } while(0)
|
||||||
|
|
||||||
/* These defines control the amount of debugging output: */
|
#ifndef LWIP_DEBUG
|
||||||
#define MEM_TRACKING
|
|
||||||
|
|
||||||
#ifndef DEMO_DEBUG
|
|
||||||
#define DEMO_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ETHARP_DEBUG
|
|
||||||
#define ETHARP_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NETIF_DEBUG
|
|
||||||
#define NETIF_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PBUF_DEBUG
|
|
||||||
#define PBUF_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DELIF_DEBUG
|
|
||||||
#define DELIF_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DROPIF_DEBUG
|
|
||||||
#define DROPIF_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TUNIF_DEBUG
|
|
||||||
#define TUNIF_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef UNIXIF_DEBUG
|
|
||||||
#define UNIXIF_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TAPIF_DEBUG
|
|
||||||
#define TAPIF_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SIO_FIFO_DEBUG
|
|
||||||
#define SIO_FIFO_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SLIP_DEBUG
|
|
||||||
#define SLIP_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PPP_DEBUG
|
|
||||||
#define PPP_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef API_LIB_DEBUG
|
|
||||||
#define API_LIB_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef API_MSG_DEBUG
|
|
||||||
#define API_MSG_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SOCKETS_DEBUG
|
|
||||||
#define SOCKETS_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ICMP_DEBUG
|
|
||||||
#define ICMP_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef INET_DEBUG
|
|
||||||
#define INET_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef IP_DEBUG
|
|
||||||
#define IP_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef IP_REASS_DEBUG
|
|
||||||
#define IP_REASS_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef MEM_DEBUG
|
|
||||||
#define MEM_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef MEMP_DEBUG
|
|
||||||
#define MEMP_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SYS_DEBUG
|
|
||||||
#define SYS_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TCP_DEBUG
|
|
||||||
#define TCP_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TCP_INPUT_DEBUG
|
|
||||||
#define TCP_INPUT_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TCP_FR_DEBUG
|
|
||||||
#define TCP_FR_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TCP_RTO_DEBUG
|
|
||||||
#define TCP_RTO_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TCP_REXMIT_DEBUG
|
|
||||||
#define TCP_REXMIT_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TCP_CWND_DEBUG
|
|
||||||
#define TCP_CWND_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TCP_WND_DEBUG
|
|
||||||
#define TCP_WND_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TCP_OUTPUT_DEBUG
|
|
||||||
#define TCP_OUTPUT_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TCP_RST_DEBUG
|
|
||||||
#define TCP_RST_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TCP_QLEN_DEBUG
|
|
||||||
#define TCP_QLEN_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef UDP_DEBUG
|
|
||||||
#define UDP_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TCPIP_DEBUG
|
|
||||||
#define TCPIP_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TCPDUMP_DEBUG
|
|
||||||
#define TCPDUMP_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DHCP_DEBUG
|
|
||||||
#define DHCP_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#else /* LWIP_DEBUG */
|
|
||||||
|
|
||||||
/* DEBUG is not defined, so we define null macros for LWIP_ASSERT , DEBUGF and LWIP_ERROR */
|
|
||||||
|
|
||||||
#define LWIP_ASSERT(x,y)
|
#define LWIP_ASSERT(x,y)
|
||||||
#define DEBUGF(debug, x)
|
#define DEBUGF(debug, x)
|
||||||
#define LWIP_ERROR(x)
|
#define LWIP_ERROR(x)
|
||||||
|
|
||||||
/* And we define those to be zero: */
|
|
||||||
|
|
||||||
#define DEMO_DEBUG 0
|
#define DBG_TYPES_ON 0U
|
||||||
#define ETHARP_DEBUG 0
|
|
||||||
#define NETIF_DEBUG 0
|
/**
|
||||||
#define PBUF_DEBUG 0
|
* Disable all debug messages
|
||||||
#define DELIF_DEBUG 0
|
*/
|
||||||
#define DROPIF_DEBUG 0
|
#define DEMO_DEBUG DBG_OFF
|
||||||
#define TUNIF_DEBUG 0
|
#define ETHARP_DEBUG DBG_OFF
|
||||||
#define UNIXIF_DEBUG 0
|
#define NETIF_DEBUG DBG_OFF
|
||||||
#define TAPIF_DEBUG 0
|
#define PBUF_DEBUG DBG_OFF
|
||||||
#define SIO_FIFO_DEBUG 0
|
#define DELIF_DEBUG DBG_OFF
|
||||||
#define PPP_DEBUG 0
|
#define DROPIF_DEBUG DBG_OFF
|
||||||
#define API_LIB_DEBUG 0
|
#define TUNIF_DEBUG DBG_OFF
|
||||||
#define API_MSG_DEBUG 0
|
#define UNIXIF_DEBUG DBG_OFF
|
||||||
#define SOCKETS_DEBUG 0
|
#define TAPIF_DEBUG DBG_OFF
|
||||||
#define ICMP_DEBUG 0
|
#define SIO_FIFO_DEBUG DBG_OFF
|
||||||
#define INET_DEBUG 0
|
#define PPP_DEBUG DBG_OFF
|
||||||
#define IP_DEBUG 0
|
#define API_LIB_DEBUG DBG_OFF
|
||||||
#define IP_REASS_DEBUG 0
|
#define API_MSG_DEBUG DBG_OFF
|
||||||
#define MEM_DEBUG 0
|
#define SOCKETS_DEBUG DBG_OFF
|
||||||
#define MEMP_DEBUG 0
|
#define ICMP_DEBUG DBG_OFF
|
||||||
#define SYS_DEBUG 0
|
#define INET_DEBUG DBG_OFF
|
||||||
#define TCP_DEBUG 0
|
#define IP_DEBUG DBG_OFF
|
||||||
#define TCP_INPUT_DEBUG 0
|
#define IP_REASS_DEBUG DBG_OFF
|
||||||
#define TCP_FR_DEBUG 0
|
#define MEM_DEBUG DBG_OFF
|
||||||
#define TCP_RTO_DEBUG 0
|
#define MEMP_DEBUG DBG_OFF
|
||||||
#define TCP_REXMIT_DEBUG 0
|
#define SYS_DEBUG DBG_OFF
|
||||||
#define TCP_CWND_DEBUG 0
|
#define TCP_DEBUG DBG_OFF
|
||||||
#define TCP_WND_DEBUG 0
|
#define TCP_INPUT_DEBUG DBG_OFF
|
||||||
#define TCP_OUTPUT_DEBUG 0
|
#define TCP_FR_DEBUG DBG_OFF
|
||||||
#define TCP_RST_DEBUG 0
|
#define TCP_RTO_DEBUG DBG_OFF
|
||||||
#define TCP_QLEN_DEBUG 0
|
#define TCP_REXMIT_DEBUG DBG_OFF
|
||||||
#define UDP_DEBUG 0
|
#define TCP_CWND_DEBUG DBG_OFF
|
||||||
#define TCPIP_DEBUG 0
|
#define TCP_WND_DEBUG DBG_OFF
|
||||||
#define TCPDUMP_DEBUG 0
|
#define TCP_OUTPUT_DEBUG DBG_OFF
|
||||||
#define DHCP_DEBUG 0
|
#define TCP_RST_DEBUG DBG_OFF
|
||||||
|
#define TCP_QLEN_DEBUG DBG_OFF
|
||||||
|
#define UDP_DEBUG DBG_OFF
|
||||||
|
#define TCPIP_DEBUG DBG_OFF
|
||||||
|
#define TCPDUMP_DEBUG DBG_OFF
|
||||||
|
#define DHCP_DEBUG DBG_OFF
|
||||||
|
|
||||||
#endif /* LWIP_DEBUG */
|
#endif /* LWIP_DEBUG */
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ PACK_STRUCT_END
|
|||||||
/** initialize DHCP client */
|
/** initialize DHCP client */
|
||||||
void dhcp_init(void);
|
void dhcp_init(void);
|
||||||
/** start DHCP configuration */
|
/** start DHCP configuration */
|
||||||
struct dhcp_state *dhcp_start(struct netif *netif);
|
err_t dhcp_start(struct netif *netif);
|
||||||
/** stop DHCP configuration */
|
/** stop DHCP configuration */
|
||||||
void dhcp_stop(struct netif *netif);
|
void dhcp_stop(struct netif *netif);
|
||||||
/** enforce lease renewal */
|
/** enforce lease renewal */
|
||||||
|
@ -50,13 +50,13 @@
|
|||||||
/** whether the network interface is 'up'. this is
|
/** whether the network interface is 'up'. this is
|
||||||
* a software flag used to control whether this network
|
* a software flag used to control whether this network
|
||||||
* interface is enabled and processes traffic */
|
* interface is enabled and processes traffic */
|
||||||
#define NETIF_FLAG_UP 1
|
#define NETIF_FLAG_UP 1U
|
||||||
/** if set, the netif has broadcast capability */
|
/** if set, the netif has broadcast capability */
|
||||||
#define NETIF_FLAG_BROADCAST 2
|
#define NETIF_FLAG_BROADCAST 2U
|
||||||
/** if set, the netif is one end of a point-to-point connection */
|
/** if set, the netif is one end of a point-to-point connection */
|
||||||
#define NETIF_FLAG_POINTTOPOINT 4
|
#define NETIF_FLAG_POINTTOPOINT 4U
|
||||||
/** if set, the interface is configured using DHCP */
|
/** if set, the interface is configured using DHCP */
|
||||||
#define NETIF_FLAG_DHCP 8
|
#define NETIF_FLAG_DHCP 8U
|
||||||
|
|
||||||
/** generic data structure used for all lwIP network interfaces */
|
/** generic data structure used for all lwIP network interfaces */
|
||||||
struct netif {
|
struct netif {
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
* Address Resolution Protocol module for IP over Ethernet
|
* Address Resolution Protocol module for IP over Ethernet
|
||||||
*
|
*
|
||||||
* $Log: etharp.c,v $
|
* $Log: etharp.c,v $
|
||||||
|
* Revision 1.26 2003/02/20 13:13:56 likewise
|
||||||
|
* Fixed some issues open after merging 'leon-dhcp'. Added new debugging.
|
||||||
|
*
|
||||||
* Revision 1.25 2003/02/20 08:42:04 likewise
|
* Revision 1.25 2003/02/20 08:42:04 likewise
|
||||||
* Merged with leon-dhcp branch. Tagged as POST_leon-dhcp afterwards.
|
* Merged with leon-dhcp branch. Tagged as POST_leon-dhcp afterwards.
|
||||||
*
|
*
|
||||||
@ -539,7 +542,7 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
|
|||||||
DEBUGF(ETHARP_DEBUG, ("etharp_arp_input: incoming ARP reply\n"));
|
DEBUGF(ETHARP_DEBUG, ("etharp_arp_input: incoming ARP reply\n"));
|
||||||
#if (LWIP_DHCP && DHCP_DOES_ARP_CHECK)
|
#if (LWIP_DHCP && DHCP_DOES_ARP_CHECK)
|
||||||
/* DHCP needs to know about ARP replies */
|
/* DHCP needs to know about ARP replies */
|
||||||
dhcp_arp_reply(struct netif *netif, &hdr->sipaddr);
|
dhcp_arp_reply(netif, &hdr->sipaddr);
|
||||||
#endif
|
#endif
|
||||||
/* ARP reply directed to us? */
|
/* ARP reply directed to us? */
|
||||||
if(ip_addr_cmp(&(hdr->dipaddr), &(netif->ip_addr))) {
|
if(ip_addr_cmp(&(hdr->dipaddr), &(netif->ip_addr))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user