From: Duan Jiong <duanj.fnst@cn•fujitsu.com>
To: David Miller <davem@davemloft•net>
Cc: netdev <netdev@vger•kernel.org>
Subject: [PATCH] ipv6: do xfrm transform after nat if necessary
Date: Mon, 3 Nov 2014 12:53:03 +0800 [thread overview]
Message-ID: <54570A2F.2070206@cn.fujitsu.com> (raw)
In function nf_nat_ipv6_out, after nat is done, nf_xfrm_me_harder()
will be called to look up xfrm dst.
Signed-off-by: Duan Jiong <duanj.fnst@cn•fujitsu.com>
---
net/ipv6/ip6_output.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 8e950c2..742a845 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -124,6 +124,14 @@ static int ip6_finish_output2(struct sk_buff *skb)
static int ip6_finish_output(struct sk_buff *skb)
{
+#if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM)
+ /* Just like ipv4, policy lookup after nat yielded a new policy */
+ if (skb_dst(skb)->xfrm != NULL) {
+ IP6CB(skb)->flags |= IP6SKB_REROUTED;
+ return dst_output(skb);
+ }
+#endif
+
if ((skb->len > ip6_skb_dst_mtu(skb) && !skb_is_gso(skb)) ||
dst_allfrag(skb_dst(skb)) ||
(IP6CB(skb)->frag_max_size && skb->len > IP6CB(skb)->frag_max_size))
--
1.8.3.1
next reply other threads:[~2014-11-03 4:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-03 4:53 Duan Jiong [this message]
2014-11-03 19:42 ` [PATCH] ipv6: do xfrm transform after nat if necessary David Miller
2014-11-04 1:14 ` Duan Jiong
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=54570A2F.2070206@cn.fujitsu.com \
--to=duanj.fnst@cn$(echo .)fujitsu.com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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