Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions net/arp/arp_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,13 @@ int arp_send(in_addr_t ipaddr)
{
/* ARP request for the same destination is in progress, directly
* wait arp response notify.
*
* Drop the device lock: this path skips the netdev_unlock()
* below, and the receive path needs that same lock to deliver
* the reply. The waiter above is already installed.
*/

netdev_unlock(dev);
goto wait;
}

Expand Down
16 changes: 14 additions & 2 deletions net/arp/arp_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@

struct arp_table_info_s
{
in_addr_t ai_ipaddr; /* IP address for lookup */
FAR uint8_t *ai_ethaddr; /* Location to return the MAC address */
in_addr_t ai_ipaddr; /* IP address for lookup */
FAR uint8_t *ai_ethaddr; /* Location to return the MAC address */
FAR struct net_driver_s *ai_dev; /* The device the frame will be sent on */
};

/****************************************************************************
Expand Down Expand Up @@ -117,6 +118,16 @@ static int arp_match(FAR struct net_driver_s *dev, FAR void *arg)
{
FAR struct arp_table_info_s *info = arg;

/* Only the egress device may answer for its own address. Otherwise a
* frame sent on one interface takes the MAC of another that happens to
* hold the address, which breaks setups sharing a subnet.
*/

if (info->ai_dev != NULL && dev != info->ai_dev)
{
return 0;
}

/* Make sure that this is an Ethernet device (or an IEEE 802.11 device
* which is also Ethernet)
*/
Expand Down Expand Up @@ -529,6 +540,7 @@ int arp_find(in_addr_t ipaddr, FAR uint8_t *ethaddr,

info.ai_ipaddr = ipaddr;
info.ai_ethaddr = ethaddr;
info.ai_dev = dev;

if (netdev_foreach(arp_match, &info) != 0)
{
Expand Down
Loading