netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: lucien xin <lucien.xin@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: network dev <netdev@vger.kernel.org>
Subject: Re: [PATCH] vxlan: using AF_PACKET socket to send multicast packet cause WARNING
Date: Wed, 2 Apr 2014 13:31:59 +0800	[thread overview]
Message-ID: <CADvbK_dK_fBB3bQSWKkAk6adtgrHm553Hr3JGHsw67qeS0cQOw@mail.gmail.com> (raw)
In-Reply-To: <20140401.161047.854771903443514987.davem@davemloft.net>

On Wed, Apr 2, 2014 at 4:10 AM, David Miller <davem@davemloft.net> wrote:
> This is not the correct fix.
>
> If vxlan is going to reinject dev_hard_start_xmit() bound packets into
> the ipv4 stack, it must make sure that they are well formed.
>
> The SKB traversing the ipv4 stack must either be bound to an ipv4/ipv6
> socket or be orphaned.

yeah,  it's right. then I want to bound skb to vxlan's sock in
vxlan_xmit_skb(), like this:

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 1236812..8fd7e93 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1755,6 +1755,8 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
        if (err)
                return err;

+       skb_set_owner_w(skb, vs->sock->sk);
+
        return iptunnel_xmit(rt, skb, src, dst, IPPROTO_UDP, tos, ttl, df,
                             false);
 }

which can not only solve the issue, but also make the logic more correct.
David, how do you think?

  reply	other threads:[~2014-04-02  5:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-01  9:08 [PATCH] vxlan: using AF_PACKET socket to send multicast packet cause WARNING Xin Long
2014-04-01 20:10 ` David Miller
2014-04-02  5:31   ` lucien xin [this message]
2014-04-02 14:51     ` Stephen Hemminger
2014-04-03  5:28       ` lucien xin
2014-04-03 16:48         ` David Miller

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=CADvbK_dK_fBB3bQSWKkAk6adtgrHm553Hr3JGHsw67qeS0cQOw@mail.gmail.com \
    --to=lucien.xin@gmail.com \
    --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).