mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 07:45:16 +08:00
net/arp: add link layer check for arp_out/arp_ipin
ARP support is only built if the Ethernet link layer is supported. Continue and send the ARP request only if this device uses the Ethernet link layer protocol. Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
@@ -76,6 +76,17 @@ void arp_ipin(FAR struct net_driver_s *dev)
|
|||||||
{
|
{
|
||||||
in_addr_t srcipaddr;
|
in_addr_t srcipaddr;
|
||||||
|
|
||||||
|
/* ARP support is only built if the Ethernet link layer is supported.
|
||||||
|
* Continue and send the ARP request only if this device uses the
|
||||||
|
* Ethernet link layer protocol.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (dev->d_lltype != NET_LL_ETHERNET &&
|
||||||
|
dev->d_lltype != NET_LL_IEEE80211)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Only insert/update an entry if the source IP address of the incoming IP
|
/* Only insert/update an entry if the source IP address of the incoming IP
|
||||||
* packet comes from a host on the local network.
|
* packet comes from a host on the local network.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -137,6 +137,17 @@ void arp_out(FAR struct net_driver_s *dev)
|
|||||||
in_addr_t destipaddr;
|
in_addr_t destipaddr;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/* ARP support is only built if the Ethernet link layer is supported.
|
||||||
|
* Continue and send the ARP request only if this device uses the
|
||||||
|
* Ethernet link layer protocol.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (dev->d_lltype != NET_LL_ETHERNET &&
|
||||||
|
dev->d_lltype != NET_LL_IEEE80211)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_NET_PKT) || defined(CONFIG_NET_ARP_SEND)
|
#if defined(CONFIG_NET_PKT) || defined(CONFIG_NET_ARP_SEND)
|
||||||
/* Skip sending ARP requests when the frame to be transmitted was
|
/* Skip sending ARP requests when the frame to be transmitted was
|
||||||
* written into a packet socket.
|
* written into a packet socket.
|
||||||
|
|||||||
Reference in New Issue
Block a user