diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-11-25 20:32:51 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-11-25 20:32:51 +0000 |
commit | bc2bd8db0a30ec061da8bbe6f2cb66ba1f18823a (patch) | |
tree | 9e87c53b7243b0242a04eccdae348d119e0032dd /nuttx/net/uip | |
parent | 4868b089980d89f0704b230a11508ae74b0e2601 (diff) | |
download | px4-nuttx-bc2bd8db0a30ec061da8bbe6f2cb66ba1f18823a.tar.gz px4-nuttx-bc2bd8db0a30ec061da8bbe6f2cb66ba1f18823a.tar.bz2 px4-nuttx-bc2bd8db0a30ec061da8bbe6f2cb66ba1f18823a.zip |
Restore uip_arp_ipin()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3131 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/uip')
-rw-r--r-- | nuttx/net/uip/uip_arp.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/nuttx/net/uip/uip_arp.c b/nuttx/net/uip/uip_arp.c index 270bddd64..90f1ef2d3 100644 --- a/nuttx/net/uip/uip_arp.c +++ b/nuttx/net/uip/uip_arp.c @@ -176,6 +176,34 @@ static void uip_arp_dump(struct arp_hdr *arp) * Public Functions ****************************************************************************/ +/* ARP processing for incoming IP packets + * + * This function should be called by the device driver when an IP packet has + * been received. The function will check if the address is in the ARP cache, + * and if so the ARP cache entry will be refreshed. If no ARP cache entry was + * found, a new one is created. + * + * This function expects an IP packet with a prepended Ethernet header in the + * d_buf[] buffer, and the length of the packet in the variable d_len. + */ + +#ifdef CONFIG_NET_ARP_IPIN +void uip_arp_ipin(void) +{ + in_addr_t srcipaddr; + + /* Only insert/update an entry if the source IP address of the incoming IP + * packet comes from a host on the local network. + */ + + srcipaddr = uip_ip4addr_conv(IPBUF->srcipaddr); + if (!uip_ipaddr_maskcmp(ipaddr, dev->d_ipaddr, dev->d_netmask)) + { + uip_arp_update(IPBUF->srcipaddr, ETHBUF->src); + } +} +#endif /* CONFIG_NET_ARP_IPIN */ + /* ARP processing for incoming ARP packets. * * This function should be called by the device driver when an ARP @@ -194,7 +222,7 @@ static void uip_arp_dump(struct arp_hdr *arp) * * This function expects an ARP packet with a prepended Ethernet * header in the d_buf[] buffer, and the length of the packet in the - * global variable d_len. + * variable d_len. */ void uip_arp_arpin(struct uip_driver_s *dev) |