Subject: Re: [PATCH net-next-2.6] bonding: allow arp_ip_targets to be on a separate vlan from bond device

From: Eric Dumazet <[email-masked]>
Date: Mon, 07 Dec 2009 19:24:57 +0100

Andy Gospodarek a écrit :

>> Jay,
>>
>> The issue was that that orig_dev was getting set to the active slave, so
>> your running tcpdump on the active slave made the conditional inside
>> this loop:
>>
>>         list_for_each_entry_rcu(ptype, &ptype_all, list) {
>>                 if (ptype->dev == null_or_orig || ptype->dev == skb->dev ||
>>                     ptype->dev == orig_dev) {
>>                         if (pt_prev)
>>                                 ret = deliver_skb(skb, pt_prev, orig_dev);
>>                         pt_prev = ptype;
>>                 }
>>         }
>>
>> hit and deliver_skb was being called for all traffic coming toward
>> bond0.<vid>.  I'm not completely happy with this solutoin, but I think
>> it resolves both the original problem I was trying to solve and the
>> regression you discovered with your original patch.  Let me know if you
>> see everything working now like I do.
>>
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> index 726bd75..b1e3b2f 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
>> @@ -2697,6 +2697,19 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
>>  	bond = netdev_priv(dev);
>>  	read_lock(&bond->lock);
>>  
>> +	/*
>> +	 * We may have dev passed in as a vlan device, so make sure to get to the
>> +	 * core netdev before continuing.
>> +	 */
>> +	if (dev->priv_flags & IFF_802_1Q_VLAN) {
>> +		dev = vlan_dev_real_dev(dev);
>> +		/*
>> +		 * Don't necessarily trust passed in orig_dev since vlan accelerated
>> +		 * netdevs and bonding don't play well together.
>> +		 */
>> +		orig_dev = __dev_get_by_index(dev_net(skb->dev),skb->skb_iif);
>> +	}
>> +

> 
> Any thoughts on the updated patch, Jay?

Unfortunately you still use __dev_get_by_index()
in a non safe context.