All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH 3/6] vxlan: associate with tunnel socket on xmit
Date: Tue, 09 Oct 2012 10:56:40 -0700	[thread overview]
Message-ID: <20121009175714.612852097@vyatta.com> (raw)
In-Reply-To: 20121009175637.048993312@vyatta.com

[-- Attachment #1: vxlan-owner.patch --]
[-- Type: text/plain, Size: 1213 bytes --]

When tunnelling a skb, associate it with the tunnel socket.
This allows paramaters set on tunnel socket (like multicast loop
flag), to be picked up by ip_output.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/vxlan.c	2012-10-09 10:49:01.334832146 -0700
+++ b/drivers/net/vxlan.c	2012-10-09 10:49:05.318792637 -0700
@@ -633,6 +633,23 @@ static __be32 vxlan_find_dst(struct vxla
 		return f->remote_ip;
 }
 
+static void vxlan_sock_free(struct sk_buff *skb)
+{
+	sock_put(skb->sk);
+}
+
+/* On transmit, associate with the tunnel socket */
+static void vxlan_set_owner(struct net_device *dev, struct sk_buff *skb)
+{
+	struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
+	struct sock *sk = vn->sock->sk;
+
+	skb_orphan(skb);
+	sock_hold(sk);
+	skb->sk = sk;
+	skb->destructor = vxlan_sock_free;
+}
+
 /* Transmit local packets over Vxlan
  *
  * Outer IP header inherits ECN and DF from inner header.
@@ -726,6 +743,8 @@ static netdev_tx_t vxlan_xmit(struct sk_
 	iph->saddr	= fl4.saddr;
 	iph->ttl	= ttl ? : ip4_dst_hoplimit(&rt->dst);
 
+	vxlan_set_owner(dev, skb);
+
 	/* See __IPTUNNEL_XMIT */
 	skb->ip_summed = CHECKSUM_NONE;
 	ip_select_ident(iph, &rt->dst, NULL);

  parent reply	other threads:[~2012-10-09 18:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-09 17:56 [PATCH 0/6] VXLAN fixes Stephen Hemminger
2012-10-09 17:56 ` [PATCH 1/6] vxlan: minor output refactoring Stephen Hemminger
2012-10-09 18:27   ` Joe Perches
2012-10-09 18:29     ` Stephen Hemminger
2012-10-10  8:08     ` David Laight
2012-10-09 17:56 ` [PATCH 2/6] vxlan: use ip_route_output Stephen Hemminger
2012-10-09 17:56 ` Stephen Hemminger [this message]
2012-10-09 17:56 ` [PATCH 4/6] VXLAN bases source UDP port based on flow to help the receiver to be able to load balance based on outer header flow Stephen Hemminger
2012-10-09 18:07   ` Stephen Hemminger
2012-10-09 18:14     ` David Miller
2012-10-09 18:38   ` Ben Hutchings
2012-10-09 17:56 ` [PATCH 5/6] vxlan: add additional headroom Stephen Hemminger
2012-10-09 17:56 ` [PATCH 6/6] vxlan: fix receive checksum handling Stephen Hemminger

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=20121009175714.612852097@vyatta.com \
    --to=shemminger@vyatta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.