Re: [PATCH] introducing new net device feature NETIF_F_MC_ALL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looks mostly fine Frank.

But why don't we save you some work, we have the IP address
handy therefore it's kind of silly for you to have to look
it up again.

Let's create a new netdev callback, something like:

	void (*mc_change)(struct netdev *dev, void *addr, int family, int add);

Then net/ipv4/igmp.c can do something like:

static void ip_mc_filter_add(struct in_device *in_dev, u32 addr)
{
	char buf[MAX_ADDR_LEN];
	struct net_device *dev = in_dev->dev;

	/* Checking for IFF_MULTICAST here is WRONG-WRONG-WRONG.
	   We will get multicast token leakage, when IFF_MULTICAST
	   is changed. This check should be done in dev->set_multicast_list
	   routine. Something sort of:
	   if (dev->mc_list && dev->flags&IFF_MULTICAST) { do it; }
	   --ANK
	   */
	if (arp_mc_map(addr, buf, dev, 0) == 0) {
		dev_mc_add(dev,buf,dev->addr_len,0);
		if (dev->mc_change)
			dev->mc_change(dev, &addr, AF_INET, 1);
	}
}

static void ip_mc_filter_del(struct in_device *in_dev, u32 addr)
{
	char buf[MAX_ADDR_LEN];
	struct net_device *dev = in_dev->dev;

	if (arp_mc_map(addr, buf, dev, 0) == 0) {
		dev_mc_delete(dev,buf,dev->addr_len,0);
		if (dev->mc_change)
			dev->mc_change(dev, &addr, AF_INET, 0);
	}
}

And similarly for the other dev_mc_{add,delete}() call sites.
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux