More length-related fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@370 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
c48d0935a1
commit
77119d8359
@ -287,10 +287,10 @@ void uip_arp_timer(void)
|
|||||||
#if 0
|
#if 0
|
||||||
void uip_arp_ipin(void)
|
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
|
/* 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))
|
if ((IPBUF->eh_srcipaddr & dev->d_netmask) != (dev->d_ipaddr & dev->d_netmask))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -324,7 +324,7 @@ void uip_arp_ipin(void)
|
|||||||
void uip_arp_arpin(struct uip_driver_s *dev)
|
void uip_arp_arpin(struct uip_driver_s *dev)
|
||||||
{
|
{
|
||||||
in_addr_t ipaddr;
|
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;
|
dev->d_len = 0;
|
||||||
return;
|
return;
|
||||||
@ -359,9 +359,10 @@ void uip_arp_arpin(struct uip_driver_s *dev)
|
|||||||
ARPBUF->ah_dipaddr[1] = ARPBUF->ah_sipaddr[1];
|
ARPBUF->ah_dipaddr[1] = ARPBUF->ah_sipaddr[1];
|
||||||
ARPBUF->ah_sipaddr[0] = dev->d_ipaddr >> 16;
|
ARPBUF->ah_sipaddr[0] = dev->d_ipaddr >> 16;
|
||||||
ARPBUF->ah_sipaddr[1] = dev->d_ipaddr & 0xffff;
|
ARPBUF->ah_sipaddr[1] = dev->d_ipaddr & 0xffff;
|
||||||
|
uip_arp_dump(ARPBUF);
|
||||||
|
|
||||||
ETHBUF->type = HTONS(UIP_ETHTYPE_ARP);
|
ETHBUF->type = HTONS(UIP_ETHTYPE_ARP);
|
||||||
dev->d_len = sizeof(struct arp_hdr);
|
dev->d_len = sizeof(struct arp_hdr) + UIP_LLH_LEN;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user