netdev
[Top] [All Lists]

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

To: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [3/4] [IPSEC] Add route element to xfrm_dst
From: Patrick McHardy <kaber@xxxxxxxxx>
Date: Mon, 14 Mar 2005 12:52:16 +0100
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>, Alexey Kuznetsov <kuznet@xxxxxxxxxxxxx>, James Morris <jmorris@xxxxxxxxxx>, YOSHIFUJI Hideaki <yoshfuji@xxxxxxxxxxxxxx>, netdev@xxxxxxxxxxx
In-reply-to: <20050214221433.GB18465@xxxxxxxxxxxxxxxxxxx>
References: <20050214221006.GA18415@xxxxxxxxxxxxxxxxxxx> <20050214221200.GA18465@xxxxxxxxxxxxxxxxxxx> <20050214221433.GB18465@xxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.5) Gecko/20050106 Debian/1.7.5-1
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.

Looking at this again, I noticed a problem:

+               if (remote != fl_tunnel.fl4_dst) {
+                       fl_tunnel.fl4_src = local;
+                       fl_tunnel.fl4_dst = remote;
+                       err = xfrm_dst_lookup((struct xfrm_dst **)&rt,
+                                             &fl_tunnel, AF_INET);
+                       if (err)
+                               goto error;
+               } else
+                       dst_hold(&rt->u.dst);
        }
+
        dst_prev->child = &rt->u.dst;
+       dst->path = &rt->u.dst;
+
+       *dst_p = dst;
+       dst = dst_prev;
+
+       dst_prev = *dst_p;
        i = 0;
-       for (dst_prev = dst; dst_prev != &rt->u.dst; dst_prev = 
dst_prev->child) {
+       for (; dst_prev != &rt->u.dst; dst_prev = dst_prev->child) {

Since the tunnel dst is not necessarily the last in the bundle anymore,
we might miss to initialize some dsts, for example with ipcomp/tunnel +
esp/transport. If we have nested tunnels we'll fiddle with entries in
the routing cache.

Regards
Patrick

<Prev in Thread] Current Thread [Next in Thread>