netdev
[Top] [All Lists]

Re: [XFRM] Allow transport SAs even when there is no policy

To: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [XFRM] Allow transport SAs even when there is no policy
From: Patrick McHardy <kaber@xxxxxxxxx>
Date: Tue, 19 Oct 2004 16:16:02 +0200
Cc: "David S. Miller" <davem@xxxxxxxxxx>, netdev@xxxxxxxxxxx, ipsec-tools-devel@xxxxxxxxxxxxxxxxxxxxx
In-reply-to: <20041018214326.GA6589@xxxxxxxxxxxxxxxxxxx>
References: <4172943B.8050904@xxxxxxxxx> <20041017212317.GA28615@xxxxxxxxxxxxxxxxxxx> <4172F1AB.4020305@xxxxxxxxx> <20041017231258.GA29294@xxxxxxxxxxxxxxxxxxx> <417428CF.2050802@xxxxxxxxx> <20041018214326.GA6589@xxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5
Herbert Xu wrote:

What I meant to say is all packets with tunnel mode SAs should be
rejected since we don't allow optional tunnel transforms for security
reasons.

This patch fixes it.

Looks good. So you agree we should also apply my patch to
xfrm_policy_lookup (attached again with less confusing subject) ? It makes
packets with a secpath fall through to __xfrm_policy_check when the policy
list is empty, so the default policy is always the same. This will break
setups with keying daemons that don't add forward policies for tunnel mode
SAs.

Regards
Patrick

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/10/19 16:04:44+02:00 kaber@xxxxxxxxxxxx 
#   [XFRM]: Apply policy checks to packets with a secpath when the policy list 
is empty
#   
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
# 
# include/net/xfrm.h
#   2004/10/19 16:04:18+02:00 kaber@xxxxxxxxxxxx +1 -1
#   [XFRM]: Apply policy checks to packets with a secpath when the policy list 
is empty
#   
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
# 
diff -Nru a/include/net/xfrm.h b/include/net/xfrm.h
--- a/include/net/xfrm.h        2004-10-19 16:05:39 +02:00
+++ b/include/net/xfrm.h        2004-10-19 16:05:39 +02:00
@@ -601,7 +601,7 @@
        if (sk && sk->sk_policy[XFRM_POLICY_IN])
                return __xfrm_policy_check(sk, dir, skb, family);
                
-       return  !xfrm_policy_list[dir] ||
+       return  (!xfrm_policy_list[dir] && !skb->sp) ||
                (skb->dst->flags & DST_NOPOLICY) ||
                __xfrm_policy_check(sk, dir, skb, family);
 }
<Prev in Thread] Current Thread [Next in Thread>