netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Maillist netdev <netdev@oss.sgi.com>
Subject: [PATCH 3/3 XFRM]: Fix invalid key for lookup of cached bundles
Date: Sat, 05 Mar 2005 14:59:26 +0100	[thread overview]
Message-ID: <4229BB3E.8020203@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: 03.diff --]
[-- Type: text/x-patch, Size: 2428 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/03/05 13:01:49+01:00 kaber@coreworks.de 
#   [XFRM4]: Fix invalid key for lookup of cached bundles
#   
#   __xfrm4_find_bundle() uses a different key than routing for
#   looking up cached bundles. When the original route was
#   reused in transport mode it is used even if fwmark/tos
#   don't match. Also compare tos/fwmark for transport mode
#   bundles.
# 
# net/ipv4/xfrm4_policy.c
#   2005/03/05 13:01:41+01:00 kaber@coreworks.de +8 -0
#   [XFRM4]: Fix invalid key for lookup of cached bundles
#   
#   __xfrm4_find_bundle() uses a different key than routing for
#   looking up cached bundles. When the original route was
#   reused in transport mode it is used even if fwmark/tos
#   don't match. Also compare tos/fwmark for transport mode
#   bundles.
# 
# include/net/dst.h
#   2005/03/05 13:01:41+01:00 kaber@coreworks.de +1 -0
#   [XFRM4]: Fix invalid key for lookup of cached bundles
#   
#   __xfrm4_find_bundle() uses a different key than routing for
#   looking up cached bundles. When the original route was
#   reused in transport mode it is used even if fwmark/tos
#   don't match. Also compare tos/fwmark for transport mode
#   bundles.
# 
diff -Nru a/include/net/dst.h b/include/net/dst.h
--- a/include/net/dst.h	2005-03-05 13:03:37 +01:00
+++ b/include/net/dst.h	2005-03-05 13:03:37 +01:00
@@ -48,6 +48,7 @@
 #define DST_NOXFRM		2
 #define DST_NOPOLICY		4
 #define DST_NOHASH		8
+#define DST_XFRM_TUNNEL		16
 	unsigned long		lastuse;
 	unsigned long		expires;
 
diff -Nru a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
--- a/net/ipv4/xfrm4_policy.c	2005-03-05 13:03:37 +01:00
+++ b/net/ipv4/xfrm4_policy.c	2005-03-05 13:03:37 +01:00
@@ -33,6 +33,13 @@
 		if (xdst->u.rt.fl.oif == fl->oif &&	/*XXX*/
 		    xdst->u.rt.fl.fl4_dst == fl->fl4_dst &&
 	    	    xdst->u.rt.fl.fl4_src == fl->fl4_src &&
+		    (dst->path->flags & DST_XFRM_TUNNEL ||
+		     (!(xdst->u.rt.fl.fl4_tos ^ fl->fl4_tos) & 
+		                  (IPTOS_RT_MASK|RTO_ONLINK)
+#ifdef CONFIG_IP_ROUTE_FWMARK
+		      && xdst->u.rt.fl.fl4_fwmark == fl->fl4_fwmark
+#endif
+		      )) &&
 		    xfrm_bundle_ok(xdst, fl, AF_INET)) {
 			dst_clone(dst);
 			break;
@@ -97,6 +104,7 @@
 		err = xfrm_dst_lookup((struct xfrm_dst**)&rt, &fl_tunnel, AF_INET);
 		if (err)
 			goto error;
+		rt->u.dst.flags |= DST_XFRM_TUNNEL;
 	} else {
 		dst_hold(&rt->u.dst);
 	}

             reply	other threads:[~2005-03-05 13:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-05 13:59 Patrick McHardy [this message]
2005-03-06 10:29 ` [PATCH 3/3 XFRM]: Fix invalid key for lookup of cached bundles Herbert Xu
2005-03-06 10:54   ` Patrick McHardy
2005-03-06 12:34   ` Patrick McHardy
2005-03-06 17:55     ` Patrick McHardy
2005-03-07  1:24     ` Herbert Xu
2005-03-07  1:41       ` Patrick McHardy
2005-03-07  1:43         ` Herbert Xu
2005-03-07  1:55           ` Patrick McHardy
2005-03-07  1:59             ` Herbert Xu
2005-03-07  2:30               ` Patrick McHardy
2005-03-07  2:57                 ` Herbert Xu
2005-03-07  3:11                   ` Patrick McHardy
2005-03-15  5:51                     ` David S. Miller
2005-03-15  6:01                       ` Herbert Xu
2005-03-15  6:14                         ` David S. Miller

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=4229BB3E.8020203@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --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).