From cd216edbfc8f8140095c1734af9308c4f8a9c58d Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Sun, 17 Feb 2008 23:29:30 -0800 Subject: [PATCH] --- yaml --- r: 85840 b: refs/heads/master c: b791160b5af4ea95c72fb59d13079664beca1963 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/net/xfrm/xfrm_policy.c | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index f79e1b21e857..baee06d10f37 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 82453021b8be85171350c695d7ebafe7b517c812 +refs/heads/master: b791160b5af4ea95c72fb59d13079664beca1963 diff --git a/trunk/net/xfrm/xfrm_policy.c b/trunk/net/xfrm/xfrm_policy.c index 47219f98053f..9fc4c315f6cd 100644 --- a/trunk/net/xfrm/xfrm_policy.c +++ b/trunk/net/xfrm/xfrm_policy.c @@ -331,15 +331,31 @@ static void xfrm_dst_hash_transfer(struct hlist_head *list, struct hlist_head *ndsttable, unsigned int nhashmask) { - struct hlist_node *entry, *tmp; + struct hlist_node *entry, *tmp, *entry0 = NULL; struct xfrm_policy *pol; + unsigned int h0 = 0; +redo: hlist_for_each_entry_safe(pol, entry, tmp, list, bydst) { unsigned int h; h = __addr_hash(&pol->selector.daddr, &pol->selector.saddr, pol->family, nhashmask); - hlist_add_head(&pol->bydst, ndsttable+h); + if (!entry0) { + hlist_del(entry); + hlist_add_head(&pol->bydst, ndsttable+h); + h0 = h; + } else { + if (h != h0) + continue; + hlist_del(entry); + hlist_add_after(entry0, &pol->bydst); + } + entry0 = entry; + } + if (!hlist_empty(list)) { + entry0 = NULL; + goto redo; } }