bitkeeper revision 1.1159.68.2 (41383cdfHn8bdXUvTO9mrnc7pCTLGA)

Send a fake ARP packet when a vif comes up, to let switches
see the MAC address.
This commit is contained in:
mjw@wray-m-3.hpl.hp.com committed 2004-09-03 09:43:59 +00:00
1 parent 4226bdfec7
commit 032af4d946
1 file changed
+30
@@ -26,6 +26,9 @@
#include <asm-xen/hypervisor-ifs/io/netif.h>
#include <asm/page.h>
#include <net/arp.h>
#include <net/route.h>
#if 0
#define DPRINTK(fmt, args...) \
printk(KERN_INFO "[XEN] %s" fmt, __FUNCTION__, ##args)
@@ -171,6 +174,32 @@ static int netctrl_connected_count(void)
return connected;
}
/** Send a packet on a net device to encourage switches to learn the
* MAC. We send a fake ARP request.
*
* @param dev device
* @return 0 on success, error code otherwise
*/
static int vif_wake(struct net_device *dev){
int err = 0;
struct sk_buff *skb;
u32 src_ip;
u32 dst_ip = INADDR_BROADCAST;
unsigned char dst_hw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
src_ip = inet_select_addr(dev, dst_ip, RT_SCOPE_LINK);
skb = arp_create(ARPOP_REQUEST, ETH_P_ARP,
dst_ip, dev, src_ip,
dst_hw, dev->dev_addr, NULL);
if(skb == NULL){
err = -ENOMEM;
goto exit;
}
err = dev_queue_xmit(skb);
exit:
return err;
}
static inline struct sk_buff *alloc_skb_page(void)
{
struct sk_buff *skb;
@@ -739,6 +768,7 @@ static void netif_status_change(netif_fe_interface_status_changed_t *status)
(void)request_irq(np->irq, netif_int, SA_SAMPLE_RANDOM,
dev->name, dev);
netctrl_connected_count();
vif_wake(dev);
break;
default:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.