diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-11-25 20:32:41 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-25 20:32:41 -0500 |
commit | e92303f872600978796ff323bc229d911f905849 (patch) | |
tree | bb6284d82a7976bd617b32178f494fe8d4c0f54d /net/xfrm | |
parent | 284fa7da300adcb700b44df2f64a536b434d4650 (diff) |
netns xfrm: propagate netns into policy byidx hash
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 3d931f52f897..aefbb56dad20 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -321,9 +321,9 @@ static void xfrm_policy_kill(struct xfrm_policy *policy) | |||
321 | 321 | ||
322 | static unsigned int xfrm_policy_hashmax __read_mostly = 1 * 1024 * 1024; | 322 | static unsigned int xfrm_policy_hashmax __read_mostly = 1 * 1024 * 1024; |
323 | 323 | ||
324 | static inline unsigned int idx_hash(u32 index) | 324 | static inline unsigned int idx_hash(struct net *net, u32 index) |
325 | { | 325 | { |
326 | return __idx_hash(index, init_net.xfrm.policy_idx_hmask); | 326 | return __idx_hash(index, net->xfrm.policy_idx_hmask); |
327 | } | 327 | } |
328 | 328 | ||
329 | static struct hlist_head *policy_hash_bysel(struct xfrm_selector *sel, unsigned short family, int dir) | 329 | static struct hlist_head *policy_hash_bysel(struct xfrm_selector *sel, unsigned short family, int dir) |
@@ -523,7 +523,7 @@ static u32 xfrm_gen_index(int dir) | |||
523 | idx_generator += 8; | 523 | idx_generator += 8; |
524 | if (idx == 0) | 524 | if (idx == 0) |
525 | idx = 8; | 525 | idx = 8; |
526 | list = init_net.xfrm.policy_byidx + idx_hash(idx); | 526 | list = init_net.xfrm.policy_byidx + idx_hash(&init_net, idx); |
527 | found = 0; | 527 | found = 0; |
528 | hlist_for_each_entry(p, entry, list, byidx) { | 528 | hlist_for_each_entry(p, entry, list, byidx) { |
529 | if (p->index == idx) { | 529 | if (p->index == idx) { |
@@ -596,7 +596,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl) | |||
596 | init_net.xfrm.policy_count[dir]--; | 596 | init_net.xfrm.policy_count[dir]--; |
597 | } | 597 | } |
598 | policy->index = delpol ? delpol->index : xfrm_gen_index(dir); | 598 | policy->index = delpol ? delpol->index : xfrm_gen_index(dir); |
599 | hlist_add_head(&policy->byidx, init_net.xfrm.policy_byidx+idx_hash(policy->index)); | 599 | hlist_add_head(&policy->byidx, init_net.xfrm.policy_byidx+idx_hash(&init_net, policy->index)); |
600 | policy->curlft.add_time = get_seconds(); | 600 | policy->curlft.add_time = get_seconds(); |
601 | policy->curlft.use_time = 0; | 601 | policy->curlft.use_time = 0; |
602 | if (!mod_timer(&policy->timer, jiffies + HZ)) | 602 | if (!mod_timer(&policy->timer, jiffies + HZ)) |
@@ -698,7 +698,7 @@ struct xfrm_policy *xfrm_policy_byid(u8 type, int dir, u32 id, int delete, | |||
698 | 698 | ||
699 | *err = 0; | 699 | *err = 0; |
700 | write_lock_bh(&xfrm_policy_lock); | 700 | write_lock_bh(&xfrm_policy_lock); |
701 | chain = init_net.xfrm.policy_byidx + idx_hash(id); | 701 | chain = init_net.xfrm.policy_byidx + idx_hash(&init_net, id); |
702 | ret = NULL; | 702 | ret = NULL; |
703 | hlist_for_each_entry(pol, entry, chain, byidx) { | 703 | hlist_for_each_entry(pol, entry, chain, byidx) { |
704 | if (pol->type == type && pol->index == id) { | 704 | if (pol->type == type && pol->index == id) { |
@@ -1075,7 +1075,7 @@ static void __xfrm_policy_link(struct xfrm_policy *pol, int dir) | |||
1075 | 1075 | ||
1076 | list_add(&pol->walk.all, &net->xfrm.policy_all); | 1076 | list_add(&pol->walk.all, &net->xfrm.policy_all); |
1077 | hlist_add_head(&pol->bydst, chain); | 1077 | hlist_add_head(&pol->bydst, chain); |
1078 | hlist_add_head(&pol->byidx, net->xfrm.policy_byidx+idx_hash(pol->index)); | 1078 | hlist_add_head(&pol->byidx, net->xfrm.policy_byidx+idx_hash(net, pol->index)); |
1079 | net->xfrm.policy_count[dir]++; | 1079 | net->xfrm.policy_count[dir]++; |
1080 | xfrm_pol_hold(pol); | 1080 | xfrm_pol_hold(pol); |
1081 | 1081 | ||