Lines Matching refs:net
90 static int ip6_pkt_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb);
92 static int ip6_pkt_prohibit_out(struct net *net, struct sock *sk, struct sk_buff *skb);
102 static struct rt6_info *rt6_add_route_info(struct net *net,
106 static struct rt6_info *rt6_get_route_info(struct net *net,
141 static void rt6_uncached_list_flush_dev(struct net *net, struct net_device *dev) in rt6_uncached_list_flush_dev() argument
143 struct net_device *loopback_dev = net->loopback_dev; in rt6_uncached_list_flush_dev()
327 static struct rt6_info *__ip6_dst_alloc(struct net *net, in __ip6_dst_alloc() argument
331 struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev, in __ip6_dst_alloc()
340 static struct rt6_info *ip6_dst_alloc(struct net *net, in ip6_dst_alloc() argument
344 struct rt6_info *rt = __ip6_dst_alloc(net, dev, flags); in ip6_dst_alloc()
465 static inline struct rt6_info *rt6_device_match(struct net *net, in rt6_device_match() argument
495 if (ipv6_chk_addr(net, saddr, dev, in rt6_device_match()
506 return net->ipv6.ip6_null_entry; in rt6_device_match()
724 struct net *net; in rt6_select() local
745 net = dev_net(rt0->dst.dev); in rt6_select()
746 return match ? match : net->ipv6.ip6_null_entry; in rt6_select()
758 struct net *net = dev_net(dev); in rt6_route_rcv() local
803 rt = rt6_get_route_info(net, prefix, rinfo->prefix_len, in rt6_route_rcv()
812 rt = rt6_add_route_info(net, prefix, rinfo->prefix_len, gwaddr, dev->ifindex, in rt6_route_rcv()
847 static struct rt6_info *ip6_pol_route_lookup(struct net *net, in ip6_pol_route_lookup() argument
858 rt = rt6_device_match(net, rt, &fl6->saddr, fl6->flowi6_oif, flags); in ip6_pol_route_lookup()
861 if (rt == net->ipv6.ip6_null_entry) { in ip6_pol_route_lookup()
872 struct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6, in ip6_route_lookup() argument
875 return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_lookup); in ip6_route_lookup()
879 struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr, in rt6_lookup() argument
894 dst = fib6_rule_lookup(net, &fl6, flags, ip6_pol_route_lookup); in rt6_lookup()
1009 struct net *net = dev_net(rt->dst.dev); in rt6_make_pcpu_route() local
1011 dst_hold(&net->ipv6.ip6_null_entry->dst); in rt6_make_pcpu_route()
1012 return net->ipv6.ip6_null_entry; in rt6_make_pcpu_route()
1040 static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, int oif, in ip6_pol_route() argument
1048 if (net->ipv6.devconf_all->forwarding == 0) in ip6_pol_route()
1063 if (rt == net->ipv6.ip6_null_entry) { in ip6_pol_route()
1076 if (rt == net->ipv6.ip6_null_entry || (rt->rt6i_flags & RTF_CACHE)) { in ip6_pol_route()
1101 uncached_rt = net->ipv6.ip6_null_entry; in ip6_pol_route()
1133 static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table *table, in ip6_pol_route_input() argument
1136 return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags); in ip6_pol_route_input()
1139 static struct dst_entry *ip6_route_input_lookup(struct net *net, in ip6_route_input_lookup() argument
1146 return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_input); in ip6_route_input_lookup()
1152 struct net *net = dev_net(skb->dev); in ip6_route_input() local
1168 skb_dst_set(skb, ip6_route_input_lookup(net, skb->dev, &fl6, flags)); in ip6_route_input()
1171 static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table, in ip6_pol_route_output() argument
1174 return ip6_pol_route(net, table, fl6->flowi6_oif, fl6, flags); in ip6_pol_route_output()
1177 struct dst_entry *ip6_route_output_flags(struct net *net, const struct sock *sk, in ip6_route_output_flags() argument
1183 dst = l3mdev_rt6_dst_by_oif(net, fl6); in ip6_route_output_flags()
1199 return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_output); in ip6_route_output_flags()
1203 struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_orig) in ip6_blackhole_route() argument
1327 struct net *net = dev_net(rt->dst.dev); in rt6_do_update_pmtu() local
1331 rt6_update_expires(rt, net->ipv6.sysctl.ip6_rt_mtu_expires); in rt6_do_update_pmtu()
1388 void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, in ip6_update_pmtu() argument
1397 fl6.flowi6_mark = mark ? mark : IP6_REPLY_MARK(net, skb->mark); in ip6_update_pmtu()
1402 dst = ip6_route_output(net, NULL, &fl6); in ip6_update_pmtu()
1422 static struct rt6_info *__ip6_route_redirect(struct net *net, in __ip6_route_redirect() argument
1459 rt = net->ipv6.ip6_null_entry; in __ip6_route_redirect()
1461 rt = net->ipv6.ip6_null_entry; in __ip6_route_redirect()
1465 if (rt == net->ipv6.ip6_null_entry) { in __ip6_route_redirect()
1479 static struct dst_entry *ip6_route_redirect(struct net *net, in ip6_route_redirect() argument
1489 return fib6_rule_lookup(net, &rdfl.fl6, in ip6_route_redirect()
1493 void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark) in ip6_redirect() argument
1507 dst = ip6_route_redirect(net, &fl6, &ipv6_hdr(skb)->saddr); in ip6_redirect()
1513 void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif, in ip6_redirect_no_header() argument
1528 dst = ip6_route_redirect(net, &fl6, &iph->saddr); in ip6_redirect_no_header()
1543 struct net *net = dev_net(dev); in ip6_default_advmss() local
1547 if (mtu < net->ipv6.sysctl.ip6_rt_min_advmss) in ip6_default_advmss()
1548 mtu = net->ipv6.sysctl.ip6_rt_min_advmss; in ip6_default_advmss()
1595 struct net *net = dev_net(dev); in icmp6_dst_alloc() local
1600 rt = ip6_dst_alloc(net, dev, 0); in icmp6_dst_alloc()
1621 fib6_force_start_gc(net); in icmp6_dst_alloc()
1623 dst = xfrm_lookup(net, &rt->dst, flowi6_to_flowi(fl6), NULL, 0); in icmp6_dst_alloc()
1673 struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); in ip6_dst_gc() local
1674 int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; in ip6_dst_gc()
1675 int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; in ip6_dst_gc()
1676 int rt_elasticity = net->ipv6.sysctl.ip6_rt_gc_elasticity; in ip6_dst_gc()
1677 int rt_gc_timeout = net->ipv6.sysctl.ip6_rt_gc_timeout; in ip6_dst_gc()
1678 unsigned long rt_last_gc = net->ipv6.ip6_rt_last_gc; in ip6_dst_gc()
1686 net->ipv6.ip6_rt_gc_expire++; in ip6_dst_gc()
1687 fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, true); in ip6_dst_gc()
1690 net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; in ip6_dst_gc()
1692 net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>rt_elasticity; in ip6_dst_gc()
1753 struct net *net = cfg->fc_nlinfo.nl_net; in ip6_route_info_create() local
1769 dev = dev_get_by_index(net, cfg->fc_ifindex); in ip6_route_info_create()
1783 table = fib6_get_table(net, cfg->fc_table); in ip6_route_info_create()
1786 table = fib6_new_table(net, cfg->fc_table); in ip6_route_info_create()
1789 table = fib6_new_table(net, cfg->fc_table); in ip6_route_info_create()
1795 rt = ip6_dst_alloc(net, NULL, in ip6_route_info_create()
1863 if (dev != net->loopback_dev) { in ip6_route_info_create()
1868 dev = net->loopback_dev; in ip6_route_info_create()
1914 if (ipv6_chk_addr_and_flags(net, gw_addr, in ip6_route_info_create()
1934 grt = rt6_lookup(net, gw_addr, NULL, cfg->fc_ifindex, 1); in ip6_route_info_create()
1967 if (!ipv6_chk_addr(net, &cfg->fc_prefsrc, dev, 0)) { in ip6_route_info_create()
2030 struct net *net = dev_net(rt->dst.dev); in __ip6_del_rt() local
2032 if (rt == net->ipv6.ip6_null_entry || in __ip6_del_rt()
2251 static struct rt6_info *rt6_get_route_info(struct net *net, in rt6_get_route_info() argument
2259 table = fib6_get_table(net, RT6_TABLE_INFO); in rt6_get_route_info()
2283 static struct rt6_info *rt6_add_route_info(struct net *net, in rt6_add_route_info() argument
2296 .fc_nlinfo.nl_net = net, in rt6_add_route_info()
2299 cfg.fc_table = l3mdev_fib_table_by_index(net, ifindex) ? : RT6_TABLE_INFO; in rt6_add_route_info()
2309 return rt6_get_route_info(net, prefix, prefixlen, gwaddr, ifindex); in rt6_add_route_info()
2357 void rt6_purge_dflt_routers(struct net *net) in rt6_purge_dflt_routers() argument
2363 table = fib6_get_table(net, RT6_TABLE_DFLT); in rt6_purge_dflt_routers()
2381 static void rtmsg_to_fib6_config(struct net *net, in rtmsg_to_fib6_config() argument
2387 cfg->fc_table = l3mdev_fib_table_by_index(net, rtmsg->rtmsg_ifindex) ? in rtmsg_to_fib6_config()
2396 cfg->fc_nlinfo.nl_net = net; in rtmsg_to_fib6_config()
2403 int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg) in ipv6_route_ioctl() argument
2412 if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) in ipv6_route_ioctl()
2419 rtmsg_to_fib6_config(net, &rtmsg, &cfg); in ipv6_route_ioctl()
2472 static int ip6_pkt_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb) in ip6_pkt_discard_out() argument
2483 static int ip6_pkt_prohibit_out(struct net *net, struct sock *sk, struct sk_buff *skb) in ip6_pkt_prohibit_out() argument
2498 struct net *net = dev_net(idev->dev); in addrconf_dst_alloc() local
2499 struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev, in addrconf_dst_alloc()
2521 rt->rt6i_table = fib6_get_table(net, tb_id); in addrconf_dst_alloc()
2529 int ip6_route_get_saddr(struct net *net, in ip6_route_get_saddr() argument
2541 err = ipv6_dev_get_saddr(net, idev ? idev->dev : NULL, in ip6_route_get_saddr()
2549 struct net *net; member
2556 struct net *net = ((struct arg_dev_net_ip *)arg)->net; in fib6_remove_prefsrc() local
2560 rt != net->ipv6.ip6_null_entry && in fib6_remove_prefsrc()
2570 struct net *net = dev_net(ifp->idev->dev); in rt6_remove_prefsrc() local
2573 .net = net, in rt6_remove_prefsrc()
2576 fib6_clean_all(net, fib6_remove_prefsrc, &adni); in rt6_remove_prefsrc()
2595 void rt6_clean_tohost(struct net *net, struct in6_addr *gateway) in rt6_clean_tohost() argument
2597 fib6_clean_all(net, fib6_clean_tohost, gateway); in rt6_clean_tohost()
2602 struct net *net; member
2611 rt != adn->net->ipv6.ip6_null_entry) in fib6_ifdown()
2617 void rt6_ifdown(struct net *net, struct net_device *dev) in rt6_ifdown() argument
2621 .net = net, in rt6_ifdown()
2624 fib6_clean_all(net, fib6_ifdown, &adn); in rt6_ifdown()
2627 rt6_uncached_list_flush_dev(net, dev); in rt6_ifdown()
3047 static int rt6_fill_node(struct net *net, in rt6_fill_node() argument
3143 int err = ip6mr_get_route(net, skb, rtm, nowait); in rt6_fill_node()
3160 if (ip6_route_get_saddr(net, rt, dst, 0, &saddr_buf) == 0 && in rt6_fill_node()
3218 return rt6_fill_node(arg->net, in rt6_dump_route()
3226 struct net *net = sock_net(in_skb->sk); in inet6_rtm_getroute() local
3268 dev = __dev_get_by_index(net, iif); in inet6_rtm_getroute()
3279 rt = (struct rt6_info *)ip6_route_input_lookup(net, dev, &fl6, in inet6_rtm_getroute()
3284 if (netif_index_is_l3_master(net, oif)) { in inet6_rtm_getroute()
3289 rt = (struct rt6_info *)ip6_route_output(net, NULL, &fl6); in inet6_rtm_getroute()
3307 err = rt6_fill_node(net, skb, rt, &fl6.daddr, &fl6.saddr, iif, in inet6_rtm_getroute()
3315 err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid); in inet6_rtm_getroute()
3324 struct net *net = info->nl_net; in inet6_rt_notify() local
3335 err = rt6_fill_node(net, skb, rt, NULL, NULL, 0, in inet6_rt_notify()
3343 rtnl_notify(skb, net, info->portid, RTNLGRP_IPV6_ROUTE, in inet6_rt_notify()
3348 rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err); in inet6_rt_notify()
3355 struct net *net = dev_net(dev); in ip6_route_dev_notify() local
3358 net->ipv6.ip6_null_entry->dst.dev = dev; in ip6_route_dev_notify()
3359 net->ipv6.ip6_null_entry->rt6i_idev = in6_dev_get(dev); in ip6_route_dev_notify()
3361 net->ipv6.ip6_prohibit_entry->dst.dev = dev; in ip6_route_dev_notify()
3362 net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev); in ip6_route_dev_notify()
3363 net->ipv6.ip6_blk_hole_entry->dst.dev = dev; in ip6_route_dev_notify()
3364 net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); in ip6_route_dev_notify()
3387 struct net *net = (struct net *)seq->private; in rt6_stats_seq_show() local
3389 net->ipv6.rt6_stats->fib_nodes, in rt6_stats_seq_show()
3390 net->ipv6.rt6_stats->fib_route_nodes, in rt6_stats_seq_show()
3391 net->ipv6.rt6_stats->fib_rt_alloc, in rt6_stats_seq_show()
3392 net->ipv6.rt6_stats->fib_rt_entries, in rt6_stats_seq_show()
3393 net->ipv6.rt6_stats->fib_rt_cache, in rt6_stats_seq_show()
3394 dst_entries_get_slow(&net->ipv6.ip6_dst_ops), in rt6_stats_seq_show()
3395 net->ipv6.rt6_stats->fib_discarded_routes); in rt6_stats_seq_show()
3420 struct net *net; in ipv6_sysctl_rtcache_flush() local
3425 net = (struct net *)ctl->extra1; in ipv6_sysctl_rtcache_flush()
3426 delay = net->ipv6.sysctl.flush_delay; in ipv6_sysctl_rtcache_flush()
3428 fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0); in ipv6_sysctl_rtcache_flush()
3506 struct ctl_table * __net_init ipv6_route_sysctl_init(struct net *net) in ipv6_route_sysctl_init() argument
3515 table[0].data = &net->ipv6.sysctl.flush_delay; in ipv6_route_sysctl_init()
3516 table[0].extra1 = net; in ipv6_route_sysctl_init()
3517 table[1].data = &net->ipv6.ip6_dst_ops.gc_thresh; in ipv6_route_sysctl_init()
3518 table[2].data = &net->ipv6.sysctl.ip6_rt_max_size; in ipv6_route_sysctl_init()
3519 table[3].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; in ipv6_route_sysctl_init()
3520 table[4].data = &net->ipv6.sysctl.ip6_rt_gc_timeout; in ipv6_route_sysctl_init()
3521 table[5].data = &net->ipv6.sysctl.ip6_rt_gc_interval; in ipv6_route_sysctl_init()
3522 table[6].data = &net->ipv6.sysctl.ip6_rt_gc_elasticity; in ipv6_route_sysctl_init()
3523 table[7].data = &net->ipv6.sysctl.ip6_rt_mtu_expires; in ipv6_route_sysctl_init()
3524 table[8].data = &net->ipv6.sysctl.ip6_rt_min_advmss; in ipv6_route_sysctl_init()
3525 table[9].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; in ipv6_route_sysctl_init()
3528 if (net->user_ns != &init_user_ns) in ipv6_route_sysctl_init()
3536 static int __net_init ip6_route_net_init(struct net *net) in ip6_route_net_init() argument
3540 memcpy(&net->ipv6.ip6_dst_ops, &ip6_dst_ops_template, in ip6_route_net_init()
3541 sizeof(net->ipv6.ip6_dst_ops)); in ip6_route_net_init()
3543 if (dst_entries_init(&net->ipv6.ip6_dst_ops) < 0) in ip6_route_net_init()
3546 net->ipv6.ip6_null_entry = kmemdup(&ip6_null_entry_template, in ip6_route_net_init()
3547 sizeof(*net->ipv6.ip6_null_entry), in ip6_route_net_init()
3549 if (!net->ipv6.ip6_null_entry) in ip6_route_net_init()
3551 net->ipv6.ip6_null_entry->dst.path = in ip6_route_net_init()
3552 (struct dst_entry *)net->ipv6.ip6_null_entry; in ip6_route_net_init()
3553 net->ipv6.ip6_null_entry->dst.ops = &net->ipv6.ip6_dst_ops; in ip6_route_net_init()
3554 dst_init_metrics(&net->ipv6.ip6_null_entry->dst, in ip6_route_net_init()
3558 net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, in ip6_route_net_init()
3559 sizeof(*net->ipv6.ip6_prohibit_entry), in ip6_route_net_init()
3561 if (!net->ipv6.ip6_prohibit_entry) in ip6_route_net_init()
3563 net->ipv6.ip6_prohibit_entry->dst.path = in ip6_route_net_init()
3564 (struct dst_entry *)net->ipv6.ip6_prohibit_entry; in ip6_route_net_init()
3565 net->ipv6.ip6_prohibit_entry->dst.ops = &net->ipv6.ip6_dst_ops; in ip6_route_net_init()
3566 dst_init_metrics(&net->ipv6.ip6_prohibit_entry->dst, in ip6_route_net_init()
3569 net->ipv6.ip6_blk_hole_entry = kmemdup(&ip6_blk_hole_entry_template, in ip6_route_net_init()
3570 sizeof(*net->ipv6.ip6_blk_hole_entry), in ip6_route_net_init()
3572 if (!net->ipv6.ip6_blk_hole_entry) in ip6_route_net_init()
3574 net->ipv6.ip6_blk_hole_entry->dst.path = in ip6_route_net_init()
3575 (struct dst_entry *)net->ipv6.ip6_blk_hole_entry; in ip6_route_net_init()
3576 net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops; in ip6_route_net_init()
3577 dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst, in ip6_route_net_init()
3581 net->ipv6.sysctl.flush_delay = 0; in ip6_route_net_init()
3582 net->ipv6.sysctl.ip6_rt_max_size = 4096; in ip6_route_net_init()
3583 net->ipv6.sysctl.ip6_rt_gc_min_interval = HZ / 2; in ip6_route_net_init()
3584 net->ipv6.sysctl.ip6_rt_gc_timeout = 60*HZ; in ip6_route_net_init()
3585 net->ipv6.sysctl.ip6_rt_gc_interval = 30*HZ; in ip6_route_net_init()
3586 net->ipv6.sysctl.ip6_rt_gc_elasticity = 9; in ip6_route_net_init()
3587 net->ipv6.sysctl.ip6_rt_mtu_expires = 10*60*HZ; in ip6_route_net_init()
3588 net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40; in ip6_route_net_init()
3590 net->ipv6.ip6_rt_gc_expire = 30*HZ; in ip6_route_net_init()
3598 kfree(net->ipv6.ip6_prohibit_entry); in ip6_route_net_init()
3600 kfree(net->ipv6.ip6_null_entry); in ip6_route_net_init()
3603 dst_entries_destroy(&net->ipv6.ip6_dst_ops); in ip6_route_net_init()
3608 static void __net_exit ip6_route_net_exit(struct net *net) in ip6_route_net_exit() argument
3610 kfree(net->ipv6.ip6_null_entry); in ip6_route_net_exit()
3612 kfree(net->ipv6.ip6_prohibit_entry); in ip6_route_net_exit()
3613 kfree(net->ipv6.ip6_blk_hole_entry); in ip6_route_net_exit()
3615 dst_entries_destroy(&net->ipv6.ip6_dst_ops); in ip6_route_net_exit()
3618 static int __net_init ip6_route_net_init_late(struct net *net) in ip6_route_net_init_late() argument
3621 proc_create("ipv6_route", 0, net->proc_net, &ipv6_route_proc_fops); in ip6_route_net_init_late()
3622 proc_create("rt6_stats", S_IRUGO, net->proc_net, &rt6_stats_seq_fops); in ip6_route_net_init_late()
3627 static void __net_exit ip6_route_net_exit_late(struct net *net) in ip6_route_net_exit_late() argument
3630 remove_proc_entry("ipv6_route", net->proc_net); in ip6_route_net_exit_late()
3631 remove_proc_entry("rt6_stats", net->proc_net); in ip6_route_net_exit_late()
3640 static int __net_init ipv6_inetpeer_init(struct net *net) in ipv6_inetpeer_init() argument
3647 net->ipv6.peers = bp; in ipv6_inetpeer_init()
3651 static void __net_exit ipv6_inetpeer_exit(struct net *net) in ipv6_inetpeer_exit() argument
3653 struct inet_peer_base *bp = net->ipv6.peers; in ipv6_inetpeer_exit()
3655 net->ipv6.peers = NULL; in ipv6_inetpeer_exit()