From: Masahide NAKAMURA <[EMAIL PROTECTED]>
Date: Fri, 25 Aug 2006 19:06:40 +0900

> I've found a problem about MIPv6 CN with the patch below.

We just need to search by priority in the inexact list, even
if we get a hit in the hash table.

The fix is trivial, please try this patch:

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 200e6e5..060f115 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -908,6 +908,7 @@ static struct xfrm_policy *xfrm_policy_l
        xfrm_address_t *daddr, *saddr;
        struct hlist_node *entry;
        struct hlist_head *chain;
+       u32 priority = ~0U;
 
        daddr = xfrm_flowi_daddr(fl, family);
        saddr = xfrm_flowi_saddr(fl, family);
@@ -919,21 +920,21 @@ static struct xfrm_policy *xfrm_policy_l
        ret = NULL;
        hlist_for_each_entry(pol, entry, chain, bydst) {
                if (xfrm_policy_match(pol, fl, type, family, dir)) {
-                       xfrm_pol_hold(pol);
                        ret = pol;
+                       priority = ret->priority;
                        break;
                }
        }
-       if (!ret) {
-               chain = &xfrm_policy_inexact[dir];
-               hlist_for_each_entry(pol, entry, chain, bydst) {
-                       if (xfrm_policy_match(pol, fl, type, family, dir)) {
-                               xfrm_pol_hold(pol);
-                               ret = pol;
-                               break;
-                       }
+       chain = &xfrm_policy_inexact[dir];
+       hlist_for_each_entry(pol, entry, chain, bydst) {
+               if (xfrm_policy_match(pol, fl, type, family, dir) &&
+                   pol->priority < priority) {
+                       ret = pol;
+                       break;
                }
        }
+       if (ret)
+               xfrm_pol_hold(ret);
        read_unlock_bh(&xfrm_policy_lock);
 
        return ret;
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to