Lines Matching refs:net
98 static struct rt6_info *rt6_add_route_info(struct net *net,
102 static struct rt6_info *rt6_get_route_info(struct net *net,
302 static inline struct rt6_info *ip6_dst_alloc(struct net *net, in ip6_dst_alloc() argument
307 struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev, in ip6_dst_alloc()
314 rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers); in ip6_dst_alloc()
437 static inline struct rt6_info *rt6_device_match(struct net *net, in rt6_device_match() argument
467 if (ipv6_chk_addr(net, saddr, dev, in rt6_device_match()
478 return net->ipv6.ip6_null_entry; in rt6_device_match()
672 struct net *net; in rt6_select() local
693 net = dev_net(rt0->dst.dev); in rt6_select()
694 return match ? match : net->ipv6.ip6_null_entry; in rt6_select()
701 struct net *net = dev_net(dev); in rt6_route_rcv() local
746 rt = rt6_get_route_info(net, prefix, rinfo->prefix_len, in rt6_route_rcv()
755 rt = rt6_add_route_info(net, prefix, rinfo->prefix_len, gwaddr, dev->ifindex, in rt6_route_rcv()
790 static struct rt6_info *ip6_pol_route_lookup(struct net *net, in ip6_pol_route_lookup() argument
801 rt = rt6_device_match(net, rt, &fl6->saddr, fl6->flowi6_oif, flags); in ip6_pol_route_lookup()
804 if (rt == net->ipv6.ip6_null_entry) { in ip6_pol_route_lookup()
815 struct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6, in ip6_route_lookup() argument
818 return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_lookup); in ip6_route_lookup()
822 struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr, in rt6_lookup() argument
837 dst = fib6_rule_lookup(net, &fl6, flags, ip6_pol_route_lookup); in rt6_lookup()
915 static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, int oif, in ip6_pol_route() argument
925 if (net->ipv6.devconf_all->forwarding == 0) in ip6_pol_route()
938 if (rt == net->ipv6.ip6_null_entry) { in ip6_pol_route()
968 rt = nrt ? : net->ipv6.ip6_null_entry; in ip6_pol_route()
994 static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table *table, in ip6_pol_route_input() argument
997 return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags); in ip6_pol_route_input()
1000 static struct dst_entry *ip6_route_input_lookup(struct net *net, in ip6_route_input_lookup() argument
1007 return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_input); in ip6_route_input_lookup()
1013 struct net *net = dev_net(skb->dev); in ip6_route_input() local
1024 skb_dst_set(skb, ip6_route_input_lookup(net, skb->dev, &fl6, flags)); in ip6_route_input()
1027 static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table, in ip6_pol_route_output() argument
1030 return ip6_pol_route(net, table, fl6->flowi6_oif, fl6, flags); in ip6_pol_route_output()
1033 struct dst_entry *ip6_route_output_flags(struct net *net, const struct sock *sk, in ip6_route_output_flags() argument
1046 return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_output); in ip6_route_output_flags()
1050 struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_orig) in ip6_blackhole_route() argument
1060 rt6_init_peer(rt, net->ipv6.peers); in ip6_blackhole_route()
1156 struct net *net = dev_net(dst->dev); in ip6_rt_update_pmtu() local
1163 rt6_update_expires(rt6, net->ipv6.sysctl.ip6_rt_mtu_expires); in ip6_rt_update_pmtu()
1167 void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, in ip6_update_pmtu() argument
1176 fl6.flowi6_mark = mark ? mark : IP6_REPLY_MARK(net, skb->mark); in ip6_update_pmtu()
1181 dst = ip6_route_output(net, NULL, &fl6); in ip6_update_pmtu()
1201 static struct rt6_info *__ip6_route_redirect(struct net *net, in __ip6_route_redirect() argument
1238 rt = net->ipv6.ip6_null_entry; in __ip6_route_redirect()
1240 rt = net->ipv6.ip6_null_entry; in __ip6_route_redirect()
1244 if (rt == net->ipv6.ip6_null_entry) { in __ip6_route_redirect()
1258 static struct dst_entry *ip6_route_redirect(struct net *net, in ip6_route_redirect() argument
1268 return fib6_rule_lookup(net, &rdfl.fl6, in ip6_route_redirect()
1272 void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark) in ip6_redirect() argument
1286 dst = ip6_route_redirect(net, &fl6, &ipv6_hdr(skb)->saddr); in ip6_redirect()
1292 void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif, in ip6_redirect_no_header() argument
1307 dst = ip6_route_redirect(net, &fl6, &iph->saddr); in ip6_redirect_no_header()
1322 struct net *net = dev_net(dev); in ip6_default_advmss() local
1326 if (mtu < net->ipv6.sysctl.ip6_rt_min_advmss) in ip6_default_advmss()
1327 mtu = net->ipv6.sysctl.ip6_rt_min_advmss; in ip6_default_advmss()
1369 struct net *net = dev_net(dev); in icmp6_dst_alloc() local
1374 rt = ip6_dst_alloc(net, dev, 0, NULL); in icmp6_dst_alloc()
1395 fib6_force_start_gc(net); in icmp6_dst_alloc()
1397 dst = xfrm_lookup(net, &rt->dst, flowi6_to_flowi(fl6), NULL, 0); in icmp6_dst_alloc()
1447 struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); in ip6_dst_gc() local
1448 int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; in ip6_dst_gc()
1449 int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; in ip6_dst_gc()
1450 int rt_elasticity = net->ipv6.sysctl.ip6_rt_gc_elasticity; in ip6_dst_gc()
1451 int rt_gc_timeout = net->ipv6.sysctl.ip6_rt_gc_timeout; in ip6_dst_gc()
1452 unsigned long rt_last_gc = net->ipv6.ip6_rt_last_gc; in ip6_dst_gc()
1460 net->ipv6.ip6_rt_gc_expire++; in ip6_dst_gc()
1461 fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, true); in ip6_dst_gc()
1464 net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; in ip6_dst_gc()
1466 net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>rt_elasticity; in ip6_dst_gc()
1519 struct net *net = cfg->fc_nlinfo.nl_net; in ip6_route_info_create() local
1534 dev = dev_get_by_index(net, cfg->fc_ifindex); in ip6_route_info_create()
1548 table = fib6_get_table(net, cfg->fc_table); in ip6_route_info_create()
1551 table = fib6_new_table(net, cfg->fc_table); in ip6_route_info_create()
1554 table = fib6_new_table(net, cfg->fc_table); in ip6_route_info_create()
1560 rt = ip6_dst_alloc(net, NULL, (cfg->fc_flags & RTF_ADDRCONF) ? 0 : DST_NOCOUNT, table); in ip6_route_info_create()
1610 if (dev != net->loopback_dev) { in ip6_route_info_create()
1615 dev = net->loopback_dev; in ip6_route_info_create()
1668 grt = rt6_lookup(net, gw_addr, NULL, cfg->fc_ifindex, 1); in ip6_route_info_create()
1701 if (!ipv6_chk_addr(net, &cfg->fc_prefsrc, dev, 0)) { in ip6_route_info_create()
1765 struct net *net = dev_net(rt->dst.dev); in __ip6_del_rt() local
1767 if (rt == net->ipv6.ip6_null_entry) { in __ip6_del_rt()
1831 struct net *net = dev_net(skb->dev); in rt6_do_redirect() local
1892 if (rt == net->ipv6.ip6_null_entry) { in rt6_do_redirect()
1953 struct net *net = dev_net(ort->dst.dev); in ip6_rt_copy() local
1954 struct rt6_info *rt = ip6_dst_alloc(net, ort->dst.dev, 0, in ip6_rt_copy()
1989 static struct rt6_info *rt6_get_route_info(struct net *net, in rt6_get_route_info() argument
1997 table = fib6_get_table(net, RT6_TABLE_INFO); in rt6_get_route_info()
2021 static struct rt6_info *rt6_add_route_info(struct net *net, in rt6_add_route_info() argument
2035 .fc_nlinfo.nl_net = net, in rt6_add_route_info()
2047 return rt6_get_route_info(net, prefix, prefixlen, gwaddr, ifindex); in rt6_add_route_info()
2095 void rt6_purge_dflt_routers(struct net *net) in rt6_purge_dflt_routers() argument
2101 table = fib6_get_table(net, RT6_TABLE_DFLT); in rt6_purge_dflt_routers()
2119 static void rtmsg_to_fib6_config(struct net *net, in rtmsg_to_fib6_config() argument
2133 cfg->fc_nlinfo.nl_net = net; in rtmsg_to_fib6_config()
2140 int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg) in ipv6_route_ioctl() argument
2149 if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) in ipv6_route_ioctl()
2156 rtmsg_to_fib6_config(net, &rtmsg, &cfg); in ipv6_route_ioctl()
2234 struct net *net = dev_net(idev->dev); in addrconf_dst_alloc() local
2235 struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev, in addrconf_dst_alloc()
2256 rt->rt6i_table = fib6_get_table(net, RT6_TABLE_LOCAL); in addrconf_dst_alloc()
2263 int ip6_route_get_saddr(struct net *net, in ip6_route_get_saddr() argument
2275 err = ipv6_dev_get_saddr(net, idev ? idev->dev : NULL, in ip6_route_get_saddr()
2283 struct net *net; member
2290 struct net *net = ((struct arg_dev_net_ip *)arg)->net; in fib6_remove_prefsrc() local
2294 rt != net->ipv6.ip6_null_entry && in fib6_remove_prefsrc()
2304 struct net *net = dev_net(ifp->idev->dev); in rt6_remove_prefsrc() local
2307 .net = net, in rt6_remove_prefsrc()
2310 fib6_clean_all(net, fib6_remove_prefsrc, &adni); in rt6_remove_prefsrc()
2329 void rt6_clean_tohost(struct net *net, struct in6_addr *gateway) in rt6_clean_tohost() argument
2331 fib6_clean_all(net, fib6_clean_tohost, gateway); in rt6_clean_tohost()
2336 struct net *net; member
2345 rt != adn->net->ipv6.ip6_null_entry) in fib6_ifdown()
2351 void rt6_ifdown(struct net *net, struct net_device *dev) in rt6_ifdown() argument
2355 .net = net, in rt6_ifdown()
2358 fib6_clean_all(net, fib6_ifdown, &adn); in rt6_ifdown()
2752 static int rt6_fill_node(struct net *net, in rt6_fill_node() argument
2842 int err = ip6mr_get_route(net, skb, rtm, nowait); in rt6_fill_node()
2859 if (ip6_route_get_saddr(net, rt, dst, 0, &saddr_buf) == 0 && in rt6_fill_node()
2912 return rt6_fill_node(arg->net, in rt6_dump_route()
2920 struct net *net = sock_net(in_skb->sk); in inet6_rtm_getroute() local
2962 dev = __dev_get_by_index(net, iif); in inet6_rtm_getroute()
2973 rt = (struct rt6_info *)ip6_route_input_lookup(net, dev, &fl6, in inet6_rtm_getroute()
2978 rt = (struct rt6_info *)ip6_route_output(net, NULL, &fl6); in inet6_rtm_getroute()
2996 err = rt6_fill_node(net, skb, rt, &fl6.daddr, &fl6.saddr, iif, in inet6_rtm_getroute()
3004 err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid); in inet6_rtm_getroute()
3012 struct net *net = info->nl_net; in inet6_rt_notify() local
3023 err = rt6_fill_node(net, skb, rt, NULL, NULL, 0, in inet6_rt_notify()
3031 rtnl_notify(skb, net, info->portid, RTNLGRP_IPV6_ROUTE, in inet6_rt_notify()
3036 rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err); in inet6_rt_notify()
3043 struct net *net = dev_net(dev); in ip6_route_dev_notify() local
3046 net->ipv6.ip6_null_entry->dst.dev = dev; in ip6_route_dev_notify()
3047 net->ipv6.ip6_null_entry->rt6i_idev = in6_dev_get(dev); in ip6_route_dev_notify()
3049 net->ipv6.ip6_prohibit_entry->dst.dev = dev; in ip6_route_dev_notify()
3050 net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev); in ip6_route_dev_notify()
3051 net->ipv6.ip6_blk_hole_entry->dst.dev = dev; in ip6_route_dev_notify()
3052 net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); in ip6_route_dev_notify()
3075 struct net *net = (struct net *)seq->private; in rt6_stats_seq_show() local
3077 net->ipv6.rt6_stats->fib_nodes, in rt6_stats_seq_show()
3078 net->ipv6.rt6_stats->fib_route_nodes, in rt6_stats_seq_show()
3079 net->ipv6.rt6_stats->fib_rt_alloc, in rt6_stats_seq_show()
3080 net->ipv6.rt6_stats->fib_rt_entries, in rt6_stats_seq_show()
3081 net->ipv6.rt6_stats->fib_rt_cache, in rt6_stats_seq_show()
3082 dst_entries_get_slow(&net->ipv6.ip6_dst_ops), in rt6_stats_seq_show()
3083 net->ipv6.rt6_stats->fib_discarded_routes); in rt6_stats_seq_show()
3108 struct net *net; in ipv6_sysctl_rtcache_flush() local
3113 net = (struct net *)ctl->extra1; in ipv6_sysctl_rtcache_flush()
3114 delay = net->ipv6.sysctl.flush_delay; in ipv6_sysctl_rtcache_flush()
3116 fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0); in ipv6_sysctl_rtcache_flush()
3194 struct ctl_table * __net_init ipv6_route_sysctl_init(struct net *net) in ipv6_route_sysctl_init() argument
3203 table[0].data = &net->ipv6.sysctl.flush_delay; in ipv6_route_sysctl_init()
3204 table[0].extra1 = net; in ipv6_route_sysctl_init()
3205 table[1].data = &net->ipv6.ip6_dst_ops.gc_thresh; in ipv6_route_sysctl_init()
3206 table[2].data = &net->ipv6.sysctl.ip6_rt_max_size; in ipv6_route_sysctl_init()
3207 table[3].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; in ipv6_route_sysctl_init()
3208 table[4].data = &net->ipv6.sysctl.ip6_rt_gc_timeout; in ipv6_route_sysctl_init()
3209 table[5].data = &net->ipv6.sysctl.ip6_rt_gc_interval; in ipv6_route_sysctl_init()
3210 table[6].data = &net->ipv6.sysctl.ip6_rt_gc_elasticity; in ipv6_route_sysctl_init()
3211 table[7].data = &net->ipv6.sysctl.ip6_rt_mtu_expires; in ipv6_route_sysctl_init()
3212 table[8].data = &net->ipv6.sysctl.ip6_rt_min_advmss; in ipv6_route_sysctl_init()
3213 table[9].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; in ipv6_route_sysctl_init()
3216 if (net->user_ns != &init_user_ns) in ipv6_route_sysctl_init()
3224 static int __net_init ip6_route_net_init(struct net *net) in ip6_route_net_init() argument
3228 memcpy(&net->ipv6.ip6_dst_ops, &ip6_dst_ops_template, in ip6_route_net_init()
3229 sizeof(net->ipv6.ip6_dst_ops)); in ip6_route_net_init()
3231 if (dst_entries_init(&net->ipv6.ip6_dst_ops) < 0) in ip6_route_net_init()
3234 net->ipv6.ip6_null_entry = kmemdup(&ip6_null_entry_template, in ip6_route_net_init()
3235 sizeof(*net->ipv6.ip6_null_entry), in ip6_route_net_init()
3237 if (!net->ipv6.ip6_null_entry) in ip6_route_net_init()
3239 net->ipv6.ip6_null_entry->dst.path = in ip6_route_net_init()
3240 (struct dst_entry *)net->ipv6.ip6_null_entry; in ip6_route_net_init()
3241 net->ipv6.ip6_null_entry->dst.ops = &net->ipv6.ip6_dst_ops; in ip6_route_net_init()
3242 dst_init_metrics(&net->ipv6.ip6_null_entry->dst, in ip6_route_net_init()
3246 net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, in ip6_route_net_init()
3247 sizeof(*net->ipv6.ip6_prohibit_entry), in ip6_route_net_init()
3249 if (!net->ipv6.ip6_prohibit_entry) in ip6_route_net_init()
3251 net->ipv6.ip6_prohibit_entry->dst.path = in ip6_route_net_init()
3252 (struct dst_entry *)net->ipv6.ip6_prohibit_entry; in ip6_route_net_init()
3253 net->ipv6.ip6_prohibit_entry->dst.ops = &net->ipv6.ip6_dst_ops; in ip6_route_net_init()
3254 dst_init_metrics(&net->ipv6.ip6_prohibit_entry->dst, in ip6_route_net_init()
3257 net->ipv6.ip6_blk_hole_entry = kmemdup(&ip6_blk_hole_entry_template, in ip6_route_net_init()
3258 sizeof(*net->ipv6.ip6_blk_hole_entry), in ip6_route_net_init()
3260 if (!net->ipv6.ip6_blk_hole_entry) in ip6_route_net_init()
3262 net->ipv6.ip6_blk_hole_entry->dst.path = in ip6_route_net_init()
3263 (struct dst_entry *)net->ipv6.ip6_blk_hole_entry; in ip6_route_net_init()
3264 net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops; in ip6_route_net_init()
3265 dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst, in ip6_route_net_init()
3269 net->ipv6.sysctl.flush_delay = 0; in ip6_route_net_init()
3270 net->ipv6.sysctl.ip6_rt_max_size = 4096; in ip6_route_net_init()
3271 net->ipv6.sysctl.ip6_rt_gc_min_interval = HZ / 2; in ip6_route_net_init()
3272 net->ipv6.sysctl.ip6_rt_gc_timeout = 60*HZ; in ip6_route_net_init()
3273 net->ipv6.sysctl.ip6_rt_gc_interval = 30*HZ; in ip6_route_net_init()
3274 net->ipv6.sysctl.ip6_rt_gc_elasticity = 9; in ip6_route_net_init()
3275 net->ipv6.sysctl.ip6_rt_mtu_expires = 10*60*HZ; in ip6_route_net_init()
3276 net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40; in ip6_route_net_init()
3278 net->ipv6.ip6_rt_gc_expire = 30*HZ; in ip6_route_net_init()
3286 kfree(net->ipv6.ip6_prohibit_entry); in ip6_route_net_init()
3288 kfree(net->ipv6.ip6_null_entry); in ip6_route_net_init()
3291 dst_entries_destroy(&net->ipv6.ip6_dst_ops); in ip6_route_net_init()
3296 static void __net_exit ip6_route_net_exit(struct net *net) in ip6_route_net_exit() argument
3298 kfree(net->ipv6.ip6_null_entry); in ip6_route_net_exit()
3300 kfree(net->ipv6.ip6_prohibit_entry); in ip6_route_net_exit()
3301 kfree(net->ipv6.ip6_blk_hole_entry); in ip6_route_net_exit()
3303 dst_entries_destroy(&net->ipv6.ip6_dst_ops); in ip6_route_net_exit()
3306 static int __net_init ip6_route_net_init_late(struct net *net) in ip6_route_net_init_late() argument
3309 proc_create("ipv6_route", 0, net->proc_net, &ipv6_route_proc_fops); in ip6_route_net_init_late()
3310 proc_create("rt6_stats", S_IRUGO, net->proc_net, &rt6_stats_seq_fops); in ip6_route_net_init_late()
3315 static void __net_exit ip6_route_net_exit_late(struct net *net) in ip6_route_net_exit_late() argument
3318 remove_proc_entry("ipv6_route", net->proc_net); in ip6_route_net_exit_late()
3319 remove_proc_entry("rt6_stats", net->proc_net); in ip6_route_net_exit_late()
3328 static int __net_init ipv6_inetpeer_init(struct net *net) in ipv6_inetpeer_init() argument
3335 net->ipv6.peers = bp; in ipv6_inetpeer_init()
3339 static void __net_exit ipv6_inetpeer_exit(struct net *net) in ipv6_inetpeer_exit() argument
3341 struct inet_peer_base *bp = net->ipv6.peers; in ipv6_inetpeer_exit()
3343 net->ipv6.peers = NULL; in ipv6_inetpeer_exit()