Lines Matching full:net
3 * net/ipv6/fib6_rules.c IPv6 Routing Policy Rules
18 #include <net/fib_rules.h>
19 #include <net/ipv6.h>
20 #include <net/addrconf.h>
21 #include <net/ip6_route.h>
22 #include <net/netlink.h>
51 int fib6_rules_dump(struct net *net, struct notifier_block *nb, in fib6_rules_dump() argument
54 return fib_rules_dump(net, nb, AF_INET6, extack); in fib6_rules_dump()
57 unsigned int fib6_rules_seq_read(struct net *net) in fib6_rules_seq_read() argument
59 return fib_rules_seq_read(net, AF_INET6); in fib6_rules_seq_read()
63 int fib6_lookup(struct net *net, int oif, struct flowi6 *fl6, in fib6_lookup() argument
68 if (net->ipv6.fib6_has_custom_rules) { in fib6_lookup()
76 l3mdev_update_flow(net, flowi6_to_flowi(fl6)); in fib6_lookup()
78 err = fib_rules_lookup(net->ipv6.fib6_rules_ops, in fib6_lookup()
81 err = fib6_table_lookup(net, net->ipv6.fib6_local_tbl, oif, in fib6_lookup()
83 if (err || res->f6i == net->ipv6.fib6_null_entry) in fib6_lookup()
84 err = fib6_table_lookup(net, net->ipv6.fib6_main_tbl, in fib6_lookup()
91 struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, in fib6_rule_lookup() argument
95 if (net->ipv6.fib6_has_custom_rules) { in fib6_rule_lookup()
105 l3mdev_update_flow(net, flowi6_to_flowi(fl6)); in fib6_rule_lookup()
107 fib_rules_lookup(net->ipv6.fib6_rules_ops, in fib6_rule_lookup()
116 net, net->ipv6.fib6_local_tbl, fl6, skb, flags); in fib6_rule_lookup()
117 if (rt != net->ipv6.ip6_null_entry && rt->dst.error != -EAGAIN) in fib6_rule_lookup()
121 net, net->ipv6.fib6_main_tbl, fl6, skb, flags); in fib6_rule_lookup()
128 dst_hold(&net->ipv6.ip6_null_entry->dst); in fib6_rule_lookup()
129 return &net->ipv6.ip6_null_entry->dst; in fib6_rule_lookup()
132 static int fib6_rule_saddr(struct net *net, struct fib_rule *rule, int flags, in fib6_rule_saddr() argument
144 if (ipv6_dev_get_saddr(net, dev, &flp6->daddr, in fib6_rule_saddr()
162 struct net *net = rule->fr_net; in fib6_rule_action_alt() local
180 table = fib6_get_table(net, tb_id); in fib6_rule_action_alt()
185 err = fib6_table_lookup(net, table, *oif, flp6, res, flags); in fib6_rule_action_alt()
186 if (!err && res->f6i != net->ipv6.fib6_null_entry) in fib6_rule_action_alt()
187 err = fib6_rule_saddr(net, rule, flags, flp6, in fib6_rule_action_alt()
202 struct net *net = rule->fr_net; in __fib6_rule_action() local
212 rt = net->ipv6.ip6_null_entry; in __fib6_rule_action()
217 rt = net->ipv6.ip6_blk_hole_entry; in __fib6_rule_action()
221 rt = net->ipv6.ip6_prohibit_entry; in __fib6_rule_action()
226 table = fib6_get_table(net, tb_id); in __fib6_rule_action()
233 net, table, flp6, arg->lookup_data, flags); in __fib6_rule_action()
234 if (rt != net->ipv6.ip6_null_entry) { in __fib6_rule_action()
235 err = fib6_rule_saddr(net, rule, flags, flp6, in __fib6_rule_action()
353 struct net *net = sock_net(skb->sk); in fib6_rule_configure() local
362 if (fib6_new_table(net, rule->table) == NULL) { in fib6_rule_configure()
379 net->ipv6.fib6_rules_require_fldissect++; in fib6_rule_configure()
381 net->ipv6.fib6_has_custom_rules = true; in fib6_rule_configure()
389 struct net *net = rule->fr_net; in fib6_rule_delete() local
391 if (net->ipv6.fib6_rules_require_fldissect && in fib6_rule_delete()
393 net->ipv6.fib6_rules_require_fldissect--; in fib6_rule_delete()
467 static int __net_init fib6_rules_net_init(struct net *net) in fib6_rules_net_init() argument
472 ops = fib_rules_register(&fib6_rules_ops_template, net); in fib6_rules_net_init()
484 net->ipv6.fib6_rules_ops = ops; in fib6_rules_net_init()
485 net->ipv6.fib6_rules_require_fldissect = 0; in fib6_rules_net_init()
494 static void __net_exit fib6_rules_net_exit(struct net *net) in fib6_rules_net_exit() argument
497 fib_rules_unregister(net->ipv6.fib6_rules_ops); in fib6_rules_net_exit()