431 |
etharp_ip_input(struct netif *netif, struct pbuf *p) |
etharp_ip_input(struct netif *netif, struct pbuf *p) |
432 |
{ |
{ |
433 |
struct ethip_hdr *hdr; |
struct ethip_hdr *hdr; |
434 |
|
LWIP_ASSERT("netif != NULL", netif != NULL); |
435 |
/* Only insert an entry if the source IP address of the |
/* Only insert an entry if the source IP address of the |
436 |
incoming IP packet comes from a host on the local network. */ |
incoming IP packet comes from a host on the local network. */ |
437 |
hdr = p->payload; |
hdr = p->payload; |
473 |
u8_t i; |
u8_t i; |
474 |
u8_t for_us; |
u8_t for_us; |
475 |
|
|
476 |
|
LWIP_ASSERT("netif != NULL", netif != NULL); |
477 |
|
|
478 |
/* drop short ARP packets */ |
/* drop short ARP packets */ |
479 |
if (p->tot_len < sizeof(struct etharp_hdr)) { |
if (p->tot_len < sizeof(struct etharp_hdr)) { |
480 |
LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE | 1, ("etharp_arp_input: packet dropped, too short (%d/%d)\n", p->tot_len, sizeof(struct etharp_hdr))); |
LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE | 1, ("etharp_arp_input: packet dropped, too short (%d/%d)\n", p->tot_len, sizeof(struct etharp_hdr))); |
556 |
/* ARP reply. We already updated the ARP cache earlier. */ |
/* ARP reply. We already updated the ARP cache earlier. */ |
557 |
LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: incoming ARP reply\n")); |
LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: incoming ARP reply\n")); |
558 |
#if (LWIP_DHCP && DHCP_DOES_ARP_CHECK) |
#if (LWIP_DHCP && DHCP_DOES_ARP_CHECK) |
559 |
/* When unconfigured, DHCP wants to know about ARP replies from the |
/* DHCP wants to know about ARP replies from any host with an |
560 |
* address offered to us, as that means someone else uses it already! */ |
* IP address also offered to us by the DHCP server. We do not |
561 |
if (netif->ip_addr.addr == 0) dhcp_arp_reply(netif, &sipaddr); |
* want to take a duplicate IP address on a single network. |
562 |
|
* @todo How should we handle redundant (fail-over) interfaces? |
563 |
|
* */ |
564 |
|
dhcp_arp_reply(netif, &sipaddr); |
565 |
#endif |
#endif |
566 |
break; |
break; |
567 |
default: |
default: |