netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [XFRM]: Always reroute in tunnel mode
@ 2005-02-17  6:22 Patrick McHardy
  2005-02-17 11:36 ` Herbert Xu
  0 siblings, 1 reply; 11+ messages in thread
From: Patrick McHardy @ 2005-02-17  6:22 UTC (permalink / raw)
  To: David S. Miller; +Cc: Maillist netdev, Herbert Xu

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

Please see Changeset comment for a description, patch is based on
your 2.6.12 tree.

Regards
Patrick


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 3022 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/02/17 07:10:03+01:00 kaber@coreworks.de 
#   [XFRM]: Always reroute in tunnel mode
#   
#   Tunnel mode packets are rerouted if the tunnel destination
#   address is different from the original destination address,
#   otherwise the old route is used. This is inconsistent, the
#   old route might have been selected for a given output device
#   or using routing by tos/fwmark. Always choose a new route
#   in tunnel mode.
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/ipv6/xfrm6_policy.c
#   2005/02/17 07:09:55+01:00 kaber@coreworks.de +3 -1
#   [XFRM]: Always reroute in tunnel mode
#   
#   Tunnel mode packets are rerouted if the tunnel destination
#   address is different from the original destination address,
#   otherwise the old route is used. This is inconsistent, the
#   old route might have been selected for a given output device
#   or using routing by tos/fwmark. Always choose a new route
#   in tunnel mode.
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/ipv4/xfrm4_policy.c
#   2005/02/17 07:09:55+01:00 kaber@coreworks.de +3 -1
#   [XFRM]: Always reroute in tunnel mode
#   
#   Tunnel mode packets are rerouted if the tunnel destination
#   address is different from the original destination address,
#   otherwise the old route is used. This is inconsistent, the
#   old route might have been selected for a given output device
#   or using routing by tos/fwmark. Always choose a new route
#   in tunnel mode.
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
diff -Nru a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
--- a/net/ipv4/xfrm4_policy.c	2005-02-17 07:16:40 +01:00
+++ b/net/ipv4/xfrm4_policy.c	2005-02-17 07:16:40 +01:00
@@ -59,6 +59,7 @@
 	int err;
 	int header_len = 0;
 	int trailer_len = 0;
+	int tunnel = 0;
 
 	dst = dst_prev = NULL;
 
@@ -81,12 +82,13 @@
 		if (xfrm[i]->props.mode) {
 			remote = xfrm[i]->id.daddr.a4;
 			local  = xfrm[i]->props.saddr.a4;
+			tunnel = 1;
 		}
 		header_len += xfrm[i]->props.header_len;
 		trailer_len += xfrm[i]->props.trailer_len;
 	}
 
-	if (remote != fl->fl4_dst) {
+	if (tunnel) {
 		struct flowi fl_tunnel = { .nl_u = { .ip4_u =
 						     { .daddr = remote,
 						       .saddr = local }
diff -Nru a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
--- a/net/ipv6/xfrm6_policy.c	2005-02-17 07:16:40 +01:00
+++ b/net/ipv6/xfrm6_policy.c	2005-02-17 07:16:40 +01:00
@@ -76,6 +76,7 @@
 	int err = 0;
 	int header_len = 0;
 	int trailer_len = 0;
+	int tunnel = 0;
 
 	dst = dst_prev = NULL;
 
@@ -98,12 +99,13 @@
 		if (xfrm[i]->props.mode) {
 			remote = (struct in6_addr*)&xfrm[i]->id.daddr;
 			local  = (struct in6_addr*)&xfrm[i]->props.saddr;
+			tunnel = 1;
 		}
 		header_len += xfrm[i]->props.header_len;
 		trailer_len += xfrm[i]->props.trailer_len;
 	}
 
-	if (!ipv6_addr_equal(remote, &fl->fl6_dst)) {
+	if (tunnel) {
 		struct flowi fl_tunnel;
 
 		memset(&fl_tunnel, 0, sizeof(fl_tunnel));

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-02-19  6:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-17  6:22 [XFRM]: Always reroute in tunnel mode Patrick McHardy
2005-02-17 11:36 ` Herbert Xu
2005-02-17 18:15   ` Patrick McHardy
2005-02-17 18:25     ` Patrick McHardy
2005-02-17 20:38     ` Herbert Xu
2005-02-17 21:23       ` Patrick McHardy
2005-02-17 22:10         ` Herbert Xu
2005-02-17 23:02           ` Patrick McHardy
2005-02-17 23:11             ` David S. Miller
2005-02-18  9:53               ` Herbert Xu
2005-02-19  6:23                 ` Patrick McHardy

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).