netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Cong Wang <cwang@twopensource.com>
Subject: [Patch net] loopback: explicitly set pkt_type to PACKET_HOST
Date: Wed, 14 May 2014 11:39:22 -0700	[thread overview]
Message-ID: <1400092762-23287-1-git-send-email-xiyou.wangcong@gmail.com> (raw)

From: Cong Wang <cwang@twopensource.com>

In a corner case where I redirect the packets from veth to lo,
packets are dropped silently when entering IP stack. This is
due to we have a different MAC addr on veth, so the packets are
marked as PACKET_OTHERHOST. And after they are redirect to lo,
this value is kept since lo has the same MAC addr with the packets.
Loopback should explicitly set it to PACKET_HOST before calling
eth_type_trans() for this specific case.

Cc: David S. Miller <davem@davemloft.net>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>

---
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index bb96409..52b6625 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -81,6 +81,7 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb,
 	 */
 	skb_dst_force(skb);
 
+	skb->pkt_type = PACKET_HOST;
 	skb->protocol = eth_type_trans(skb, dev);
 
 	/* it's OK to use per_cpu_ptr() because BHs are off */

             reply	other threads:[~2014-05-14 18:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 18:39 Cong Wang [this message]
2014-05-14 21:24 ` [Patch net] loopback: explicitly set pkt_type to PACKET_HOST Cong Wang
2014-05-15 20:34 ` David Miller
2014-05-16 17:52   ` Cong Wang
2014-05-16 19:17     ` David Miller
2014-05-16 20:57       ` Cong Wang

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=1400092762-23287-1-git-send-email-xiyou.wangcong@gmail.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=cwang@twopensource.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --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).