netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: eric@regit.org
Cc: netdev@vger.kernel.org
Subject: Re: [RFC PATCH v1.0] af_packet: don't emit packet on orig fanout group
Date: Thu, 16 Aug 2012 14:52:00 -0700 (PDT)	[thread overview]
Message-ID: <20120816.145200.694410419765575459.davem@davemloft.net> (raw)
In-Reply-To: <1345131890-15991-1-git-send-email-eric@regit.org>

From: Eric Leblond <eric@regit.org>
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.

  reply	other threads:[~2012-08-16 21:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-06 14:21 [BUG] af_packet: loop at reception when using fanout Eric Leblond
2012-08-16 15:44 ` [RFC PATCH v1.0] af_packet: don't emit packet on orig fanout group Eric Leblond
2012-08-16 21:52   ` David Miller [this message]
2012-08-16 21:52     ` David Miller
2012-08-17  8:02       ` [PATCH v1.1] " Eric Leblond
2012-08-20  9:37         ` David Miller
2012-08-17  8:03     ` [RFC PATCH v1.0] " Ying Xue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120816.145200.694410419765575459.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=eric@regit.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).