Subject: Re: VLAN packets silently dropped in promiscuous mode

From: Patrick McHardy <[email-masked]>
Date: Thu, 30 Sep 2010 12:50:26 +0200

On 30.09.2010 12:40, Eric Dumazet wrote:
> Le jeudi 30 septembre 2010 à 11:55 +0200, Eric Dumazet a écrit :
>> Le jeudi 30 septembre 2010 à 11:16 +0200, Eric Dumazet a écrit :
>>
>>> Agreed
>>>
>>> Could you try following patch, based on net-next-2.6 ?
>>
>> Here is the official patch I cooked for net-2.6 (linux-2.6)
>>
>> I tested it successfully with a tg3 NIC.
>>
>> Thanks
>>
>> [PATCH] vlan: dont drop packets from unknown vlans in promiscuous mode
>>
>> Roger Luethi noticed packets for unknown VLANs getting silently dropped
>> even in promiscuous mode.
>>
>> Check for promiscuous mode in __vlan_hwaccel_rx() and vlan_gro_common()
>> before drops.
>>
>> Reported-by: Roger Luethi <[email-masked]>
>> Signed-off-by: Eric Dumazet <[email-masked]>
>> ---
>>  net/8021q/vlan_core.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
>> index 01ddb04..ba502b4 100644
>> --- a/net/8021q/vlan_core.c
>> +++ b/net/8021q/vlan_core.c
>> @@ -24,7 +24,7 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
>>  
>>  	if (vlan_dev)
>>  		skb->dev = vlan_dev;
>> -	else if (vlan_id)
>> +	else if (vlan_id && !(skb->dev->flags & IFF_PROMISC))
>>  		goto drop;
>>  
>>  	return (polling ? netif_receive_skb(skb) : netif_rx(skb));
>> @@ -102,7 +102,7 @@ vlan_gro_common(struct napi_struct *napi, struct vlan_group *grp,
>>  
>>  	if (vlan_dev)
>>  		skb->dev = vlan_dev;
>> -	else if (vlan_id)
>> +	else if (vlan_id && !(skb->dev->flags & IFF_PROMISC))
>>  		goto drop;
>>  
>>  	for (p = napi->gro_list; p; p = p->next) {
>>
> 
> 
> Hmm, packets are delivered not only to tcpdump but also on other stacks,
> on ethX.
> 
> So this is a domain violation.

This should be fine as long as the packets are properly marked
with PACKET_OTHERHOST.