From: Joakim Koskela <joakim.koskela@hiit.fi>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
"Patrick McHardy" <kaber@trash.net>,
"Herbert Xu" <herbert@gondor.apana.org.au>
Subject: [PATCH] netdev: Netfilters on outgoing interfamily ipsec
Date: Fri, 19 Oct 2007 14:37:38 +0300 [thread overview]
Message-ID: <200710191437.39449.joakim.koskela@hiit.fi> (raw)
Hi,
I understand that Herbert is in midst of cleaning up the output of
interfamily transformations, but I thought I'd post a couple of
patches related to that anyway, sort of to show what we've needed to
fix to get our systems working.
This one changes how the netfilters are applied during output to be
based on the current address family of the packet instead of what it
will be transformed to.
Signed-off-by: Joakim Koskela <jookos@gmail.com>
---
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c
index c4a7156..8b0c6bd 100644
--- a/net/ipv4/xfrm4_output.c
+++ b/net/ipv4/xfrm4_output.c
@@ -13,6 +13,9 @@
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/netfilter_ipv4.h>
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
+#include <linux/netfilter_ipv6.h>
+#endif
#include <net/ip.h>
#include <net/xfrm.h>
#include <net/icmp.h>
@@ -139,7 +142,13 @@ static int xfrm4_output_finish(struct sk_buff *skb)
int xfrm4_output(struct sk_buff *skb)
{
- return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dst->dev,
- xfrm4_output_finish,
- !(IPCB(skb)->flags & IPSKB_REROUTED));
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
+ if (ip_hdr(skb)->version == 6)
+ return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dst->dev,
+ xfrm4_output_finish);
+ else
+#endif
+ return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dst->dev,
+ xfrm4_output_finish,
+ !(IPCB(skb)->flags & IPSKB_REROUTED));
}
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index 6569767..7624613 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -14,8 +14,10 @@
#include <linux/skbuff.h>
#include <linux/icmpv6.h>
#include <linux/netfilter_ipv6.h>
+#include <linux/netfilter_ipv4.h>
#include <net/ipv6.h>
#include <net/xfrm.h>
+#include <net/ip.h>
int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
u8 **prevhdr)
@@ -134,6 +136,11 @@ static int xfrm6_output_finish(struct sk_buff *skb)
int xfrm6_output(struct sk_buff *skb)
{
- return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dst->dev,
- xfrm6_output_finish);
+ if (ip_hdr(skb)->version == 4)
+ return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dst->dev,
+ xfrm6_output_finish,
+ !(IPCB(skb)->flags & IPSKB_REROUTED));
+ else
+ return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dst->dev,
+ xfrm6_output_finish);
}
next reply other threads:[~2007-10-19 11:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-19 11:37 Joakim Koskela [this message]
2007-10-19 11:40 ` [PATCH] netdev: Reset ipv4 flags during bundle creation on interfamily ipsec Joakim Koskela
2007-10-19 13:09 ` Herbert Xu
2007-10-19 13:20 ` Joakim Koskela
2007-10-19 14:25 ` Herbert Xu
2007-10-22 6:55 ` Joakim Koskela
2007-10-22 8:51 ` Herbert Xu
2007-10-19 12:55 ` [PATCH] netdev: Netfilters on outgoing " Herbert Xu
2007-10-19 13:18 ` Joakim Koskela
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=200710191437.39449.joakim.koskela@hiit.fi \
--to=joakim.koskela@hiit.fi \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kaber@trash.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