netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [1/4] [IPSEC] Merge xfrm[46]_bundle/stale_bundle
@ 2005-02-14 22:10 Herbert Xu
  2005-02-14 22:12 ` [2/4] [IPSEC] Add xfrm_state_mtu Herbert Xu
  0 siblings, 1 reply; 114+ messages in thread
From: Herbert Xu @ 2005-02-14 22:10 UTC (permalink / raw)
  To: David S. Miller, Alexey Kuznetsov, James Morris,
	YOSHIFUJI Hideaki, netdev

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

Hi:

This series of patches adds MTU tracking in each xfrm_dst.

This patch merges xfrm4_bundle_ok/xfrm6_bundle_ok/stale_bundle
so that later additions for MTU calculation only need to be done once.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

BTW, the previous version of this patch contained a critical
error in stale_bundle.  So please disregard that one.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: xfrm-1 --]
[-- Type: text/plain, Size: 4208 bytes --]

diff -Nru a/include/net/xfrm.h b/include/net/xfrm.h
--- a/include/net/xfrm.h	2005-02-14 14:13:05 +11:00
+++ b/include/net/xfrm.h	2005-02-14 14:13:05 +11:00
@@ -857,6 +857,7 @@
 extern void xfrm_policy_flush(void);
 extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
 extern int xfrm_flush_bundles(void);
+extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family);
 
 extern wait_queue_head_t km_waitq;
 extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport);
diff -Nru a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
--- a/net/ipv4/xfrm4_policy.c	2005-02-14 14:13:05 +11:00
+++ b/net/ipv4/xfrm4_policy.c	2005-02-14 14:13:05 +11:00
@@ -22,26 +22,6 @@
 	return __ip_route_output_key((struct rtable**)dst, fl);
 }
 
-/* Check that the bundle accepts the flow and its components are
- * still valid.
- */
-
-static int __xfrm4_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl)
-{
-	do {
-		if (xdst->u.dst.ops != &xfrm4_dst_ops)
-			return 1;
-
-		if (!xfrm_selector_match(&xdst->u.dst.xfrm->sel, fl, AF_INET))
-			return 0;
-		if (xdst->u.dst.xfrm->km.state != XFRM_STATE_VALID ||
-		    xdst->u.dst.path->obsolete > 0)
-			return 0;
-		xdst = (struct xfrm_dst*)xdst->u.dst.child;
-	} while (xdst);
-	return 0;
-}
-
 static struct dst_entry *
 __xfrm4_find_bundle(struct flowi *fl, struct xfrm_policy *policy)
 {
@@ -53,7 +33,7 @@
 		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 &&
-		    __xfrm4_bundle_ok(xdst, fl)) {
+		    xfrm_bundle_ok(xdst, fl, AF_INET)) {
 			dst_clone(dst);
 			break;
 		}
diff -Nru a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
--- a/net/ipv6/xfrm6_policy.c	2005-02-14 14:13:05 +11:00
+++ b/net/ipv6/xfrm6_policy.c	2005-02-14 14:13:05 +11:00
@@ -31,26 +31,6 @@
 	return err;
 }
 
-/* Check that the bundle accepts the flow and its components are
- * still valid.
- */
-
-static int __xfrm6_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl)
-{
-	do {
-		if (xdst->u.dst.ops != &xfrm6_dst_ops)
-			return 1;
-
-		if (!xfrm_selector_match(&xdst->u.dst.xfrm->sel, fl, AF_INET6))
-			return 0;
-		if (xdst->u.dst.xfrm->km.state != XFRM_STATE_VALID ||
-		    xdst->u.dst.path->obsolete > 0)
-			return 0;
-		xdst = (struct xfrm_dst*)xdst->u.dst.child;
-	} while (xdst);
-	return 0;
-}
-
 static struct dst_entry *
 __xfrm6_find_bundle(struct flowi *fl, struct xfrm_policy *policy)
 {
@@ -70,7 +50,7 @@
 				 xdst->u.rt6.rt6i_src.plen);
 		if (ipv6_addr_equal(&xdst->u.rt6.rt6i_dst.addr, &fl_dst_prefix) &&
 		    ipv6_addr_equal(&xdst->u.rt6.rt6i_src.addr, &fl_src_prefix) &&
-		    __xfrm6_bundle_ok(xdst, fl)) {
+		    xfrm_bundle_ok(xdst, fl, AF_INET6)) {
 			dst_clone(dst);
 			break;
 		}
diff -Nru a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
--- a/net/xfrm/xfrm_policy.c	2005-02-14 14:13:05 +11:00
+++ b/net/xfrm/xfrm_policy.c	2005-02-14 14:13:05 +11:00
@@ -1021,18 +1021,7 @@
 
 static int stale_bundle(struct dst_entry *dst)
 {
-	struct dst_entry *child = dst;
-
-	while (child) {
-		if (child->obsolete > 0 ||
-		    (child->dev && !netif_running(child->dev)) ||
-		    (child->xfrm && child->xfrm->km.state != XFRM_STATE_VALID)) {
-			return 1;
-		}
-		child = child->child;
-	}
-
-	return 0;
+	return !xfrm_bundle_ok((struct xfrm_dst *)dst, NULL, AF_UNSPEC);
 }
 
 static void xfrm_dst_destroy(struct dst_entry *dst)
@@ -1108,6 +1097,31 @@
 	return 0;
 }
 
+/* Check that the bundle accepts the flow and its components are
+ * still valid.
+ */
+
+int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family)
+{
+	struct dst_entry *dst = &xdst->u.dst;
+
+	if (dst->path->obsolete > 0 ||
+	    (dst->dev && !netif_running(dst->dev)))
+		return 0;
+
+	do {
+		if (fl && !xfrm_selector_match(&dst->xfrm->sel, fl, family))
+			return 0;
+		if (dst->xfrm->km.state != XFRM_STATE_VALID)
+			return 0;
+		dst = dst->child;
+	} while (dst->xfrm);
+
+	return 1;
+}
+
+EXPORT_SYMBOL(xfrm_bundle_ok);
+ 
 /* Well... that's _TASK_. We need to scan through transformation
  * list and figure out what mss tcp should generate in order to
  * final datagram fit to mtu. Mama mia... :-)

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

end of thread, other threads:[~2005-04-22  3:13 UTC | newest]

Thread overview: 114+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-14 22:10 [1/4] [IPSEC] Merge xfrm[46]_bundle/stale_bundle Herbert Xu
2005-02-14 22:12 ` [2/4] [IPSEC] Add xfrm_state_mtu Herbert Xu
2005-02-14 22:14   ` [3/4] [IPSEC] Add route element to xfrm_dst Herbert Xu
2005-02-14 22:16     ` [4/4] [IPSEC] Store MTU at each xfrm_dst Herbert Xu
2005-02-15 15:53       ` James Morris
2005-02-15 20:31         ` Herbert Xu
2005-02-16 10:37       ` [5/*] [IPSEC] Use dst_mtu in xfrm[46]_output Herbert Xu
2005-02-16 11:08         ` [6/*] [IPSEC] Fix xfrm[46]_update_pmtu to update top dst Herbert Xu
2005-02-16 11:38           ` [7/*] [IPSEC] Get metrics for xfrm_dst from " Herbert Xu
2005-03-07  5:47             ` David S. Miller
2005-03-07 10:41               ` Herbert Xu
2005-03-07  5:35           ` [6/*] [IPSEC] Fix xfrm[46]_update_pmtu to update " David S. Miller
2005-03-07 10:39             ` Herbert Xu
2005-03-07  5:33         ` [5/*] [IPSEC] Use dst_mtu in xfrm[46]_output David S. Miller
2005-03-07 11:45         ` [10/*] [TCP] Get rid of dst_ptmu/ext2_header_len Herbert Xu
2005-03-07 17:33           ` David S. Miller
2005-03-07  5:32       ` [4/4] [IPSEC] Store MTU at each xfrm_dst David S. Miller
2005-03-07 10:35         ` [9/*] [IPSEC] Check dst validity harder in xfrm_bundle_ok Herbert Xu
2005-03-07 17:32           ` David S. Miller
2005-03-08 10:27           ` [11/*] [NET] Move dst_release out of dst->ops->check Herbert Xu
2005-03-08 12:50             ` YOSHIFUJI Hideaki / 吉藤英明
2005-03-11  2:17             ` David S. Miller
2005-03-14 10:26             ` [12/*] [IPSEC] Handle local_df in IPv4 Herbert Xu
2005-03-14 10:53               ` [13/*] [IPV4] Fix room calculation in icmp_send Herbert Xu
2005-03-14 11:10                 ` [14/*] [IPV6] Reload skb->dst after xfrm6_route_forward Herbert Xu
2005-03-15  5:27                   ` David S. Miller
2005-03-15  9:19                   ` [15/*] [INET] Fix IPsec calculation in ip_append_data/ip6_append_data Herbert Xu
2005-03-15  9:58                     ` [16/*] [INET] Take IPsec overhead into account in tunnels Herbert Xu
2005-03-15 10:05                       ` [17/*] [NET] Replace dst_pmtu with dst_mtu Herbert Xu
2005-03-15 18:24                         ` David S. Miller
2005-03-15 19:02                           ` Patrick McHardy
2005-03-15 20:40                             ` Replace send_unreach with icmp_send Herbert Xu
2005-03-15 20:48                               ` Patrick McHardy
2005-03-16 10:51                                 ` [IPV4] Make ipt_REJECT use icmp_send again Herbert Xu
2005-03-16 19:00                                   ` Patrick McHardy
2005-03-16 22:44                                     ` David S. Miller
2005-03-17 10:51                                       ` [IPV4] Send TCP reset through dst_output in ipt_REJECT Herbert Xu
2005-03-17 18:06                                         ` David S. Miller
2005-03-15 20:31                           ` [17/*] [NET] Replace dst_pmtu with dst_mtu Herbert Xu
2005-03-15 10:20                       ` [16/*] [INET] Take IPsec overhead into account in tunnels Lennert Buytenhek
2005-03-15 10:27                         ` Herbert Xu
2005-03-15 18:20                       ` David S. Miller
2005-03-18  9:03                       ` [21/*] [IPv4] Fix MTU check in ipmr_queue_xmit Herbert Xu
2005-03-18  9:11                         ` [22/*] [NETFILTER] Use correct IPsec MTU in TCPMSS Herbert Xu
2005-03-18  9:19                           ` [23/*] [IPV4] Kill remaining unnecessary uses of dst_pmtu Herbert Xu
2005-03-18 10:07                             ` [24/*] [IPSEC] Get ttl from child instead of path Herbert Xu
2005-03-18 10:11                               ` [25/*] [NET] Kill unnecessary uses of dst_path_metric Herbert Xu
2005-03-18 11:06                                 ` [26/*] [NET] Kill dst_pmtu/dst_path_metric Herbert Xu
2005-03-18 11:28                                   ` [27/*] [NET] Make dst_allfrag use dst instead of dst->path Herbert Xu
2005-03-18 18:47                                     ` David S. Miller
2005-03-18 18:46                                   ` [26/*] [NET] Kill dst_pmtu/dst_path_metric David S. Miller
2005-03-18 18:44                                 ` [25/*] [NET] Kill unnecessary uses of dst_path_metric David S. Miller
2005-03-18 18:43                               ` [24/*] [IPSEC] Get ttl from child instead of path David S. Miller
2005-03-18 18:41                             ` [23/*] [IPV4] Kill remaining unnecessary uses of dst_pmtu David S. Miller
2005-03-18 18:40                           ` [22/*] [NETFILTER] Use correct IPsec MTU in TCPMSS David S. Miller
2005-03-20 15:46                             ` Patrick McHardy
2005-03-20 16:32                               ` Ludo Stellingwerff
2005-03-20 17:17                                 ` Lennert Buytenhek
2005-03-20 17:49                                   ` Patrick McHardy
2005-03-20 18:11                                     ` Ludo Stellingwerff
2005-03-20 18:22                                       ` Patrick McHardy
2005-03-20 18:43                                         ` jamal
2005-03-20 19:10                                           ` Patrick McHardy
2005-03-30  9:49                                     ` Extending xfrm_selector (Was: [22/*] [NETFILTER] Use correct IPsec MTU in TCPMSS) Herbert Xu
2005-03-23  3:49                               ` [22/*] [NETFILTER] Use correct IPsec MTU in TCPMSS David S. Miller
2005-03-23  4:03                                 ` Patrick McHardy
2005-03-24  5:05                                   ` Netfilter+IPsec Patrick McHardy
2005-03-24  5:43                                     ` Netfilter+IPsec David S. Miller
2005-03-25  2:53                                       ` Netfilter+IPsec Herbert Xu
2005-03-25  5:10                                         ` Netfilter+IPsec Patrick McHardy
2005-03-23  9:24                               ` [22/*] [NETFILTER] Use correct IPsec MTU in TCPMSS Herbert Xu
2005-03-18 18:39                         ` [21/*] [IPv4] Fix MTU check in ipmr_queue_xmit David S. Miller
2005-03-15 18:18                     ` [15/*] [INET] Fix IPsec calculation in ip_append_data/ip6_append_data David S. Miller
2005-03-16 11:31                     ` Herbert Xu
2005-03-16 22:02                       ` David S. Miller
2005-03-21 16:14                       ` Mika Penttilä
2005-03-21 20:28                         ` Herbert Xu
2005-03-21 21:29                           ` Mika Penttilä
2005-03-21 22:04                             ` Herbert Xu
2005-03-15  5:26                 ` [13/*] [IPV4] Fix room calculation in icmp_send David S. Miller
2005-03-15  5:25               ` [12/*] [IPSEC] Handle local_df in IPv4 David S. Miller
2005-03-15 18:25                 ` YOSHIFUJI Hideaki / 吉藤英明
2005-03-15 18:28                   ` YOSHIFUJI Hideaki / 吉藤英明
2005-03-28 20:10       ` [4/4] [IPSEC] Store MTU at each xfrm_dst Patrick McHardy
2005-03-28 23:30         ` [IPSEC] Move xfrm_flush_bundles into xfrm_state GC Herbert Xu
2005-03-31  0:10           ` Patrick McHardy
2005-04-01  5:21           ` David S. Miller
2005-03-28 23:39         ` Checking SPI in xfrm_state_find Herbert Xu
2005-03-31  0:13           ` Patrick McHardy
2005-03-31  0:46             ` Herbert Xu
2005-04-01  5:23               ` David S. Miller
2005-04-02  0:49                 ` [IPSEC]: Kill nested read lock by deleting xfrm_init_tempsel Herbert Xu
2005-04-02  1:20                   ` David S. Miller
2005-04-02  2:09                     ` Herbert Xu
2005-04-03 16:48                       ` Patrick McHardy
2005-04-05 10:39                         ` Herbert Xu
2005-04-05 20:01                           ` Patrick McHardy
2005-04-06  2:21                             ` Herbert Xu
2005-04-21 23:35                               ` David S. Miller
2005-04-21 23:52                                 ` Herbert Xu
2005-04-21 23:53                                 ` Patrick McHardy
2005-04-22  3:13                                   ` David S. Miller
2005-04-03 17:00               ` Checking SPI in xfrm_state_find Patrick McHardy
2005-02-15  8:10     ` [3/4] [IPSEC] Add route element to xfrm_dst Mika Penttilä
2005-02-15  9:53       ` Herbert Xu
2005-02-15 10:22         ` Mika Penttilä
2005-03-07  5:28     ` David S. Miller
2005-03-07 10:02       ` Herbert Xu
2005-03-07 10:16     ` [IPSEC] Kill redundan dst_release check in xfrm_dst_destroy Herbert Xu
2005-03-07 17:35       ` David S. Miller
2005-03-14 11:52     ` [3/4] [IPSEC] Add route element to xfrm_dst Patrick McHardy
2005-03-14 20:32       ` Herbert Xu
2005-03-15 19:05         ` Patrick McHardy
2005-03-07  5:23   ` [2/4] [IPSEC] Add xfrm_state_mtu David S. Miller

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