Subject: Re: [RFC PATCH v1.0] af_packet: don't emit packet on orig fanout group

From: Ying Xue <[email-masked]>
Date: Fri, 17 Aug 2012 16:03:11 +0800

David Miller wrote:
> From: Eric Leblond <[email-masked]>
> Date: Thu, 16 Aug 2012 17:44:50 +0200
>
>   
>> If a packet is emitted on one socket in one group of fanout sockets,
>> it is transmitted again. It is thus read again on one of the sockets
>> of the fanout group. This result in a loop for software which
>> generate packets when receiving one.
>> This retransmission is not the intended behavior: a fanout group
>> must behave like a single socket. The packet should not be
>> transmitted on a socket if it originates from a socket belonging
>> to the same fanout group.
>>
>> This patch fixes the issue by changing the transmission check to
>> take fanout group info account.
>>     
>
> This looks mostly fine, thanks for fixing this.
>
> I wonder if it wouldn't be better to simply have a callback?  That
> would eliminate all of the ifdefs:
>
> 	if (ptype->id_match) {
> 		if (ptype->id_match(ptype, skb->sk))
> 			return true;
> 	} else if (ptype->af_packet_priv == skb->sk)
> 		return true;
>
> It's a shame that we have a user of af_packet_priv outside of
> AF_PACKET, in TIPC.  If we could get rid of that we could simplify
> things even futher.
>   

Hi David, next week I will take over the job to get rid the usage of 
af_packet_priv from TIPC.

Regards,
Ying

> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to [email-masked]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>