Lines Matching refs:net
303 static inline struct rt6_info *ip6_dst_alloc(struct net *net, in ip6_dst_alloc() argument
308 struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev, in ip6_dst_alloc()
315 rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers); in ip6_dst_alloc()
438 static inline struct rt6_info *rt6_device_match(struct net *net, in rt6_device_match() argument
468 if (ipv6_chk_addr(net, saddr, dev, in rt6_device_match()
479 return net->ipv6.ip6_null_entry; in rt6_device_match()
673 struct net *net; in rt6_select() local
694 net = dev_net(rt0->dst.dev); in rt6_select()
695 return match ? match : net->ipv6.ip6_null_entry; in rt6_select()
789 static struct rt6_info *ip6_pol_route_lookup(struct net *net, in ip6_pol_route_lookup() argument
800 rt = rt6_device_match(net, rt, &fl6->saddr, fl6->flowi6_oif, flags); in ip6_pol_route_lookup()
803 BACKTRACK(net, &fl6->saddr); in ip6_pol_route_lookup()
811 struct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6, in ip6_route_lookup() argument
814 return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_lookup); in ip6_route_lookup()
818 struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr, in rt6_lookup() argument
833 dst = fib6_rule_lookup(net, &fl6, flags, ip6_pol_route_lookup); in rt6_lookup()
911 static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, int oif, in ip6_pol_route() argument
919 int reachable = net->ipv6.devconf_all->forwarding ? 0 : RT6_LOOKUP_F_REACHABLE; in ip6_pol_route()
933 BACKTRACK(net, &fl6->saddr); in ip6_pol_route()
934 if (rt == net->ipv6.ip6_null_entry || in ip6_pol_route()
949 rt = nrt ? : net->ipv6.ip6_null_entry; in ip6_pol_route()
982 static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table *table, in ip6_pol_route_input() argument
985 return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags); in ip6_pol_route_input()
988 static struct dst_entry *ip6_route_input_lookup(struct net *net, in ip6_route_input_lookup() argument
995 return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_input); in ip6_route_input_lookup()
1001 struct net *net = dev_net(skb->dev); in ip6_route_input() local
1012 skb_dst_set(skb, ip6_route_input_lookup(net, skb->dev, &fl6, flags)); in ip6_route_input()
1015 static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table, in ip6_pol_route_output() argument
1018 return ip6_pol_route(net, table, fl6->flowi6_oif, fl6, flags); in ip6_pol_route_output()
1021 struct dst_entry *ip6_route_output(struct net *net, const struct sock *sk, in ip6_route_output() argument
1036 return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_output); in ip6_route_output()
1040 struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_orig) in ip6_blackhole_route() argument
1050 rt6_init_peer(rt, net->ipv6.peers); in ip6_blackhole_route()
1146 struct net *net = dev_net(dst->dev); in ip6_rt_update_pmtu() local
1153 rt6_update_expires(rt6, net->ipv6.sysctl.ip6_rt_mtu_expires); in ip6_rt_update_pmtu()
1157 void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, in ip6_update_pmtu() argument
1166 fl6.flowi6_mark = mark ? mark : IP6_REPLY_MARK(net, skb->mark); in ip6_update_pmtu()
1172 dst = ip6_route_output(net, NULL, &fl6); in ip6_update_pmtu()
1192 static struct rt6_info *__ip6_route_redirect(struct net *net, in __ip6_route_redirect() argument
1229 rt = net->ipv6.ip6_null_entry; in __ip6_route_redirect()
1231 rt = net->ipv6.ip6_null_entry; in __ip6_route_redirect()
1234 BACKTRACK(net, &fl6->saddr); in __ip6_route_redirect()
1243 static struct dst_entry *ip6_route_redirect(struct net *net, in ip6_route_redirect() argument
1253 return fib6_rule_lookup(net, &rdfl.fl6, in ip6_route_redirect()
1257 void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark, in ip6_redirect() argument
1273 dst = ip6_route_redirect(net, &fl6, &ipv6_hdr(skb)->saddr); in ip6_redirect()
1279 void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif, in ip6_redirect_no_header() argument
1293 fl6.flowi6_uid = sock_net_uid(net, NULL); in ip6_redirect_no_header()
1295 dst = ip6_route_redirect(net, &fl6, &iph->saddr); in ip6_redirect_no_header()
1311 struct net *net = dev_net(dev); in ip6_default_advmss() local
1315 if (mtu < net->ipv6.sysctl.ip6_rt_min_advmss) in ip6_default_advmss()
1316 mtu = net->ipv6.sysctl.ip6_rt_min_advmss; in ip6_default_advmss()
1358 struct net *net = dev_net(dev); in icmp6_dst_alloc() local
1363 rt = ip6_dst_alloc(net, dev, 0, NULL); in icmp6_dst_alloc()
1384 fib6_force_start_gc(net); in icmp6_dst_alloc()
1386 dst = xfrm_lookup(net, &rt->dst, flowi6_to_flowi(fl6), NULL, 0); in icmp6_dst_alloc()
1436 struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); in ip6_dst_gc() local
1437 int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; in ip6_dst_gc()
1438 int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; in ip6_dst_gc()
1439 int rt_elasticity = net->ipv6.sysctl.ip6_rt_gc_elasticity; in ip6_dst_gc()
1440 int rt_gc_timeout = net->ipv6.sysctl.ip6_rt_gc_timeout; in ip6_dst_gc()
1441 unsigned long rt_last_gc = net->ipv6.ip6_rt_last_gc; in ip6_dst_gc()
1449 net->ipv6.ip6_rt_gc_expire++; in ip6_dst_gc()
1450 fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, true); in ip6_dst_gc()
1453 net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; in ip6_dst_gc()
1455 net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>rt_elasticity; in ip6_dst_gc()
1466 struct net *net = cfg->fc_nlinfo.nl_net; in ip6_route_add() local
1481 dev = dev_get_by_index(net, cfg->fc_ifindex); in ip6_route_add()
1495 table = fib6_get_table(net, cfg->fc_table); in ip6_route_add()
1498 table = fib6_new_table(net, cfg->fc_table); in ip6_route_add()
1501 table = fib6_new_table(net, cfg->fc_table); in ip6_route_add()
1507 rt = ip6_dst_alloc(net, NULL, (cfg->fc_flags & RTF_ADDRCONF) ? 0 : DST_NOCOUNT, table); in ip6_route_add()
1557 if (dev != net->loopback_dev) { in ip6_route_add()
1562 dev = net->loopback_dev; in ip6_route_add()
1615 grt = rt6_lookup(net, gw_addr, NULL, cfg->fc_ifindex, 1); in ip6_route_add()
1648 if (!ipv6_chk_addr(net, &cfg->fc_prefsrc, dev, 0)) { in ip6_route_add()
1682 struct net *net = dev_net(rt->dst.dev); in __ip6_del_rt() local
1684 if (rt == net->ipv6.ip6_null_entry) { in __ip6_del_rt()
1750 struct net *net = dev_net(skb->dev); in rt6_do_redirect() local
1811 if (rt == net->ipv6.ip6_null_entry) { in rt6_do_redirect()
1872 struct net *net = dev_net(ort->dst.dev); in ip6_rt_copy() local
1873 struct rt6_info *rt = ip6_dst_alloc(net, ort->dst.dev, 0, in ip6_rt_copy()
2023 void rt6_purge_dflt_routers(struct net *net) in rt6_purge_dflt_routers() argument
2025 fib6_clean_all(net, rt6_addrconf_purge, NULL); in rt6_purge_dflt_routers()
2028 static void rtmsg_to_fib6_config(struct net *net, in rtmsg_to_fib6_config() argument
2042 cfg->fc_nlinfo.nl_net = net; in rtmsg_to_fib6_config()
2049 int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg) in ipv6_route_ioctl() argument
2058 if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) in ipv6_route_ioctl()
2065 rtmsg_to_fib6_config(net, &rtmsg, &cfg); in ipv6_route_ioctl()
2143 struct net *net = dev_net(idev->dev); in addrconf_dst_alloc() local
2144 struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev, in addrconf_dst_alloc()
2165 rt->rt6i_table = fib6_get_table(net, RT6_TABLE_LOCAL); in addrconf_dst_alloc()
2172 int ip6_route_get_saddr(struct net *net, in ip6_route_get_saddr() argument
2183 err = ipv6_dev_get_saddr(net, idev ? idev->dev : NULL, in ip6_route_get_saddr()
2191 struct net *net; member
2198 struct net *net = ((struct arg_dev_net_ip *)arg)->net; in fib6_remove_prefsrc() local
2202 rt != net->ipv6.ip6_null_entry && in fib6_remove_prefsrc()
2212 struct net *net = dev_net(ifp->idev->dev); in rt6_remove_prefsrc() local
2215 .net = net, in rt6_remove_prefsrc()
2218 fib6_clean_all(net, fib6_remove_prefsrc, &adni); in rt6_remove_prefsrc()
2237 void rt6_clean_tohost(struct net *net, struct in6_addr *gateway) in rt6_clean_tohost() argument
2239 fib6_clean_all(net, fib6_clean_tohost, gateway); in rt6_clean_tohost()
2244 struct net *net; member
2253 rt != adn->net->ipv6.ip6_null_entry) in fib6_ifdown()
2259 void rt6_ifdown(struct net *net, struct net_device *dev) in rt6_ifdown() argument
2263 .net = net, in rt6_ifdown()
2266 fib6_clean_all(net, fib6_ifdown, &adn); in rt6_ifdown()
2519 static int rt6_fill_node(struct net *net, in rt6_fill_node() argument
2609 int err = ip6mr_get_route(net, skb, rtm, nowait, in rt6_fill_node()
2628 if (ip6_route_get_saddr(net, rt, dst, 0, &saddr_buf) == 0 && in rt6_fill_node()
2677 return rt6_fill_node(arg->net, in rt6_dump_route()
2685 struct net *net = sock_net(in_skb->sk); in inet6_rtm_getroute() local
2733 dev = __dev_get_by_index(net, iif); in inet6_rtm_getroute()
2744 rt = (struct rt6_info *)ip6_route_input_lookup(net, dev, &fl6, in inet6_rtm_getroute()
2749 rt = (struct rt6_info *)ip6_route_output(net, NULL, &fl6); in inet6_rtm_getroute()
2767 err = rt6_fill_node(net, skb, rt, &fl6.daddr, &fl6.saddr, iif, in inet6_rtm_getroute()
2775 err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid); in inet6_rtm_getroute()
2783 struct net *net = info->nl_net; in inet6_rt_notify() local
2794 err = rt6_fill_node(net, skb, rt, NULL, NULL, 0, in inet6_rt_notify()
2802 rtnl_notify(skb, net, info->portid, RTNLGRP_IPV6_ROUTE, in inet6_rt_notify()
2807 rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err); in inet6_rt_notify()
2814 struct net *net = dev_net(dev); in ip6_route_dev_notify() local
2820 net->ipv6.ip6_null_entry->dst.dev = dev; in ip6_route_dev_notify()
2821 net->ipv6.ip6_null_entry->rt6i_idev = in6_dev_get(dev); in ip6_route_dev_notify()
2823 net->ipv6.ip6_prohibit_entry->dst.dev = dev; in ip6_route_dev_notify()
2824 net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev); in ip6_route_dev_notify()
2825 net->ipv6.ip6_blk_hole_entry->dst.dev = dev; in ip6_route_dev_notify()
2826 net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); in ip6_route_dev_notify()
2833 in6_dev_put(net->ipv6.ip6_null_entry->rt6i_idev); in ip6_route_dev_notify()
2835 in6_dev_put(net->ipv6.ip6_prohibit_entry->rt6i_idev); in ip6_route_dev_notify()
2836 in6_dev_put(net->ipv6.ip6_blk_hole_entry->rt6i_idev); in ip6_route_dev_notify()
2859 struct net *net = (struct net *)seq->private; in rt6_stats_seq_show() local
2861 net->ipv6.rt6_stats->fib_nodes, in rt6_stats_seq_show()
2862 net->ipv6.rt6_stats->fib_route_nodes, in rt6_stats_seq_show()
2863 net->ipv6.rt6_stats->fib_rt_alloc, in rt6_stats_seq_show()
2864 net->ipv6.rt6_stats->fib_rt_entries, in rt6_stats_seq_show()
2865 net->ipv6.rt6_stats->fib_rt_cache, in rt6_stats_seq_show()
2866 dst_entries_get_slow(&net->ipv6.ip6_dst_ops), in rt6_stats_seq_show()
2867 net->ipv6.rt6_stats->fib_discarded_routes); in rt6_stats_seq_show()
2892 struct net *net; in ipv6_sysctl_rtcache_flush() local
2897 net = (struct net *)ctl->extra1; in ipv6_sysctl_rtcache_flush()
2898 delay = net->ipv6.sysctl.flush_delay; in ipv6_sysctl_rtcache_flush()
2900 fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0); in ipv6_sysctl_rtcache_flush()
2978 struct ctl_table * __net_init ipv6_route_sysctl_init(struct net *net) in ipv6_route_sysctl_init() argument
2987 table[0].data = &net->ipv6.sysctl.flush_delay; in ipv6_route_sysctl_init()
2988 table[0].extra1 = net; in ipv6_route_sysctl_init()
2989 table[1].data = &net->ipv6.ip6_dst_ops.gc_thresh; in ipv6_route_sysctl_init()
2990 table[2].data = &net->ipv6.sysctl.ip6_rt_max_size; in ipv6_route_sysctl_init()
2991 table[3].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; in ipv6_route_sysctl_init()
2992 table[4].data = &net->ipv6.sysctl.ip6_rt_gc_timeout; in ipv6_route_sysctl_init()
2993 table[5].data = &net->ipv6.sysctl.ip6_rt_gc_interval; in ipv6_route_sysctl_init()
2994 table[6].data = &net->ipv6.sysctl.ip6_rt_gc_elasticity; in ipv6_route_sysctl_init()
2995 table[7].data = &net->ipv6.sysctl.ip6_rt_mtu_expires; in ipv6_route_sysctl_init()
2996 table[8].data = &net->ipv6.sysctl.ip6_rt_min_advmss; in ipv6_route_sysctl_init()
2997 table[9].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; in ipv6_route_sysctl_init()
3000 if (net->user_ns != &init_user_ns) in ipv6_route_sysctl_init()
3008 static int __net_init ip6_route_net_init(struct net *net) in ip6_route_net_init() argument
3012 memcpy(&net->ipv6.ip6_dst_ops, &ip6_dst_ops_template, in ip6_route_net_init()
3013 sizeof(net->ipv6.ip6_dst_ops)); in ip6_route_net_init()
3015 if (dst_entries_init(&net->ipv6.ip6_dst_ops) < 0) in ip6_route_net_init()
3018 net->ipv6.ip6_null_entry = kmemdup(&ip6_null_entry_template, in ip6_route_net_init()
3019 sizeof(*net->ipv6.ip6_null_entry), in ip6_route_net_init()
3021 if (!net->ipv6.ip6_null_entry) in ip6_route_net_init()
3023 net->ipv6.ip6_null_entry->dst.path = in ip6_route_net_init()
3024 (struct dst_entry *)net->ipv6.ip6_null_entry; in ip6_route_net_init()
3025 net->ipv6.ip6_null_entry->dst.ops = &net->ipv6.ip6_dst_ops; in ip6_route_net_init()
3026 dst_init_metrics(&net->ipv6.ip6_null_entry->dst, in ip6_route_net_init()
3030 net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, in ip6_route_net_init()
3031 sizeof(*net->ipv6.ip6_prohibit_entry), in ip6_route_net_init()
3033 if (!net->ipv6.ip6_prohibit_entry) in ip6_route_net_init()
3035 net->ipv6.ip6_prohibit_entry->dst.path = in ip6_route_net_init()
3036 (struct dst_entry *)net->ipv6.ip6_prohibit_entry; in ip6_route_net_init()
3037 net->ipv6.ip6_prohibit_entry->dst.ops = &net->ipv6.ip6_dst_ops; in ip6_route_net_init()
3038 dst_init_metrics(&net->ipv6.ip6_prohibit_entry->dst, in ip6_route_net_init()
3041 net->ipv6.ip6_blk_hole_entry = kmemdup(&ip6_blk_hole_entry_template, in ip6_route_net_init()
3042 sizeof(*net->ipv6.ip6_blk_hole_entry), in ip6_route_net_init()
3044 if (!net->ipv6.ip6_blk_hole_entry) in ip6_route_net_init()
3046 net->ipv6.ip6_blk_hole_entry->dst.path = in ip6_route_net_init()
3047 (struct dst_entry *)net->ipv6.ip6_blk_hole_entry; in ip6_route_net_init()
3048 net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops; in ip6_route_net_init()
3049 dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst, in ip6_route_net_init()
3053 net->ipv6.sysctl.flush_delay = 0; in ip6_route_net_init()
3054 net->ipv6.sysctl.ip6_rt_max_size = 4096; in ip6_route_net_init()
3055 net->ipv6.sysctl.ip6_rt_gc_min_interval = HZ / 2; in ip6_route_net_init()
3056 net->ipv6.sysctl.ip6_rt_gc_timeout = 60*HZ; in ip6_route_net_init()
3057 net->ipv6.sysctl.ip6_rt_gc_interval = 30*HZ; in ip6_route_net_init()
3058 net->ipv6.sysctl.ip6_rt_gc_elasticity = 9; in ip6_route_net_init()
3059 net->ipv6.sysctl.ip6_rt_mtu_expires = 10*60*HZ; in ip6_route_net_init()
3060 net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40; in ip6_route_net_init()
3062 net->ipv6.ip6_rt_gc_expire = 30*HZ; in ip6_route_net_init()
3070 kfree(net->ipv6.ip6_prohibit_entry); in ip6_route_net_init()
3072 kfree(net->ipv6.ip6_null_entry); in ip6_route_net_init()
3075 dst_entries_destroy(&net->ipv6.ip6_dst_ops); in ip6_route_net_init()
3080 static void __net_exit ip6_route_net_exit(struct net *net) in ip6_route_net_exit() argument
3082 kfree(net->ipv6.ip6_null_entry); in ip6_route_net_exit()
3084 kfree(net->ipv6.ip6_prohibit_entry); in ip6_route_net_exit()
3085 kfree(net->ipv6.ip6_blk_hole_entry); in ip6_route_net_exit()
3087 dst_entries_destroy(&net->ipv6.ip6_dst_ops); in ip6_route_net_exit()
3090 static int __net_init ip6_route_net_init_late(struct net *net) in ip6_route_net_init_late() argument
3093 proc_create("ipv6_route", 0, net->proc_net, &ipv6_route_proc_fops); in ip6_route_net_init_late()
3094 proc_create("rt6_stats", S_IRUGO, net->proc_net, &rt6_stats_seq_fops); in ip6_route_net_init_late()
3099 static void __net_exit ip6_route_net_exit_late(struct net *net) in ip6_route_net_exit_late() argument
3102 remove_proc_entry("ipv6_route", net->proc_net); in ip6_route_net_exit_late()
3103 remove_proc_entry("rt6_stats", net->proc_net); in ip6_route_net_exit_late()
3112 static int __net_init ipv6_inetpeer_init(struct net *net) in ipv6_inetpeer_init() argument
3119 net->ipv6.peers = bp; in ipv6_inetpeer_init()
3123 static void __net_exit ipv6_inetpeer_exit(struct net *net) in ipv6_inetpeer_exit() argument
3125 struct inet_peer_base *bp = net->ipv6.peers; in ipv6_inetpeer_exit()
3127 net->ipv6.peers = NULL; in ipv6_inetpeer_exit()