aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-01-07 02:04:54 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-01-07 15:57:33 -0500
commit3e3850e989c5d2eb1aab6f0fd9257759f0f4cbc6 (patch)
treefa05d1de4767bc30e77442ffbacfe8bd8dd2213d /net/xfrm
parent8cdfab8a43bb4b3da686ea503a702cb6f9f6a803 (diff)
[NETFILTER]: Fix xfrm lookup in ip_route_me_harder/ip6_route_me_harder
ip_route_me_harder doesn't use the port numbers of the xfrm lookup and uses ip_route_input for non-local addresses which doesn't do a xfrm lookup, ip6_route_me_harder doesn't do a xfrm lookup at all. Use xfrm_decode_session and do the lookup manually, make sure both only do the lookup if the packet hasn't been transformed already. Makeing sure the lookup only happens once needs a new field in the IP6CB, which exceeds the size of skb->cb. The size of skb->cb is increased to 48b. Apparently the IPv6 mobile extensions need some more room anyway. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_policy.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 64a447375fdb..f2edc9225b6a 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -951,8 +951,8 @@ xfrm_policy_ok(struct xfrm_tmpl *tmpl, struct sec_path *sp, int start,
951 return start; 951 return start;
952} 952}
953 953
954static int 954int
955_decode_session(struct sk_buff *skb, struct flowi *fl, unsigned short family) 955xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, unsigned short family)
956{ 956{
957 struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family); 957 struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
958 958
@@ -963,6 +963,7 @@ _decode_session(struct sk_buff *skb, struct flowi *fl, unsigned short family)
963 xfrm_policy_put_afinfo(afinfo); 963 xfrm_policy_put_afinfo(afinfo);
964 return 0; 964 return 0;
965} 965}
966EXPORT_SYMBOL(xfrm_decode_session);
966 967
967static inline int secpath_has_tunnel(struct sec_path *sp, int k) 968static inline int secpath_has_tunnel(struct sec_path *sp, int k)
968{ 969{
@@ -982,7 +983,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,
982 u8 fl_dir = policy_to_flow_dir(dir); 983 u8 fl_dir = policy_to_flow_dir(dir);
983 u32 sk_sid; 984 u32 sk_sid;
984 985
985 if (_decode_session(skb, &fl, family) < 0) 986 if (xfrm_decode_session(skb, &fl, family) < 0)
986 return 0; 987 return 0;
987 988
988 sk_sid = security_sk_sid(sk, &fl, fl_dir); 989 sk_sid = security_sk_sid(sk, &fl, fl_dir);
@@ -1055,7 +1056,7 @@ int __xfrm_route_forward(struct sk_buff *skb, unsigned short family)
1055{ 1056{
1056 struct flowi fl; 1057 struct flowi fl;
1057 1058
1058 if (_decode_session(skb, &fl, family) < 0) 1059 if (xfrm_decode_session(skb, &fl, family) < 0)
1059 return 0; 1060 return 0;
1060 1061
1061 return xfrm_lookup(&skb->dst, &fl, NULL, 0) == 0; 1062 return xfrm_lookup(&skb->dst, &fl, NULL, 0) == 0;