From 77119d8359c03821a2ee6d9c9aeaeed8557f70af Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 5 Nov 2007 01:06:28 +0000 Subject: [PATCH] More length-related fixes git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@370 42af7a65-404d-4744-a932-0658087f49c3 --- net/uip/uip-arp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/net/uip/uip-arp.c b/net/uip/uip-arp.c index 7a0498c22b..9a82943fa3 100644 --- a/net/uip/uip-arp.c +++ b/net/uip/uip-arp.c @@ -287,10 +287,10 @@ void uip_arp_timer(void) #if 0 void uip_arp_ipin(void) { - dev->d_len -= sizeof(struct uip_eth_hdr); - /* Only insert/update an entry if the source IP address of the - incoming IP packet comes from a host on the local network. */ + * incoming IP packet comes from a host on the local network. + */ + if ((IPBUF->eh_srcipaddr & dev->d_netmask) != (dev->d_ipaddr & dev->d_netmask)) { return; @@ -324,7 +324,7 @@ void uip_arp_ipin(void) void uip_arp_arpin(struct uip_driver_s *dev) { in_addr_t ipaddr; - if (dev->d_len < sizeof(struct arp_hdr)) + if (dev->d_len < (sizeof(struct arp_hdr) + UIP_LLH_LEN)) { dev->d_len = 0; return; @@ -359,9 +359,10 @@ void uip_arp_arpin(struct uip_driver_s *dev) ARPBUF->ah_dipaddr[1] = ARPBUF->ah_sipaddr[1]; ARPBUF->ah_sipaddr[0] = dev->d_ipaddr >> 16; ARPBUF->ah_sipaddr[1] = dev->d_ipaddr & 0xffff; + uip_arp_dump(ARPBUF); ETHBUF->type = HTONS(UIP_ETHTYPE_ARP); - dev->d_len = sizeof(struct arp_hdr); + dev->d_len = sizeof(struct arp_hdr) + UIP_LLH_LEN; } break;