Subject: Re: [3/4] [IPSEC] Add route element to xfrm_dst

From: Mika Penttilä <[email-masked]>
Date: Tue, 15 Feb 2005 10:10:06 +0200

Herbert Xu wrote:

>This patch adds a pointer to the route corresponding to the specific
>flow over the SA of an xfrm_dst that's being used.
>
>It also sets the next pointer of each xfrm_dst to the one above it.
>This allows to traverse the list upwards from the bottom.
> 
>Signed-off-by: Herbert Xu <[email-masked]>
>
>Cheers,
>  
>
>------------------------------------------------------------------------
> /* Decapsulation state, used by the input to store data during
>===== net/ipv4/xfrm4_policy.c 1.14 vs edited =====
>--- 1.14/net/ipv4/xfrm4_policy.c	2005-02-14 14:02:13 +11:00
>+++ edited/net/ipv4/xfrm4_policy.c	2005-02-14 14:29:35 +11:00
>@@ -55,18 +55,29 @@
> 	struct rtable *rt = rt0;
> 	u32 remote = fl->fl4_dst;
> 	u32 local  = fl->fl4_src;
>+	struct flowi fl_tunnel = {
>+		.nl_u = {
>+			.ip4_u = {
>+				.saddr = local,
>+				.daddr = remote
>+			}
>+		}
>+	};
> 	int i;
> 	int err;
> 	int header_len = 0;
> 	int trailer_len = 0;
> 
> 	dst = dst_prev = NULL;
>  
>

Shouldn't this pinning happen inside the loop for eaxh xdst, to be 
balanced with  the dst_release(xdst->route) in xfrm_dst_destroy ?

>+	dst_hold(&rt->u.dst);
> 
> 	for (i = 0; i < nx; i++) {
> 		struct dst_entry *dst1 = dst_alloc(&xfrm4_dst_ops);
>+		struct xfrm_dst *xdst;
> 
> 		if (unlikely(dst1 == NULL)) {
> 			err = -ENOBUFS;
>  
>