• Home
  • Raw
  • Download

Lines Matching refs:net

42 	struct net *net;  member
55 static struct fib6_info *fib6_find_prefix(struct net *net,
58 static struct fib6_node *fib6_repair_tree(struct net *net,
61 static int fib6_walk(struct net *net, struct fib6_walker *w);
73 #define FOR_WALKERS(net, w) \ argument
74 list_for_each_entry(w, &(net)->ipv6.fib6_walkers, lh)
76 static void fib6_walker_link(struct net *net, struct fib6_walker *w) in fib6_walker_link() argument
78 write_lock_bh(&net->ipv6.fib6_walker_lock); in fib6_walker_link()
79 list_add(&w->lh, &net->ipv6.fib6_walkers); in fib6_walker_link()
80 write_unlock_bh(&net->ipv6.fib6_walker_lock); in fib6_walker_link()
83 static void fib6_walker_unlink(struct net *net, struct fib6_walker *w) in fib6_walker_unlink() argument
85 write_lock_bh(&net->ipv6.fib6_walker_lock); in fib6_walker_unlink()
87 write_unlock_bh(&net->ipv6.fib6_walker_lock); in fib6_walker_unlink()
90 static int fib6_new_sernum(struct net *net) in fib6_new_sernum() argument
95 old = atomic_read(&net->ipv6.fib6_sernum); in fib6_new_sernum()
97 } while (atomic_cmpxchg(&net->ipv6.fib6_sernum, in fib6_new_sernum()
106 void fib6_update_sernum(struct net *net, struct fib6_info *f6i) in fib6_update_sernum() argument
113 fn->fn_sernum = fib6_new_sernum(net); in fib6_update_sernum()
181 static struct fib6_node *node_alloc(struct net *net) in node_alloc() argument
187 net->ipv6.rt6_stats->fib_nodes++; in node_alloc()
192 static void node_free_immediate(struct net *net, struct fib6_node *fn) in node_free_immediate() argument
195 net->ipv6.rt6_stats->fib_nodes--; in node_free_immediate()
205 static void node_free(struct net *net, struct fib6_node *fn) in node_free() argument
208 net->ipv6.rt6_stats->fib_nodes--; in node_free()
217 static void fib6_link_table(struct net *net, struct fib6_table *tb) in fib6_link_table() argument
232 hlist_add_head_rcu(&tb->tb6_hlist, &net->ipv6.fib_table_hash[h]); in fib6_link_table()
237 static struct fib6_table *fib6_alloc_table(struct net *net, u32 id) in fib6_alloc_table() argument
245 net->ipv6.fib6_null_entry); in fib6_alloc_table()
253 struct fib6_table *fib6_new_table(struct net *net, u32 id) in fib6_new_table() argument
259 tb = fib6_get_table(net, id); in fib6_new_table()
263 tb = fib6_alloc_table(net, id); in fib6_new_table()
265 fib6_link_table(net, tb); in fib6_new_table()
271 struct fib6_table *fib6_get_table(struct net *net, u32 id) in fib6_get_table() argument
281 head = &net->ipv6.fib_table_hash[h]; in fib6_get_table()
294 static void __net_init fib6_tables_init(struct net *net) in fib6_tables_init() argument
296 fib6_link_table(net, net->ipv6.fib6_main_tbl); in fib6_tables_init()
297 fib6_link_table(net, net->ipv6.fib6_local_tbl); in fib6_tables_init()
301 struct fib6_table *fib6_new_table(struct net *net, u32 id) in fib6_new_table() argument
303 return fib6_get_table(net, id); in fib6_new_table()
306 struct fib6_table *fib6_get_table(struct net *net, u32 id) in fib6_get_table() argument
308 return net->ipv6.fib6_main_tbl; in fib6_get_table()
311 struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, in fib6_rule_lookup() argument
317 rt = lookup(net, net->ipv6.fib6_main_tbl, fl6, skb, flags); in fib6_rule_lookup()
320 rt = net->ipv6.ip6_null_entry; in fib6_rule_lookup()
329 int fib6_lookup(struct net *net, int oif, struct flowi6 *fl6, in fib6_lookup() argument
332 return fib6_table_lookup(net, net->ipv6.fib6_main_tbl, oif, fl6, in fib6_lookup()
336 static void __net_init fib6_tables_init(struct net *net) in fib6_tables_init() argument
338 fib6_link_table(net, net->ipv6.fib6_main_tbl); in fib6_tables_init()
343 unsigned int fib6_tables_seq_read(struct net *net) in fib6_tables_seq_read() argument
349 struct hlist_head *head = &net->ipv6.fib_table_hash[h]; in fib6_tables_seq_read()
360 static int call_fib6_entry_notifier(struct notifier_block *nb, struct net *net, in call_fib6_entry_notifier() argument
368 return call_fib6_notifier(nb, net, event_type, &info.info); in call_fib6_entry_notifier()
371 int call_fib6_entry_notifiers(struct net *net, in call_fib6_entry_notifiers() argument
382 return call_fib6_notifiers(net, event_type, &info.info); in call_fib6_entry_notifiers()
385 int call_fib6_multipath_entry_notifiers(struct net *net, in call_fib6_multipath_entry_notifiers() argument
398 return call_fib6_notifiers(net, event_type, &info.info); in call_fib6_multipath_entry_notifiers()
402 struct net *net; member
408 if (rt == arg->net->ipv6.fib6_null_entry) in fib6_rt_dump()
410 call_fib6_entry_notifier(arg->nb, arg->net, FIB_EVENT_ENTRY_ADD, rt); in fib6_rt_dump()
423 static void fib6_table_dump(struct net *net, struct fib6_table *tb, in fib6_table_dump() argument
428 fib6_walk(net, w); in fib6_table_dump()
433 int fib6_tables_dump(struct net *net, struct notifier_block *nb) in fib6_tables_dump() argument
444 arg.net = net; in fib6_tables_dump()
449 struct hlist_head *head = &net->ipv6.fib_table_hash[h]; in fib6_tables_dump()
453 fib6_table_dump(net, tb, w); in fib6_tables_dump()
497 struct net *net = sock_net(cb->skb->sk); in fib6_dump_end() local
503 fib6_walker_unlink(net, w); in fib6_dump_end()
521 struct net *net = sock_net(skb->sk); in fib6_dump_table() local
534 res = fib6_walk(net, w); in fib6_dump_table()
555 fib6_walker_unlink(net, w); in fib6_dump_table()
568 struct net *net = sock_net(skb->sk); in inet6_dump_fib() local
579 err = ip_valid_fib_dump_req(net, nlh, &arg.filter, cb); in inet6_dump_fib()
610 arg.net = net; in inet6_dump_fib()
614 tb = fib6_get_table(net, arg.filter.table_id); in inet6_dump_fib()
637 head = &net->ipv6.fib_table_hash[h]; in inet6_dump_fib()
685 static struct fib6_node *fib6_add_1(struct net *net, in fib6_add_1() argument
739 net->ipv6.fib6_null_entry) { in fib6_add_1()
783 ln = node_alloc(net); in fib6_add_1()
824 in = node_alloc(net); in fib6_add_1()
825 ln = node_alloc(net); in fib6_add_1()
829 node_free_immediate(net, in); in fib6_add_1()
831 node_free_immediate(net, ln); in fib6_add_1()
876 ln = node_alloc(net); in fib6_add_1()
972 struct net *net) in fib6_purge_rt() argument
993 new_leaf = fib6_find_prefix(net, table, fn); in fib6_purge_rt()
1252 static void fib6_start_gc(struct net *net, struct fib6_info *rt) in fib6_start_gc() argument
1254 if (!timer_pending(&net->ipv6.ip6_fib_timer) && in fib6_start_gc()
1256 mod_timer(&net->ipv6.ip6_fib_timer, in fib6_start_gc()
1257 jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); in fib6_start_gc()
1260 void fib6_force_start_gc(struct net *net) in fib6_force_start_gc() argument
1262 if (!timer_pending(&net->ipv6.ip6_fib_timer)) in fib6_force_start_gc()
1263 mod_timer(&net->ipv6.ip6_fib_timer, in fib6_force_start_gc()
1264 jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); in fib6_force_start_gc()
1282 void fib6_update_sernum_upto_root(struct net *net, struct fib6_info *rt) in fib6_update_sernum_upto_root() argument
1284 __fib6_update_sernum_upto_root(rt, fib6_new_sernum(net)); in fib6_update_sernum_upto_root()
1288 void fib6_update_sernum_stub(struct net *net, struct fib6_info *f6i) in fib6_update_sernum_stub() argument
1291 fib6_update_sernum_upto_root(net, f6i); in fib6_update_sernum_stub()
1672 static struct fib6_info *fib6_find_prefix(struct net *net, in fib6_find_prefix() argument
1679 return net->ipv6.fib6_null_entry; in fib6_find_prefix()
1704 static struct fib6_node *fib6_repair_tree(struct net *net, in fib6_repair_tree() argument
1716 rcu_assign_pointer(fn->leaf, net->ipv6.fib6_null_entry); in fib6_repair_tree()
1757 new_fn_leaf = fib6_find_prefix(net, table, fn); in fib6_repair_tree()
1761 new_fn_leaf = net->ipv6.fib6_null_entry; in fib6_repair_tree()
1792 read_lock(&net->ipv6.fib6_walker_lock); in fib6_repair_tree()
1793 FOR_WALKERS(net, w) { in fib6_repair_tree()
1813 read_unlock(&net->ipv6.fib6_walker_lock); in fib6_repair_tree()
1815 node_free(net, fn); in fib6_repair_tree()
1831 struct net *net = info->nl_net; in fib6_del_route() local
1838 net->ipv6.rt6_stats->fib_rt_entries--; in fib6_del_route()
1839 net->ipv6.rt6_stats->fib_discarded_routes++; in fib6_del_route()
1861 read_lock(&net->ipv6.fib6_walker_lock); in fib6_del_route()
1862 FOR_WALKERS(net, w) { in fib6_del_route()
1871 read_unlock(&net->ipv6.fib6_walker_lock); in fib6_del_route()
1880 net->ipv6.rt6_stats->fib_route_nodes--; in fib6_del_route()
1882 fn = fib6_repair_tree(net, table, fn); in fib6_del_route()
1885 fib6_purge_rt(rt, fn, net); in fib6_del_route()
1888 call_fib6_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, rt, NULL); in fib6_del_route()
1901 struct net *net = info->nl_net; in fib6_del() local
1905 if (!fn || rt == net->ipv6.fib6_null_entry) in fib6_del()
2042 static int fib6_walk(struct net *net, struct fib6_walker *w) in fib6_walk() argument
2049 fib6_walker_link(net, w); in fib6_walk()
2052 fib6_walker_unlink(net, w); in fib6_walk()
2062 .nl_net = c->net, in fib6_clean_node()
2113 static void fib6_clean_tree(struct net *net, struct fib6_node *root, in fib6_clean_tree() argument
2127 c.net = net; in fib6_clean_tree()
2130 fib6_walk(net, &c.w); in fib6_clean_tree()
2133 static void __fib6_clean_all(struct net *net, in __fib6_clean_all() argument
2143 head = &net->ipv6.fib_table_hash[h]; in __fib6_clean_all()
2146 fib6_clean_tree(net, &table->tb6_root, in __fib6_clean_all()
2154 void fib6_clean_all(struct net *net, int (*func)(struct fib6_info *, void *), in fib6_clean_all() argument
2157 __fib6_clean_all(net, func, FIB6_NO_SERNUM_CHANGE, arg, false); in fib6_clean_all()
2160 void fib6_clean_all_skip_notify(struct net *net, in fib6_clean_all_skip_notify() argument
2164 __fib6_clean_all(net, func, FIB6_NO_SERNUM_CHANGE, arg, true); in fib6_clean_all_skip_notify()
2167 static void fib6_flush_trees(struct net *net) in fib6_flush_trees() argument
2169 int new_sernum = fib6_new_sernum(net); in fib6_flush_trees()
2171 __fib6_clean_all(net, NULL, new_sernum, NULL, false); in fib6_flush_trees()
2205 void fib6_run_gc(unsigned long expires, struct net *net, bool force) in fib6_run_gc() argument
2211 spin_lock_bh(&net->ipv6.fib6_gc_lock); in fib6_run_gc()
2212 } else if (!spin_trylock_bh(&net->ipv6.fib6_gc_lock)) { in fib6_run_gc()
2213 mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); in fib6_run_gc()
2217 net->ipv6.sysctl.ip6_rt_gc_interval; in fib6_run_gc()
2220 fib6_clean_all(net, fib6_age, &gc_args); in fib6_run_gc()
2222 net->ipv6.ip6_rt_last_gc = now; in fib6_run_gc()
2225 mod_timer(&net->ipv6.ip6_fib_timer, in fib6_run_gc()
2227 + net->ipv6.sysctl.ip6_rt_gc_interval)); in fib6_run_gc()
2229 del_timer(&net->ipv6.ip6_fib_timer); in fib6_run_gc()
2230 spin_unlock_bh(&net->ipv6.fib6_gc_lock); in fib6_run_gc()
2235 struct net *arg = from_timer(arg, t, ipv6.ip6_fib_timer); in fib6_gc_timer_cb()
2240 static int __net_init fib6_net_init(struct net *net) in fib6_net_init() argument
2245 err = fib6_notifier_init(net); in fib6_net_init()
2249 spin_lock_init(&net->ipv6.fib6_gc_lock); in fib6_net_init()
2250 rwlock_init(&net->ipv6.fib6_walker_lock); in fib6_net_init()
2251 INIT_LIST_HEAD(&net->ipv6.fib6_walkers); in fib6_net_init()
2252 timer_setup(&net->ipv6.ip6_fib_timer, fib6_gc_timer_cb, 0); in fib6_net_init()
2254 net->ipv6.rt6_stats = kzalloc(sizeof(*net->ipv6.rt6_stats), GFP_KERNEL); in fib6_net_init()
2255 if (!net->ipv6.rt6_stats) in fib6_net_init()
2261 net->ipv6.fib_table_hash = kzalloc(size, GFP_KERNEL); in fib6_net_init()
2262 if (!net->ipv6.fib_table_hash) in fib6_net_init()
2265 net->ipv6.fib6_main_tbl = kzalloc(sizeof(*net->ipv6.fib6_main_tbl), in fib6_net_init()
2267 if (!net->ipv6.fib6_main_tbl) in fib6_net_init()
2270 net->ipv6.fib6_main_tbl->tb6_id = RT6_TABLE_MAIN; in fib6_net_init()
2271 rcu_assign_pointer(net->ipv6.fib6_main_tbl->tb6_root.leaf, in fib6_net_init()
2272 net->ipv6.fib6_null_entry); in fib6_net_init()
2273 net->ipv6.fib6_main_tbl->tb6_root.fn_flags = in fib6_net_init()
2275 inet_peer_base_init(&net->ipv6.fib6_main_tbl->tb6_peers); in fib6_net_init()
2278 net->ipv6.fib6_local_tbl = kzalloc(sizeof(*net->ipv6.fib6_local_tbl), in fib6_net_init()
2280 if (!net->ipv6.fib6_local_tbl) in fib6_net_init()
2282 net->ipv6.fib6_local_tbl->tb6_id = RT6_TABLE_LOCAL; in fib6_net_init()
2283 rcu_assign_pointer(net->ipv6.fib6_local_tbl->tb6_root.leaf, in fib6_net_init()
2284 net->ipv6.fib6_null_entry); in fib6_net_init()
2285 net->ipv6.fib6_local_tbl->tb6_root.fn_flags = in fib6_net_init()
2287 inet_peer_base_init(&net->ipv6.fib6_local_tbl->tb6_peers); in fib6_net_init()
2289 fib6_tables_init(net); in fib6_net_init()
2295 kfree(net->ipv6.fib6_main_tbl); in fib6_net_init()
2298 kfree(net->ipv6.fib_table_hash); in fib6_net_init()
2300 kfree(net->ipv6.rt6_stats); in fib6_net_init()
2302 fib6_notifier_exit(net); in fib6_net_init()
2306 static void fib6_net_exit(struct net *net) in fib6_net_exit() argument
2310 del_timer_sync(&net->ipv6.ip6_fib_timer); in fib6_net_exit()
2313 struct hlist_head *head = &net->ipv6.fib_table_hash[i]; in fib6_net_exit()
2323 kfree(net->ipv6.fib_table_hash); in fib6_net_exit()
2324 kfree(net->ipv6.rt6_stats); in fib6_net_exit()
2325 fib6_notifier_exit(net); in fib6_net_exit()
2424 struct net *net) in ipv6_route_seq_setup_walk() argument
2434 fib6_walker_link(net, &iter->w); in ipv6_route_seq_setup_walk()
2438 struct net *net) in ipv6_route_seq_next_table() argument
2453 hlist_first_rcu(&net->ipv6.fib_table_hash[h++])); in ipv6_route_seq_next_table()
2473 struct net *net = seq_file_net(seq); in ipv6_route_seq_next() local
2495 fib6_walker_unlink(net, &iter->w); in ipv6_route_seq_next()
2498 fib6_walker_unlink(net, &iter->w); in ipv6_route_seq_next()
2500 iter->tbl = ipv6_route_seq_next_table(iter->tbl, net); in ipv6_route_seq_next()
2504 ipv6_route_seq_setup_walk(iter, net); in ipv6_route_seq_next()
2511 struct net *net = seq_file_net(seq); in ipv6_route_seq_start() local
2515 iter->tbl = ipv6_route_seq_next_table(NULL, net); in ipv6_route_seq_start()
2519 ipv6_route_seq_setup_walk(iter, net); in ipv6_route_seq_start()
2535 struct net *net = seq_file_net(seq); in ipv6_route_seq_stop() local
2539 fib6_walker_unlink(net, &iter->w); in ipv6_route_seq_stop()