Lines Matching defs:net
32 #include <net/dst.h>
33 #include <net/flow.h>
34 #include <net/inet_ecn.h>
35 #include <net/xfrm.h>
36 #include <net/ip.h>
37 #include <net/gre.h>
39 #include <net/mip6.h>
42 #include <net/snmp.h>
45 #include <net/espintcp.h>
115 possible_net_t net;
174 xfrm_policy_inexact_lookup(struct net *net, u8 type, u16 family, u8 dir,
178 xfrm_policy_inexact_lookup_rcu(struct net *net,
254 struct dst_entry *__xfrm_dst_lookup(struct net *net, int tos, int oif,
266 dst = afinfo->dst_lookup(net, tos, oif, saddr, daddr, mark);
280 struct net *net = xs_net(x);
294 dst = __xfrm_dst_lookup(net, tos, oif, saddr, daddr, family, mark);
388 struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp)
395 write_pnet(&policy->xp_net, net);
457 static inline unsigned int idx_hash(struct net *net, u32 index)
459 return __idx_hash(index, net->xfrm.policy_idx_hmask);
463 static void __get_hash_thresh(struct net *net,
469 *dbits = net->xfrm.policy_bydst[dir].dbits4;
470 *sbits = net->xfrm.policy_bydst[dir].sbits4;
474 *dbits = net->xfrm.policy_bydst[dir].dbits6;
475 *sbits = net->xfrm.policy_bydst[dir].sbits6;
484 static struct hlist_head *policy_hash_bysel(struct net *net,
488 unsigned int hmask = net->xfrm.policy_bydst[dir].hmask;
493 __get_hash_thresh(net, family, dir, &dbits, &sbits);
499 return rcu_dereference_check(net->xfrm.policy_bydst[dir].table,
500 lockdep_is_held(&net->xfrm.xfrm_policy_lock)) + hash;
503 static struct hlist_head *policy_hash_direct(struct net *net,
508 unsigned int hmask = net->xfrm.policy_bydst[dir].hmask;
513 __get_hash_thresh(net, family, dir, &dbits, &sbits);
516 return rcu_dereference_check(net->xfrm.policy_bydst[dir].table,
517 lockdep_is_held(&net->xfrm.xfrm_policy_lock)) + hash;
520 static void xfrm_dst_hash_transfer(struct net *net,
536 __get_hash_thresh(net, pol->family, dir, &dbits, &sbits);
577 static void xfrm_bydst_resize(struct net *net, int dir)
579 unsigned int hmask = net->xfrm.policy_bydst[dir].hmask;
589 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
590 write_seqcount_begin(&net->xfrm.xfrm_policy_hash_generation);
592 odst = rcu_dereference_protected(net->xfrm.policy_bydst[dir].table,
593 lockdep_is_held(&net->xfrm.xfrm_policy_lock));
596 xfrm_dst_hash_transfer(net, odst + i, ndst, nhashmask, dir);
598 rcu_assign_pointer(net->xfrm.policy_bydst[dir].table, ndst);
599 net->xfrm.policy_bydst[dir].hmask = nhashmask;
601 write_seqcount_end(&net->xfrm.xfrm_policy_hash_generation);
602 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
609 static void xfrm_byidx_resize(struct net *net)
611 unsigned int hmask = net->xfrm.policy_idx_hmask;
614 struct hlist_head *oidx = net->xfrm.policy_byidx;
621 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
626 net->xfrm.policy_byidx = nidx;
627 net->xfrm.policy_idx_hmask = nhashmask;
629 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
634 static inline int xfrm_bydst_should_resize(struct net *net, int dir, int *total)
636 unsigned int cnt = net->xfrm.policy_count[dir];
637 unsigned int hmask = net->xfrm.policy_bydst[dir].hmask;
649 static inline int xfrm_byidx_should_resize(struct net *net, int total)
651 unsigned int hmask = net->xfrm.policy_idx_hmask;
660 void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si)
662 si->incnt = net->xfrm.policy_count[XFRM_POLICY_IN];
663 si->outcnt = net->xfrm.policy_count[XFRM_POLICY_OUT];
664 si->fwdcnt = net->xfrm.policy_count[XFRM_POLICY_FWD];
665 si->inscnt = net->xfrm.policy_count[XFRM_POLICY_IN+XFRM_POLICY_MAX];
666 si->outscnt = net->xfrm.policy_count[XFRM_POLICY_OUT+XFRM_POLICY_MAX];
667 si->fwdscnt = net->xfrm.policy_count[XFRM_POLICY_FWD+XFRM_POLICY_MAX];
668 si->spdhcnt = net->xfrm.policy_idx_hmask;
676 struct net *net = container_of(work, struct net, xfrm.policy_hash_work);
683 if (xfrm_bydst_should_resize(net, dir, &total))
684 xfrm_bydst_resize(net, dir);
686 if (xfrm_byidx_should_resize(net, total))
687 xfrm_byidx_resize(net);
706 struct net *net = xp_net(pol);
708 lockdep_assert_held(&net->xfrm.xfrm_policy_lock);
710 write_pnet(&k.net, net);
724 seqcount_spinlock_init(&bin->count, &net->xfrm.xfrm_policy_lock);
730 list_add(&bin->inexact_bins, &net->xfrm.inexact_bins);
840 static void xfrm_policy_inexact_list_reinsert(struct net *net,
850 list_for_each_entry_reverse(policy, &net->xfrm.policy_all, walk.all) {
903 static void xfrm_policy_inexact_node_reinsert(struct net *net,
942 xfrm_policy_inexact_list_reinsert(net, node, family);
961 static void xfrm_policy_inexact_node_merge(struct net *net,
977 xfrm_policy_inexact_node_reinsert(net, node, &n->root,
986 xfrm_policy_inexact_list_reinsert(net, n, family);
990 xfrm_policy_inexact_insert_node(struct net *net,
1042 xfrm_policy_inexact_node_merge(net, node,
1109 struct net *net = read_pnet(&b->k.net);
1111 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
1113 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1116 static void __xfrm_policy_inexact_flush(struct net *net)
1120 lockdep_assert_held(&net->xfrm.xfrm_policy_lock);
1122 list_for_each_entry_safe(bin, t, &net->xfrm.inexact_bins, inexact_bins)
1131 struct net *net;
1133 net = xp_net(policy);
1134 lockdep_assert_held(&net->xfrm.xfrm_policy_lock);
1143 n = xfrm_policy_inexact_insert_node(net,
1158 n = xfrm_policy_inexact_insert_node(net,
1174 n = xfrm_policy_inexact_insert_node(net,
1192 struct net *net;
1198 net = xp_net(policy);
1199 lockdep_assert_held(&net->xfrm.xfrm_policy_lock);
1213 chain = &net->xfrm.policy_inexact[dir];
1224 struct net *net = container_of(work, struct net,
1241 seq = read_seqbegin(&net->xfrm.policy_hthresh.lock);
1243 lbits4 = net->xfrm.policy_hthresh.lbits4;
1244 rbits4 = net->xfrm.policy_hthresh.rbits4;
1245 lbits6 = net->xfrm.policy_hthresh.lbits6;
1246 rbits6 = net->xfrm.policy_hthresh.rbits6;
1247 } while (read_seqretry(&net->xfrm.policy_hthresh.lock, seq));
1249 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
1250 write_seqcount_begin(&net->xfrm.xfrm_policy_hash_generation);
1255 list_for_each_entry(policy, &net->xfrm.policy_all, walk.all) {
1301 &net->xfrm.policy_inexact[dir],
1307 hmask = net->xfrm.policy_bydst[dir].hmask;
1308 odst = net->xfrm.policy_bydst[dir].table;
1315 net->xfrm.policy_bydst[dir].dbits4 = rbits4;
1316 net->xfrm.policy_bydst[dir].sbits4 = lbits4;
1317 net->xfrm.policy_bydst[dir].dbits6 = rbits6;
1318 net->xfrm.policy_bydst[dir].sbits6 = lbits6;
1321 net->xfrm.policy_bydst[dir].dbits4 = lbits4;
1322 net->xfrm.policy_bydst[dir].sbits4 = rbits4;
1323 net->xfrm.policy_bydst[dir].dbits6 = lbits6;
1324 net->xfrm.policy_bydst[dir].sbits6 = rbits6;
1329 list_for_each_entry_reverse(policy, &net->xfrm.policy_all, walk.all) {
1338 chain = policy_hash_bysel(net, &policy->selector,
1361 __xfrm_policy_inexact_flush(net);
1362 write_seqcount_end(&net->xfrm.xfrm_policy_hash_generation);
1363 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1368 void xfrm_policy_hash_rebuild(struct net *net)
1370 schedule_work(&net->xfrm.policy_hthresh.work);
1376 static u32 xfrm_gen_index(struct net *net, int dir, u32 index)
1385 idx = (net->xfrm.idx_generator | dir);
1386 net->xfrm.idx_generator += 8;
1394 list = net->xfrm.policy_byidx + idx_hash(net, idx);
1460 return jhash_3words(a, k->if_id, net_hash_mix(read_pnet(&k->net)),
1478 if (!net_eq(read_pnet(&b->k.net), read_pnet(&key->net)))
1579 struct net *net = xp_net(policy);
1583 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
1584 chain = policy_hash_bysel(net, &policy->selector, policy->family, dir);
1591 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1599 rt_genid_bump_ipv4(net);
1601 rt_genid_bump_ipv6(net);
1607 policy->index = delpol ? delpol->index : xfrm_gen_index(net, dir, policy->index);
1608 hlist_add_head(&policy->byidx, net->xfrm.policy_byidx+idx_hash(net, policy->index));
1613 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1617 else if (xfrm_bydst_should_resize(net, dir, NULL))
1618 schedule_work(&net->xfrm.policy_hash_work);
1647 xfrm_policy_bysel_ctx(struct net *net, const struct xfrm_mark *mark, u32 if_id,
1656 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
1657 chain = policy_hash_bysel(net, sel, sel->family, dir);
1662 bin = xfrm_policy_inexact_lookup(net, type,
1665 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1672 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1699 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1706 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1717 xfrm_policy_byid(struct net *net, const struct xfrm_mark *mark, u32 if_id,
1728 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
1729 chain = net->xfrm.policy_byidx + idx_hash(net, id);
1739 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1748 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1758 xfrm_policy_flush_secctx_check(struct net *net, u8 type, bool task_valid)
1763 list_for_each_entry(pol, &net->xfrm.policy_all, walk.all) {
1778 static inline int xfrm_dev_policy_flush_secctx_check(struct net *net,
1785 list_for_each_entry(pol, &net->xfrm.policy_all, walk.all) {
1801 xfrm_policy_flush_secctx_check(struct net *net, u8 type, bool task_valid)
1806 static inline int xfrm_dev_policy_flush_secctx_check(struct net *net,
1814 int xfrm_policy_flush(struct net *net, u8 type, bool task_valid)
1819 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
1821 err = xfrm_policy_flush_secctx_check(net, type, task_valid);
1826 list_for_each_entry(pol, &net->xfrm.policy_all, walk.all) {
1836 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1841 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
1845 __xfrm_policy_inexact_flush(net);
1849 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1854 int xfrm_dev_policy_flush(struct net *net, struct net_device *dev,
1860 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
1862 err = xfrm_dev_policy_flush_secctx_check(net, dev, task_valid);
1867 list_for_each_entry(pol, &net->xfrm.policy_all, walk.all) {
1877 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1882 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
1886 __xfrm_policy_inexact_flush(net);
1890 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1895 int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk,
1910 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
1912 x = list_first_entry(&net->xfrm.policy_all, struct xfrm_policy_walk_entry, all);
1917 list_for_each_entry_from(x, &net->xfrm.policy_all, all) {
1938 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
1952 void xfrm_policy_walk_done(struct xfrm_policy_walk *walk, struct net *net)
1957 spin_lock_bh(&net->xfrm.xfrm_policy_lock); /*FIXME where is net? */
1959 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
2060 xfrm_policy_inexact_lookup_rcu(struct net *net, u8 type, u16 family,
2070 write_pnet(&k.net, net);
2077 xfrm_policy_inexact_lookup(struct net *net, u8 type, u16 family,
2082 lockdep_assert_held(&net->xfrm.xfrm_policy_lock);
2085 bin = xfrm_policy_inexact_lookup_rcu(net, type, family, dir, if_id);
2154 static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
2175 sequence = read_seqcount_begin(&net->xfrm.xfrm_policy_hash_generation);
2176 chain = policy_hash_direct(net, daddr, saddr, family, dir);
2177 } while (read_seqcount_retry(&net->xfrm.xfrm_policy_hash_generation, sequence));
2197 bin = xfrm_policy_inexact_lookup_rcu(net, type, family, dir, if_id);
2211 if (read_seqcount_retry(&net->xfrm.xfrm_policy_hash_generation, sequence))
2222 static struct xfrm_policy *xfrm_policy_lookup(struct net *net,
2229 pol = xfrm_policy_lookup_bytype(net, XFRM_POLICY_TYPE_SUB, fl, family,
2234 return xfrm_policy_lookup_bytype(net, XFRM_POLICY_TYPE_MAIN, fl, family,
2283 struct net *net = xp_net(pol);
2285 list_add(&pol->walk.all, &net->xfrm.policy_all);
2286 net->xfrm.policy_count[dir]++;
2293 struct net *net = xp_net(pol);
2306 net->xfrm.policy_count[dir]--;
2323 struct net *net = xp_net(pol);
2325 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
2327 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
2339 struct net *net = sock_net(sk);
2347 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
2349 lockdep_is_held(&net->xfrm.xfrm_policy_lock));
2352 pol->index = xfrm_gen_index(net, XFRM_POLICY_MAX+dir, 0);
2365 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
2376 struct net *net = xp_net(old);
2397 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
2399 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
2428 xfrm_get_saddr(struct net *net, int oif, xfrm_address_t *local,
2436 err = afinfo->get_saddr(net, oif, local, remote, mark);
2447 struct net *net = xp_net(policy);
2465 error = xfrm_get_saddr(net, fl->flowi_oif,
2548 static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
2559 dst_ops = &net->xfrm.xfrm4_dst_ops;
2563 dst_ops = &net->xfrm.xfrm6_dst_ops;
2622 struct net *net = xp_net(policy);
2643 struct xfrm_dst *xdst = xfrm_alloc_dst(net, family);
2806 struct net *net = xp_net(pols[0]);
2820 XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
2826 XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTBUNDLEGENERROR);
2845 struct net *net = xp_net(pol);
2868 dst = xfrm_lookup(net, xfrm_dst_path(dst), &fl, sk, XFRM_LOOKUP_QUEUE);
2903 dst = xfrm_lookup(net, xfrm_dst_path(skb_dst(skb)), &fl, skb->sk, 0);
2913 dst_output(net, skb->sk, skb);
2926 static int xdst_queue_output(struct net *net, struct sock *sk, struct sk_buff *skb)
2968 static struct xfrm_dst *xfrm_create_dummy_bundle(struct net *net,
2980 xdst = xfrm_alloc_dst(net, family);
2985 net->xfrm.sysctl_larval_drop ||
3027 static struct xfrm_dst *xfrm_bundle_lookup(struct net *net,
3039 pols[0] = xfrm_policy_lookup(net, fl, family, dir, if_id);
3072 xdst = xfrm_create_dummy_bundle(net, xflo, fl, num_xfrms, family);
3084 XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
3090 static struct dst_entry *make_blackhole(struct net *net, u16 family,
3100 ret = afinfo->blackhole_route(net, dst_orig);
3115 struct dst_entry *xfrm_lookup_with_ifid(struct net *net,
3177 !net->xfrm.policy_count[XFRM_POLICY_OUT]))
3180 xdst = xfrm_bundle_lookup(net, fl, family, dir, &xflo, if_id);
3202 if (net->xfrm.sysctl_larval_drop) {
3203 XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES);
3210 XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES);
3229 XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLBLOCK);
3249 net->xfrm.policy_default[dir] == XFRM_USERPOLICY_BLOCK) {
3273 struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
3277 return xfrm_lookup_with_ifid(net, dst_orig, fl, sk, flags, 0);
3284 struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig,
3288 struct dst_entry *dst = xfrm_lookup(net, dst_orig, fl, sk,
3293 return make_blackhole(net, dst_orig->ops->family, dst_orig);
3599 struct net *net = dev_net(skb->dev);
3620 net = r.net;
3629 XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR);
3643 XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATEMISMATCH);
3654 XFRM_INC_STATS(net, LINUX_MIB_XFRMINPOLERROR);
3660 pol = xfrm_policy_lookup(net, &fl, family, dir, if_id);
3663 XFRM_INC_STATS(net, LINUX_MIB_XFRMINPOLERROR);
3668 if (net->xfrm.policy_default[dir] == XFRM_USERPOLICY_BLOCK) {
3669 XFRM_INC_STATS(net, LINUX_MIB_XFRMINNOPOLS);
3675 XFRM_INC_STATS(net, LINUX_MIB_XFRMINNOPOLS);
3688 pols[1] = xfrm_policy_lookup_bytype(net, XFRM_POLICY_TYPE_MAIN,
3693 XFRM_INC_STATS(net, LINUX_MIB_XFRMINPOLERROR);
3720 XFRM_INC_STATS(net, LINUX_MIB_XFRMINPOLBLOCK);
3724 XFRM_INC_STATS(net, LINUX_MIB_XFRMINBUFFERERROR);
3752 XFRM_INC_STATS(net, LINUX_MIB_XFRMINTMPLMISMATCH);
3758 XFRM_INC_STATS(net, LINUX_MIB_XFRMINTMPLMISMATCH);
3767 XFRM_INC_STATS(net, LINUX_MIB_XFRMINPOLBLOCK);
3779 struct net *net = dev_net(skb->dev);
3785 XFRM_INC_STATS(net, LINUX_MIB_XFRMFWDHDRERROR);
3791 XFRM_INC_STATS(net, LINUX_MIB_XFRMFWDHDRERROR);
3795 dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, XFRM_LOOKUP_QUEUE);
4084 static int __net_init xfrm_statistics_init(struct net *net)
4087 net->mib.xfrm_statistics = alloc_percpu(struct linux_xfrm_mib);
4088 if (!net->mib.xfrm_statistics)
4090 rv = xfrm_proc_init(net);
4092 free_percpu(net->mib.xfrm_statistics);
4096 static void xfrm_statistics_fini(struct net *net)
4098 xfrm_proc_fini(net);
4099 free_percpu(net->mib.xfrm_statistics);
4102 static int __net_init xfrm_statistics_init(struct net *net)
4107 static void xfrm_statistics_fini(struct net *net)
4112 static int __net_init xfrm_policy_init(struct net *net)
4117 if (net_eq(net, &init_net)) {
4130 net->xfrm.policy_byidx = xfrm_hash_alloc(sz);
4131 if (!net->xfrm.policy_byidx)
4133 net->xfrm.policy_idx_hmask = hmask;
4138 net->xfrm.policy_count[dir] = 0;
4139 net->xfrm.policy_count[XFRM_POLICY_MAX + dir] = 0;
4140 INIT_HLIST_HEAD(&net->xfrm.policy_inexact[dir]);
4142 htab = &net->xfrm.policy_bydst[dir];
4152 net->xfrm.policy_hthresh.lbits4 = 32;
4153 net->xfrm.policy_hthresh.rbits4 = 32;
4154 net->xfrm.policy_hthresh.lbits6 = 128;
4155 net->xfrm.policy_hthresh.rbits6 = 128;
4157 seqlock_init(&net->xfrm.policy_hthresh.lock);
4159 INIT_LIST_HEAD(&net->xfrm.policy_all);
4160 INIT_LIST_HEAD(&net->xfrm.inexact_bins);
4161 INIT_WORK(&net->xfrm.policy_hash_work, xfrm_hash_resize);
4162 INIT_WORK(&net->xfrm.policy_hthresh.work, xfrm_hash_rebuild);
4169 htab = &net->xfrm.policy_bydst[dir];
4172 xfrm_hash_free(net->xfrm.policy_byidx, sz);
4177 static void xfrm_policy_fini(struct net *net)
4183 flush_work(&net->xfrm.policy_hash_work);
4185 xfrm_policy_flush(net, XFRM_POLICY_TYPE_SUB, false);
4187 xfrm_policy_flush(net, XFRM_POLICY_TYPE_MAIN, false);
4189 WARN_ON(!list_empty(&net->xfrm.policy_all));
4194 WARN_ON(!hlist_empty(&net->xfrm.policy_inexact[dir]));
4196 htab = &net->xfrm.policy_bydst[dir];
4202 sz = (net->xfrm.policy_idx_hmask + 1) * sizeof(struct hlist_head);
4203 WARN_ON(!hlist_empty(net->xfrm.policy_byidx));
4204 xfrm_hash_free(net->xfrm.policy_byidx, sz);
4206 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
4207 list_for_each_entry_safe(b, t, &net->xfrm.inexact_bins, inexact_bins)
4209 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
4212 static int __net_init xfrm_net_init(struct net *net)
4216 /* Initialize the per-net locks here */
4217 spin_lock_init(&net->xfrm.xfrm_state_lock);
4218 spin_lock_init(&net->xfrm.xfrm_policy_lock);
4219 seqcount_spinlock_init(&net->xfrm.xfrm_policy_hash_generation, &net->xfrm.xfrm_policy_lock);
4220 mutex_init(&net->xfrm.xfrm_cfg_mutex);
4221 net->xfrm.policy_default[XFRM_POLICY_IN] = XFRM_USERPOLICY_ACCEPT;
4222 net->xfrm.policy_default[XFRM_POLICY_FWD] = XFRM_USERPOLICY_ACCEPT;
4223 net->xfrm.policy_default[XFRM_POLICY_OUT] = XFRM_USERPOLICY_ACCEPT;
4225 rv = xfrm_statistics_init(net);
4228 rv = xfrm_state_init(net);
4231 rv = xfrm_policy_init(net);
4234 rv = xfrm_sysctl_init(net);
4241 xfrm_policy_fini(net);
4243 xfrm_state_fini(net);
4245 xfrm_statistics_fini(net);
4250 static void __net_exit xfrm_net_exit(struct net *net)
4252 xfrm_sysctl_fini(net);
4253 xfrm_policy_fini(net);
4254 xfrm_state_fini(net);
4255 xfrm_statistics_fini(net);
4362 u8 dir, u8 type, struct net *net, u32 if_id)
4368 spin_lock_bh(&net->xfrm.xfrm_policy_lock);
4369 chain = policy_hash_direct(net, &sel->daddr, &sel->saddr, sel->family, dir);
4379 chain = &net->xfrm.policy_inexact[dir];
4394 spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
4509 struct xfrm_kmaddress *k, struct net *net,
4532 pol = xfrm_migrate_policy_find(sel, dir, type, net, if_id);
4541 if ((x = xfrm_migrate_state_find(mp, net, if_id))) {