From: Eric Leblond <eric@regit.org>
To: netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: [BUG] af_packet: loop at reception when using fanout
Date: Mon, 06 Aug 2012 16:21:58 +0200 [thread overview]
Message-ID: <1344262918.8024.41.camel@tiger.regit.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1640 bytes --]
Hello,
When using fanout mode on a AF_PACKET socket, the packet sent via one of
the fanout socket are sent back to one of the socket in the fanout set.
I've read the code and the error seems to be in dev.c.
The code check if skb->sk is not equal to ptype->af_packet_priv but in
the fanout case, we should check that skb->sk is not in the sockets of
the fanout set.
Here's how could look a possible implementation of the fix:
diff --git a/net/core/dev.c b/net/core/dev.c
index 1cb0d8a..63d144f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1654,7 +1654,12 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
*/
if ((ptype->dev == dev || !ptype->dev) &&
(ptype->af_packet_priv == NULL ||
- (struct sock *)ptype->af_packet_priv != skb->sk)) {
+ (((struct sock *)ptype->af_packet_priv != skb->sk)
+ &&
+ /* MISSING CHECK: af_packet_priv skb->sk one of the socket in fanout id of skb */
+ ! packet_sk_in_fanout(ptype, skb->sk)
+ )
+ ) {
if (pt_prev) {
deliver_skb(skb2, pt_prev, skb->dev);
pt_prev = ptype;
If this is done, we will have to export one function from the af_packet
module and I don't like the idea. If it is correct way to do it I can
implement this and propose a patch.
BR,
--
Eric Leblond
Blog: http://home.regit.org/ - Portfolio: http://regit.500px.com/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next reply other threads:[~2012-08-06 14:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-06 14:21 Eric Leblond [this message]
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
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=1344262918.8024.41.camel@tiger.regit.org \
--to=eric@regit.org \
--cc=davem@davemloft.net \
--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).