From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@redhat.com>
Cc: netdev@oss.sgi.com, Herbert Xu <herbert@gondor.apana.org.au>
Subject: [PATCH 2.6]: Check against correct policy list in ip_forward/ip6_forward
Date: Sun, 17 Oct 2004 17:48:11 +0200 [thread overview]
Message-ID: <4172943B.8050904@trash.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 981 bytes --]
Hi Dave,
currently forwarded packets from a tunnel mode SA are checked
in ip_forward/ip6_forward against the XFRM_POLICY_FWD policy
list. Neither racoon nor pluto generate a policy for
IPSEC_DIR_FWD, so the checks are performed against an empty
list. I'm not sure who is wrong here, Linux or the keying daemons,
but I think using XFRM_POLICY_IN is more logical since we also
use XFRM_POLICY_OUT for forwarded packets, not XFRM_POLICY_FWD.
This patch changes ip_forward/ip6_forward to check against the
XFRM_POLICY_IN list.
BTW: The policy checks succeed as long as the policy list really is
empty because xfrm_policy_check skips the check if
xfrm_policy_list[dir] == NULL:
return !xfrm_policy_list[dir] ||
(skb->dst->flags & DST_NOPOLICY) ||
__xfrm_policy_check(sk, dir, skb, family);
I think this should really read (!xfrm_policy_list[dir] && !skb->sp)
so decapsulated IPsec packets are dropped if no policy exists.
Regards
Patrick
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1553 bytes --]
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/10/17 05:19:03+02:00 kaber@coreworks.de
# [IPSEC]: Check against correct policy list in ip_forward/ip6_forward
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
# net/ipv6/ip6_output.c
# 2004/10/17 05:18:26+02:00 kaber@coreworks.de +1 -1
# [IPSEC]: Check against correct policy list in ip_forward/ip6_forward
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
# net/ipv4/ip_forward.c
# 2004/10/17 05:18:26+02:00 kaber@coreworks.de +1 -1
# [IPSEC]: Check against correct policy list in ip_forward/ip6_forward
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
diff -Nru a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
--- a/net/ipv4/ip_forward.c 2004-10-17 16:57:28 +02:00
+++ b/net/ipv4/ip_forward.c 2004-10-17 16:57:28 +02:00
@@ -60,7 +60,7 @@
struct rtable *rt; /* Route we use */
struct ip_options * opt = &(IPCB(skb)->opt);
- if (!xfrm4_policy_check(NULL, XFRM_POLICY_FWD, skb))
+ if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
goto drop;
if (IPCB(skb)->opt.router_alert && ip_call_ra_chain(skb))
diff -Nru a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
--- a/net/ipv6/ip6_output.c 2004-10-17 16:57:28 +02:00
+++ b/net/ipv6/ip6_output.c 2004-10-17 16:57:28 +02:00
@@ -355,7 +355,7 @@
if (ipv6_devconf.forwarding == 0)
goto error;
- if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
+ if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
IP6_INC_STATS(IPSTATS_MIB_INDISCARDS);
goto drop;
}
next reply other threads:[~2004-10-17 15:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-17 15:48 Patrick McHardy [this message]
2004-10-17 21:23 ` [PATCH 2.6]: Check against correct policy list in ip_forward/ip6_forward Herbert Xu
2004-10-17 22:26 ` Patrick McHardy
2004-10-17 22:42 ` Patrick McHardy
2004-10-17 23:12 ` Herbert Xu
2004-10-18 20:34 ` Patrick McHardy
2004-10-18 21:43 ` [XFRM] Allow transport SAs even when there is no policy Herbert Xu
2004-10-19 14:16 ` Patrick McHardy
2004-10-19 21:25 ` Herbert Xu
2004-10-21 5:04 ` David S. Miller
2004-10-21 5:02 ` David S. Miller
2004-10-19 15:31 ` [Ipsec-tools-devel] Re: [PATCH 2.6]: Check against correct policy list in ip_forward/ip6_forward Aidas Kasparas
2004-10-19 15:38 ` Patrick McHardy
2004-10-19 15:57 ` Aidas Kasparas
2004-10-19 21:26 ` Herbert Xu
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=4172943B.8050904@trash.net \
--to=kaber@trash.net \
--cc=davem@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@oss.sgi.com \
/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).