[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150222.011109.109641758308879034.davem@davemloft.net>
Date: Sun, 22 Feb 2015 01:11:09 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: sfeldma@...il.com
CC: netdev@...r.kernel.org
Subject: ARP resolving for switch drivers
Scott I looked into the current state of affairs and you should
be able to use generic infrastructure to resolve a neighbour
entry and even trigger the state machine.
For ipv4:
n = __ipv4_neigh_lookup(dev, ip_addr);
if (!n)
n = neigh_create(&arp_tbl, &ip_addr, dev, true);
if (!n)
goto error;
if (!(n->nud_state & NUD_VALID))
neigh_event_send(n, NULL);
else
memcpy(&hw_entry->mac_addr, n->ha, dev_addr_len);
If you have to take the neigh_event_send() path, you have to wait for
the notifier to be invoked. And in the notifier you can fetch the
MAC address.
You shouldn't have to hand craft ARP requests and listen for responses
or anything like that.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists