Lines Matching refs:net
52 struct net *net; member
66 static void fib6_prune_clones(struct net *net, struct fib6_node *fn);
67 static struct rt6_info *fib6_find_prefix(struct net *net, struct fib6_node *fn);
68 static struct fib6_node *fib6_repair_tree(struct net *net, struct fib6_node *fn);
98 static int fib6_new_sernum(struct net *net) in fib6_new_sernum() argument
103 old = atomic_read(&net->ipv6.fib6_sernum); in fib6_new_sernum()
105 } while (atomic_cmpxchg(&net->ipv6.fib6_sernum, in fib6_new_sernum()
193 static void fib6_link_table(struct net *net, struct fib6_table *tb) in fib6_link_table() argument
209 hlist_add_head_rcu(&tb->tb6_hlist, &net->ipv6.fib_table_hash[h]); in fib6_link_table()
214 static struct fib6_table *fib6_alloc_table(struct net *net, u32 id) in fib6_alloc_table() argument
221 table->tb6_root.leaf = net->ipv6.ip6_null_entry; in fib6_alloc_table()
229 struct fib6_table *fib6_new_table(struct net *net, u32 id) in fib6_new_table() argument
235 tb = fib6_get_table(net, id); in fib6_new_table()
239 tb = fib6_alloc_table(net, id); in fib6_new_table()
241 fib6_link_table(net, tb); in fib6_new_table()
246 struct fib6_table *fib6_get_table(struct net *net, u32 id) in fib6_get_table() argument
256 head = &net->ipv6.fib_table_hash[h]; in fib6_get_table()
269 static void __net_init fib6_tables_init(struct net *net) in fib6_tables_init() argument
271 fib6_link_table(net, net->ipv6.fib6_main_tbl); in fib6_tables_init()
272 fib6_link_table(net, net->ipv6.fib6_local_tbl); in fib6_tables_init()
276 struct fib6_table *fib6_new_table(struct net *net, u32 id) in fib6_new_table() argument
278 return fib6_get_table(net, id); in fib6_new_table()
281 struct fib6_table *fib6_get_table(struct net *net, u32 id) in fib6_get_table() argument
283 return net->ipv6.fib6_main_tbl; in fib6_get_table()
286 struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, in fib6_rule_lookup() argument
291 rt = lookup(net, net->ipv6.fib6_main_tbl, fl6, flags); in fib6_rule_lookup()
295 rt = net->ipv6.ip6_null_entry; in fib6_rule_lookup()
302 static void __net_init fib6_tables_init(struct net *net) in fib6_tables_init() argument
304 fib6_link_table(net, net->ipv6.fib6_main_tbl); in fib6_tables_init()
392 struct net *net = sock_net(skb->sk); in inet6_dump_fib() local
425 arg.net = net; in inet6_dump_fib()
431 head = &net->ipv6.fib_table_hash[h]; in inet6_dump_fib()
706 struct net *net) in fib6_purge_rt() argument
717 fn->leaf = fib6_find_prefix(net, fn); in fib6_purge_rt()
922 static void fib6_start_gc(struct net *net, struct rt6_info *rt) in fib6_start_gc() argument
924 if (!timer_pending(&net->ipv6.ip6_fib_timer) && in fib6_start_gc()
926 mod_timer(&net->ipv6.ip6_fib_timer, in fib6_start_gc()
927 jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); in fib6_start_gc()
930 void fib6_force_start_gc(struct net *net) in fib6_force_start_gc() argument
932 if (!timer_pending(&net->ipv6.ip6_fib_timer)) in fib6_force_start_gc()
933 mod_timer(&net->ipv6.ip6_fib_timer, in fib6_force_start_gc()
934 jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); in fib6_force_start_gc()
1257 static struct rt6_info *fib6_find_prefix(struct net *net, struct fib6_node *fn) in fib6_find_prefix() argument
1260 return net->ipv6.ip6_null_entry; in fib6_find_prefix()
1278 static struct fib6_node *fib6_repair_tree(struct net *net, in fib6_repair_tree() argument
1308 fn->leaf = fib6_find_prefix(net, fn); in fib6_repair_tree()
1312 fn->leaf = net->ipv6.ip6_null_entry; in fib6_repair_tree()
1388 struct net *net = info->nl_net; in fib6_del_route() local
1395 net->ipv6.rt6_stats->fib_rt_entries--; in fib6_del_route()
1396 net->ipv6.rt6_stats->fib_discarded_routes++; in fib6_del_route()
1430 net->ipv6.rt6_stats->fib_route_nodes--; in fib6_del_route()
1431 fn = fib6_repair_tree(net, fn); in fib6_del_route()
1434 fib6_purge_rt(rt, fn, net); in fib6_del_route()
1442 struct net *net = info->nl_net; in fib6_del() local
1452 if (!fn || rt == net->ipv6.ip6_null_entry) in fib6_del()
1611 .nl_net = c->net, in fib6_clean_node()
1655 static void fib6_clean_tree(struct net *net, struct fib6_node *root, in fib6_clean_tree() argument
1669 c.net = net; in fib6_clean_tree()
1674 static void __fib6_clean_all(struct net *net, in __fib6_clean_all() argument
1684 head = &net->ipv6.fib_table_hash[h]; in __fib6_clean_all()
1687 fib6_clean_tree(net, &table->tb6_root, in __fib6_clean_all()
1695 void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *), in fib6_clean_all() argument
1698 __fib6_clean_all(net, func, FIB6_NO_SERNUM_CHANGE, arg); in fib6_clean_all()
1711 static void fib6_prune_clones(struct net *net, struct fib6_node *fn) in fib6_prune_clones() argument
1713 fib6_clean_tree(net, fn, fib6_prune_clone, true, in fib6_prune_clones()
1717 static void fib6_flush_trees(struct net *net) in fib6_flush_trees() argument
1719 int new_sernum = fib6_new_sernum(net); in fib6_flush_trees()
1721 __fib6_clean_all(net, NULL, new_sernum, NULL); in fib6_flush_trees()
1780 void fib6_run_gc(unsigned long expires, struct net *net, bool force) in fib6_run_gc() argument
1787 mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); in fib6_run_gc()
1791 net->ipv6.sysctl.ip6_rt_gc_interval; in fib6_run_gc()
1795 fib6_clean_all(net, fib6_age, NULL); in fib6_run_gc()
1797 net->ipv6.ip6_rt_last_gc = now; in fib6_run_gc()
1800 mod_timer(&net->ipv6.ip6_fib_timer, in fib6_run_gc()
1802 + net->ipv6.sysctl.ip6_rt_gc_interval)); in fib6_run_gc()
1804 del_timer(&net->ipv6.ip6_fib_timer); in fib6_run_gc()
1810 fib6_run_gc(0, (struct net *)arg, true); in fib6_gc_timer_cb()
1813 static int __net_init fib6_net_init(struct net *net) in fib6_net_init() argument
1817 setup_timer(&net->ipv6.ip6_fib_timer, fib6_gc_timer_cb, (unsigned long)net); in fib6_net_init()
1819 net->ipv6.rt6_stats = kzalloc(sizeof(*net->ipv6.rt6_stats), GFP_KERNEL); in fib6_net_init()
1820 if (!net->ipv6.rt6_stats) in fib6_net_init()
1826 net->ipv6.fib_table_hash = kzalloc(size, GFP_KERNEL); in fib6_net_init()
1827 if (!net->ipv6.fib_table_hash) in fib6_net_init()
1830 net->ipv6.fib6_main_tbl = kzalloc(sizeof(*net->ipv6.fib6_main_tbl), in fib6_net_init()
1832 if (!net->ipv6.fib6_main_tbl) in fib6_net_init()
1835 net->ipv6.fib6_main_tbl->tb6_id = RT6_TABLE_MAIN; in fib6_net_init()
1836 net->ipv6.fib6_main_tbl->tb6_root.leaf = net->ipv6.ip6_null_entry; in fib6_net_init()
1837 net->ipv6.fib6_main_tbl->tb6_root.fn_flags = in fib6_net_init()
1839 inet_peer_base_init(&net->ipv6.fib6_main_tbl->tb6_peers); in fib6_net_init()
1842 net->ipv6.fib6_local_tbl = kzalloc(sizeof(*net->ipv6.fib6_local_tbl), in fib6_net_init()
1844 if (!net->ipv6.fib6_local_tbl) in fib6_net_init()
1846 net->ipv6.fib6_local_tbl->tb6_id = RT6_TABLE_LOCAL; in fib6_net_init()
1847 net->ipv6.fib6_local_tbl->tb6_root.leaf = net->ipv6.ip6_null_entry; in fib6_net_init()
1848 net->ipv6.fib6_local_tbl->tb6_root.fn_flags = in fib6_net_init()
1850 inet_peer_base_init(&net->ipv6.fib6_local_tbl->tb6_peers); in fib6_net_init()
1852 fib6_tables_init(net); in fib6_net_init()
1858 kfree(net->ipv6.fib6_main_tbl); in fib6_net_init()
1861 kfree(net->ipv6.fib_table_hash); in fib6_net_init()
1863 kfree(net->ipv6.rt6_stats); in fib6_net_init()
1868 static void fib6_net_exit(struct net *net) in fib6_net_exit() argument
1870 rt6_ifdown(net, NULL); in fib6_net_exit()
1871 del_timer_sync(&net->ipv6.ip6_fib_timer); in fib6_net_exit()
1874 inetpeer_invalidate_tree(&net->ipv6.fib6_local_tbl->tb6_peers); in fib6_net_exit()
1875 kfree(net->ipv6.fib6_local_tbl); in fib6_net_exit()
1877 inetpeer_invalidate_tree(&net->ipv6.fib6_main_tbl->tb6_peers); in fib6_net_exit()
1878 kfree(net->ipv6.fib6_main_tbl); in fib6_net_exit()
1879 kfree(net->ipv6.fib_table_hash); in fib6_net_exit()
1880 kfree(net->ipv6.rt6_stats); in fib6_net_exit()
1991 struct net *net) in ipv6_route_seq_next_table() argument
2006 hlist_first_rcu(&net->ipv6.fib_table_hash[h++])); in ipv6_route_seq_next_table()
2026 struct net *net = seq_file_net(seq); in ipv6_route_seq_next() local
2053 iter->tbl = ipv6_route_seq_next_table(iter->tbl, net); in ipv6_route_seq_next()
2064 struct net *net = seq_file_net(seq); in ipv6_route_seq_start() local
2068 iter->tbl = ipv6_route_seq_next_table(NULL, net); in ipv6_route_seq_start()