From: Robert Shearman <rshearma@brocade.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>,
Nicolas Dichtel <nicolas.dichtel@6wind.com>,
Thomas Graf <tgraf@suug.ch>,
Roopa Prabhu <roopa@cumulusnetworks.com>,
"Robert Shearman" <rshearma@brocade.com>
Subject: [PATCH net-next 1/2] lwtunnel: set skb protocol and dev
Date: Mon, 3 Aug 2015 17:39:20 +0100 [thread overview]
Message-ID: <1438619961-15919-2-git-send-email-rshearma@brocade.com> (raw)
In-Reply-To: <1438619961-15919-1-git-send-email-rshearma@brocade.com>
In the locally-generated packet path skb->protocol may not be set and
this is required for the lwtunnel encap in order to get the lwtstate.
This would otherwise have been set by ip_output or ip6_output so set
skb->protocol prior to calling the lwtunnel encap
function. Additionally set skb->dev in case it is needed further down
the transmit path.
Signed-off-by: Robert Shearman <rshearma@brocade.com>
---
net/core/lwtunnel.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/net/core/lwtunnel.c b/net/core/lwtunnel.c
index c240c895b319..5d6d8e3d450a 100644
--- a/net/core/lwtunnel.c
+++ b/net/core/lwtunnel.c
@@ -215,8 +215,12 @@ int lwtunnel_output6(struct sock *sk, struct sk_buff *skb)
struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
struct lwtunnel_state *lwtstate = NULL;
- if (rt)
+ if (rt) {
lwtstate = rt->rt6i_lwtstate;
+ skb->dev = rt->dst.dev;
+ }
+
+ skb->protocol = htons(ETH_P_IPV6);
return __lwtunnel_output(sk, skb, lwtstate);
}
@@ -227,8 +231,12 @@ int lwtunnel_output(struct sock *sk, struct sk_buff *skb)
struct rtable *rt = (struct rtable *)skb_dst(skb);
struct lwtunnel_state *lwtstate = NULL;
- if (rt)
+ if (rt) {
lwtstate = rt->rt_lwtstate;
+ skb->dev = rt->dst.dev;
+ }
+
+ skb->protocol = htons(ETH_P_IP);
return __lwtunnel_output(sk, skb, lwtstate);
}
--
2.1.4
next prev parent reply other threads:[~2015-08-03 16:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-03 16:39 [PATCH net-next 0/2] lwtunnel: encap locally-generated ipv4 packets Robert Shearman
2015-08-03 16:39 ` Robert Shearman [this message]
2015-08-03 16:39 ` [PATCH net-next 2/2] ipv4: apply lwtunnel encap for locally-generated packets Robert Shearman
2015-08-03 21:41 ` [PATCH net-next 0/2] lwtunnel: encap locally-generated ipv4 packets roopa
2015-08-04 13:55 ` Robert Shearman
2015-08-04 5:26 ` 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=1438619961-15919-2-git-send-email-rshearma@brocade.com \
--to=rshearma@brocade.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=roopa@cumulusnetworks.com \
--cc=tgraf@suug.ch \
/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).