aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2014-11-13 04:09:50 -0500
committerSteffen Klassert <steffen.klassert@secunet.com>2014-11-13 05:25:04 -0500
commit12bfa8bdba05700e437479dcb6d53b5ca582fa49 (patch)
treeb3c21040d1c27ea5a4b1b232d6f73e4d61e95184 /net/xfrm
parent53c2e285f9703001e1bb48d04696c5f9d8f3aef7 (diff)
xfrm: Use __xfrm_policy_link in xfrm_policy_insert
For a long time we couldn't actually use __xfrm_policy_link in xfrm_policy_insert because the latter wanted to do hashing at a specific position. Now that __xfrm_policy_link no longer does hashing it can now be safely used in xfrm_policy_insert to kill some duplicate code, finally reuniting general policies with socket policies. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_policy.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index f4d3a125e49c..178fa0ebc82c 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -55,6 +55,7 @@ static int stale_bundle(struct dst_entry *dst);
55static int xfrm_bundle_ok(struct xfrm_dst *xdst); 55static int xfrm_bundle_ok(struct xfrm_dst *xdst);
56static void xfrm_policy_queue_process(unsigned long arg); 56static void xfrm_policy_queue_process(unsigned long arg);
57 57
58static void __xfrm_policy_link(struct xfrm_policy *pol, int dir);
58static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol, 59static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
59 int dir); 60 int dir);
60 61
@@ -779,8 +780,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
779 hlist_add_behind(&policy->bydst, newpos); 780 hlist_add_behind(&policy->bydst, newpos);
780 else 781 else
781 hlist_add_head(&policy->bydst, chain); 782 hlist_add_head(&policy->bydst, chain);
782 xfrm_pol_hold(policy); 783 __xfrm_policy_link(policy, dir);
783 net->xfrm.policy_count[dir]++;
784 atomic_inc(&net->xfrm.flow_cache_genid); 784 atomic_inc(&net->xfrm.flow_cache_genid);
785 785
786 /* After previous checking, family can either be AF_INET or AF_INET6 */ 786 /* After previous checking, family can either be AF_INET or AF_INET6 */
@@ -799,7 +799,6 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
799 policy->curlft.use_time = 0; 799 policy->curlft.use_time = 0;
800 if (!mod_timer(&policy->timer, jiffies + HZ)) 800 if (!mod_timer(&policy->timer, jiffies + HZ))
801 xfrm_pol_hold(policy); 801 xfrm_pol_hold(policy);
802 list_add(&policy->walk.all, &net->xfrm.policy_all);
803 write_unlock_bh(&net->xfrm.xfrm_policy_lock); 802 write_unlock_bh(&net->xfrm.xfrm_policy_lock);
804 803
805 if (delpol) 804 if (delpol)