 read_lock_bh(&ipv6_sk_mc_lock); for (mc_lst=np->ipv6_mc_list; mc_lst; mc_lst=mc_lst->next) { if ((ifindex == 0 || mc_lst->ifindex == ifindex) && ipv6_addr_equal(&mc_lst->addr, addr)) { read_unlock_bh(&ipv6_sk_mc_lock); return -EADDRINUSE; } } read_unlock_bh(&ipv6_sk_mc_lock); 
int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr){	struct net_device *dev = NULL;	struct ipv6_mc_socklist *mc_lst;	struct ipv6_pinfo *np = inet6_sk(sk);	int err;	if (!ipv6_addr_is_multicast(addr))		return -EINVAL;	mc_lst = sock_kmalloc(sk, sizeof(struct ipv6_mc_socklist), GFP_KERNEL);	if (mc_lst == NULL)		return -ENOMEM;	mc_lst->next = NULL;	ipv6_addr_copy(&mc_lst->addr, addr);	if (ifindex == 0) {		struct rt6_info *rt;		rt = rt6_lookup(addr, NULL, 0, 0);		if (rt) {			dev = rt->rt6i_dev;			dev_hold(dev);			dst_release(&rt->u.dst);		}	} else		dev = dev_get_by_index(ifindex);	if (dev == NULL) {		sock_kfree_s(sk, mc_lst, sizeof(*mc_lst));		return -ENODEV;	}	mc_lst->ifindex = dev->ifindex;	mc_lst->sfmode = MCAST_EXCLUDE;	mc_lst->sflist = NULL;	/*	 *	now add/increase the group membership on the device	 */	err = ipv6_dev_mc_inc(dev, addr);	if (err) {		sock_kfree_s(sk, mc_lst, sizeof(*mc_lst));		dev_put(dev);		return err;	}	write_lock_bh(&ipv6_sk_mc_lock);	mc_lst->next = np->ipv6_mc_list;	np->ipv6_mc_list = mc_lst;	write_unlock_bh(&ipv6_sk_mc_lock);	dev_put(dev);	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/c9e3e8b6958e02230079e6817862ea2968509866/mcast.c/clean/net/ipv6/mcast.c