Lines Matching refs:net
51 struct net *net; member
65 static void fib6_prune_clones(struct net *net, struct fib6_node *fn);
66 static struct rt6_info *fib6_find_prefix(struct net *net, struct fib6_node *fn);
67 static struct fib6_node *fib6_repair_tree(struct net *net, struct fib6_node *fn);
97 static int fib6_new_sernum(struct net *net) in fib6_new_sernum() argument
102 old = atomic_read(&net->ipv6.fib6_sernum); in fib6_new_sernum()
104 } while (atomic_cmpxchg(&net->ipv6.fib6_sernum, in fib6_new_sernum()
163 static void fib6_link_table(struct net *net, struct fib6_table *tb) in fib6_link_table() argument
179 hlist_add_head_rcu(&tb->tb6_hlist, &net->ipv6.fib_table_hash[h]); in fib6_link_table()
184 static struct fib6_table *fib6_alloc_table(struct net *net, u32 id) in fib6_alloc_table() argument
191 table->tb6_root.leaf = net->ipv6.ip6_null_entry; in fib6_alloc_table()
199 struct fib6_table *fib6_new_table(struct net *net, u32 id) in fib6_new_table() argument
205 tb = fib6_get_table(net, id); in fib6_new_table()
209 tb = fib6_alloc_table(net, id); in fib6_new_table()
211 fib6_link_table(net, tb); in fib6_new_table()
216 struct fib6_table *fib6_get_table(struct net *net, u32 id) in fib6_get_table() argument
226 head = &net->ipv6.fib_table_hash[h]; in fib6_get_table()
238 static void __net_init fib6_tables_init(struct net *net) in fib6_tables_init() argument
240 fib6_link_table(net, net->ipv6.fib6_main_tbl); in fib6_tables_init()
241 fib6_link_table(net, net->ipv6.fib6_local_tbl); in fib6_tables_init()
245 struct fib6_table *fib6_new_table(struct net *net, u32 id) in fib6_new_table() argument
247 return fib6_get_table(net, id); in fib6_new_table()
250 struct fib6_table *fib6_get_table(struct net *net, u32 id) in fib6_get_table() argument
252 return net->ipv6.fib6_main_tbl; in fib6_get_table()
255 struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, in fib6_rule_lookup() argument
258 return (struct dst_entry *) lookup(net, net->ipv6.fib6_main_tbl, fl6, flags); in fib6_rule_lookup()
261 static void __net_init fib6_tables_init(struct net *net) in fib6_tables_init() argument
263 fib6_link_table(net, net->ipv6.fib6_main_tbl); in fib6_tables_init()
351 struct net *net = sock_net(skb->sk); in inet6_dump_fib() local
384 arg.net = net; in inet6_dump_fib()
390 head = &net->ipv6.fib_table_hash[h]; in inet6_dump_fib()
665 struct net *net) in fib6_purge_rt() argument
676 fn->leaf = fib6_find_prefix(net, fn); in fib6_purge_rt()
880 static void fib6_start_gc(struct net *net, struct rt6_info *rt) in fib6_start_gc() argument
882 if (!timer_pending(&net->ipv6.ip6_fib_timer) && in fib6_start_gc()
884 mod_timer(&net->ipv6.ip6_fib_timer, in fib6_start_gc()
885 jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); in fib6_start_gc()
888 void fib6_force_start_gc(struct net *net) in fib6_force_start_gc() argument
890 if (!timer_pending(&net->ipv6.ip6_fib_timer)) in fib6_force_start_gc()
891 mod_timer(&net->ipv6.ip6_fib_timer, in fib6_force_start_gc()
892 jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); in fib6_force_start_gc()
1208 static struct rt6_info *fib6_find_prefix(struct net *net, struct fib6_node *fn) in fib6_find_prefix() argument
1211 return net->ipv6.ip6_null_entry; in fib6_find_prefix()
1229 static struct fib6_node *fib6_repair_tree(struct net *net, in fib6_repair_tree() argument
1259 fn->leaf = fib6_find_prefix(net, fn); in fib6_repair_tree()
1263 fn->leaf = net->ipv6.ip6_null_entry; in fib6_repair_tree()
1339 struct net *net = info->nl_net; in fib6_del_route() local
1346 net->ipv6.rt6_stats->fib_rt_entries--; in fib6_del_route()
1347 net->ipv6.rt6_stats->fib_discarded_routes++; in fib6_del_route()
1381 net->ipv6.rt6_stats->fib_route_nodes--; in fib6_del_route()
1382 fn = fib6_repair_tree(net, fn); in fib6_del_route()
1385 fib6_purge_rt(rt, fn, net); in fib6_del_route()
1393 struct net *net = info->nl_net; in fib6_del() local
1403 if (!fn || rt == net->ipv6.ip6_null_entry) in fib6_del()
1562 .nl_net = c->net, in fib6_clean_node()
1606 static void fib6_clean_tree(struct net *net, struct fib6_node *root, in fib6_clean_tree() argument
1620 c.net = net; in fib6_clean_tree()
1625 static void __fib6_clean_all(struct net *net, in __fib6_clean_all() argument
1635 head = &net->ipv6.fib_table_hash[h]; in __fib6_clean_all()
1638 fib6_clean_tree(net, &table->tb6_root, in __fib6_clean_all()
1646 void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *), in fib6_clean_all() argument
1649 __fib6_clean_all(net, func, FIB6_NO_SERNUM_CHANGE, arg); in fib6_clean_all()
1662 static void fib6_prune_clones(struct net *net, struct fib6_node *fn) in fib6_prune_clones() argument
1664 fib6_clean_tree(net, fn, fib6_prune_clone, true, in fib6_prune_clones()
1668 static void fib6_flush_trees(struct net *net) in fib6_flush_trees() argument
1670 int new_sernum = fib6_new_sernum(net); in fib6_flush_trees()
1672 __fib6_clean_all(net, NULL, new_sernum, NULL); in fib6_flush_trees()
1731 void fib6_run_gc(unsigned long expires, struct net *net, bool force) in fib6_run_gc() argument
1738 mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); in fib6_run_gc()
1742 net->ipv6.sysctl.ip6_rt_gc_interval; in fib6_run_gc()
1746 fib6_clean_all(net, fib6_age, NULL); in fib6_run_gc()
1748 net->ipv6.ip6_rt_last_gc = now; in fib6_run_gc()
1751 mod_timer(&net->ipv6.ip6_fib_timer, in fib6_run_gc()
1753 + net->ipv6.sysctl.ip6_rt_gc_interval)); in fib6_run_gc()
1755 del_timer(&net->ipv6.ip6_fib_timer); in fib6_run_gc()
1761 fib6_run_gc(0, (struct net *)arg, true); in fib6_gc_timer_cb()
1764 static int __net_init fib6_net_init(struct net *net) in fib6_net_init() argument
1768 setup_timer(&net->ipv6.ip6_fib_timer, fib6_gc_timer_cb, (unsigned long)net); in fib6_net_init()
1770 net->ipv6.rt6_stats = kzalloc(sizeof(*net->ipv6.rt6_stats), GFP_KERNEL); in fib6_net_init()
1771 if (!net->ipv6.rt6_stats) in fib6_net_init()
1777 net->ipv6.fib_table_hash = kzalloc(size, GFP_KERNEL); in fib6_net_init()
1778 if (!net->ipv6.fib_table_hash) in fib6_net_init()
1781 net->ipv6.fib6_main_tbl = kzalloc(sizeof(*net->ipv6.fib6_main_tbl), in fib6_net_init()
1783 if (!net->ipv6.fib6_main_tbl) in fib6_net_init()
1786 net->ipv6.fib6_main_tbl->tb6_id = RT6_TABLE_MAIN; in fib6_net_init()
1787 net->ipv6.fib6_main_tbl->tb6_root.leaf = net->ipv6.ip6_null_entry; in fib6_net_init()
1788 net->ipv6.fib6_main_tbl->tb6_root.fn_flags = in fib6_net_init()
1790 inet_peer_base_init(&net->ipv6.fib6_main_tbl->tb6_peers); in fib6_net_init()
1793 net->ipv6.fib6_local_tbl = kzalloc(sizeof(*net->ipv6.fib6_local_tbl), in fib6_net_init()
1795 if (!net->ipv6.fib6_local_tbl) in fib6_net_init()
1797 net->ipv6.fib6_local_tbl->tb6_id = RT6_TABLE_LOCAL; in fib6_net_init()
1798 net->ipv6.fib6_local_tbl->tb6_root.leaf = net->ipv6.ip6_null_entry; in fib6_net_init()
1799 net->ipv6.fib6_local_tbl->tb6_root.fn_flags = in fib6_net_init()
1801 inet_peer_base_init(&net->ipv6.fib6_local_tbl->tb6_peers); in fib6_net_init()
1803 fib6_tables_init(net); in fib6_net_init()
1809 kfree(net->ipv6.fib6_main_tbl); in fib6_net_init()
1812 kfree(net->ipv6.fib_table_hash); in fib6_net_init()
1814 kfree(net->ipv6.rt6_stats); in fib6_net_init()
1819 static void fib6_net_exit(struct net *net) in fib6_net_exit() argument
1821 rt6_ifdown(net, NULL); in fib6_net_exit()
1822 del_timer_sync(&net->ipv6.ip6_fib_timer); in fib6_net_exit()
1825 inetpeer_invalidate_tree(&net->ipv6.fib6_local_tbl->tb6_peers); in fib6_net_exit()
1826 kfree(net->ipv6.fib6_local_tbl); in fib6_net_exit()
1828 inetpeer_invalidate_tree(&net->ipv6.fib6_main_tbl->tb6_peers); in fib6_net_exit()
1829 kfree(net->ipv6.fib6_main_tbl); in fib6_net_exit()
1830 kfree(net->ipv6.fib_table_hash); in fib6_net_exit()
1831 kfree(net->ipv6.rt6_stats); in fib6_net_exit()
1942 struct net *net) in ipv6_route_seq_next_table() argument
1957 hlist_first_rcu(&net->ipv6.fib_table_hash[h++])); in ipv6_route_seq_next_table()
1977 struct net *net = seq_file_net(seq); in ipv6_route_seq_next() local
2004 iter->tbl = ipv6_route_seq_next_table(iter->tbl, net); in ipv6_route_seq_next()
2015 struct net *net = seq_file_net(seq); in ipv6_route_seq_start() local
2019 iter->tbl = ipv6_route_seq_next_table(NULL, net); in ipv6_route_seq_start()