Lines Matching refs:fib6_nh
105 static int rt6_score_route(const struct fib6_nh *nh, u32 fib6_flags, int oif,
437 if (fl6->mp_hash <= atomic_read(&match->fib6_nh->fib_nh_upper_bound))
442 const struct fib6_nh *nh = sibling->fib6_nh;
456 res->nh = match->fib6_nh;
463 static bool __rt6_device_match(struct net *net, const struct fib6_nh *nh,
489 struct fib6_nh *nh;
492 static int __rt6_nh_dev_match(struct fib6_nh *nh, void *_arg)
501 /* returns fib6_nh from nexthop or NULL */
502 static struct fib6_nh *rt6_nh_dev_match(struct net *net, struct nexthop *nh,
528 struct fib6_nh *nh;
536 nh = f6i->fib6_nh;
551 nh = spf6i->fib6_nh;
563 nh = res->f6i->fib6_nh;
572 nh = f6i->fib6_nh;
577 nh = res->f6i->fib6_nh;
610 static void rt6_probe(struct fib6_nh *fib6_nh)
627 if (!fib6_nh->fib_nh_gw_family)
630 nh_gw = &fib6_nh->fib_nh_gw6;
631 dev = fib6_nh->fib_nh_dev;
633 last_probe = READ_ONCE(fib6_nh->last_probe);
656 if (!work || cmpxchg(&fib6_nh->last_probe,
671 static inline void rt6_probe(struct fib6_nh *fib6_nh)
679 static enum rt6_nud_state rt6_check_neigh(const struct fib6_nh *fib6_nh)
685 neigh = __ipv6_neigh_lookup_noref(fib6_nh->fib_nh_dev,
686 &fib6_nh->fib_nh_gw6);
707 static int rt6_score_route(const struct fib6_nh *nh, u32 fib6_flags, int oif,
729 static bool find_match(struct fib6_nh *nh, u32 fib6_flags,
771 struct fib6_nh *nh;
774 static int rt6_nh_find_match(struct fib6_nh *nh, void *_arg)
794 struct fib6_nh *nh;
826 nh = f6i->fib6_nh;
912 res->nh = res->f6i->fib6_nh;
1120 const struct fib6_nh *nh = res->nh;
1580 const struct fib6_nh *nh = res->nh;
1608 struct rt6_exception_bucket *fib6_nh_get_excptn_bucket(const struct fib6_nh *nh,
1638 static void fib6_nh_excptn_bucket_set_flushed(struct fib6_nh *nh,
1661 struct fib6_nh *nh = res->nh;
1736 static void fib6_nh_flush_exceptions(struct fib6_nh *nh, struct fib6_info *from)
1766 static int rt6_nh_flush_exceptions(struct fib6_nh *nh, void *arg)
1781 fib6_nh_flush_exceptions(f6i->fib6_nh, f6i);
1830 static int fib6_nh_remove_exception(const struct fib6_nh *nh, int plen,
1873 static int rt6_nh_remove_exception_rt(struct fib6_nh *nh, void *_arg)
1907 return fib6_nh_remove_exception(from->fib6_nh,
1914 static void fib6_nh_update_exception(const struct fib6_nh *nh, int plen,
1940 struct fib6_nh *match;
1943 /* determine if fib6_nh has given device and gateway */
1944 static int fib6_nh_find_match(struct fib6_nh *nh, void *_arg)
1963 struct fib6_nh *fib6_nh;
1981 fib6_nh = arg.match;
1983 fib6_nh = from->fib6_nh;
1985 fib6_nh_update_exception(fib6_nh, from->fib6_src.plen, rt);
2013 const struct fib6_nh *nh, int mtu)
2041 static void fib6_nh_exceptions_clean_tohost(const struct fib6_nh *nh,
2118 static void fib6_nh_age_exceptions(const struct fib6_nh *nh,
2152 static int rt6_nh_age_exceptions(struct fib6_nh *nh, void *_arg)
2173 fib6_nh_age_exceptions(f6i->fib6_nh, gc_args, now);
2776 /* fib6_info uses a nexthop that does not have fib6_nh
2784 res.nh = res.f6i->fib6_nh;
2871 const struct fib6_nh *nh = res->nh;
2903 static int fib6_nh_redirect_match(struct fib6_nh *nh, void *_arg)
2969 res.nh = rt->fib6_nh;
2990 res.nh = rt->fib6_nh;
3124 const struct fib6_nh *nh = res->nh;
3411 int fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh,
3420 fib6_nh->fib_nh_family = AF_INET6;
3422 fib6_nh->last_probe = jiffies;
3425 fib6_nh->fib_nh_gw6 = cfg->fc_gateway;
3426 fib6_nh->fib_nh_gw_family = AF_INET6;
3453 fib6_nh->fib_nh_flags |= RTNH_F_ONLINK;
3456 fib6_nh->fib_nh_weight = 1;
3485 fib6_nh->fib_nh_gw6 = cfg->fc_gateway;
3486 fib6_nh->fib_nh_gw_family = AF_INET6;
3507 fib6_nh->fib_nh_flags |= RTNH_F_LINKDOWN;
3509 err = fib_nh_common_init(net, &fib6_nh->nh_common, cfg->fc_encap,
3515 fib6_nh->rt6i_pcpu = alloc_percpu_gfp(struct rt6_info *, gfp_flags);
3516 if (!fib6_nh->rt6i_pcpu) {
3521 fib6_nh->fib_nh_dev = dev;
3522 fib6_nh->fib_nh_oif = dev->ifindex;
3529 lwtstate_put(fib6_nh->fib_nh_lws);
3530 fib6_nh->fib_nh_lws = NULL;
3538 void fib6_nh_release(struct fib6_nh *fib6_nh)
3544 fib6_nh_flush_exceptions(fib6_nh, NULL);
3545 bucket = fib6_nh_get_excptn_bucket(fib6_nh, NULL);
3547 rcu_assign_pointer(fib6_nh->rt6i_exception_bucket, NULL);
3553 if (fib6_nh->rt6i_pcpu) {
3560 ppcpu_rt = per_cpu_ptr(fib6_nh->rt6i_pcpu, cpu);
3569 free_percpu(fib6_nh->rt6i_pcpu);
3572 fib_nh_common_release(&fib6_nh->nh_common);
3575 void fib6_nh_release_dsts(struct fib6_nh *fib6_nh)
3579 if (!fib6_nh->rt6i_pcpu)
3585 ppcpu_rt = per_cpu_ptr(fib6_nh->rt6i_pcpu, cpu);
3602 struct fib6_nh *fib6_nh;
3713 fib6_nh = nexthop_fib6_nh(rt->nh);
3715 err = fib6_nh_init(net, rt->fib6_nh, cfg, gfp_flags, extack);
3719 fib6_nh = rt->fib6_nh;
3725 if (fib6_is_reject(cfg->fc_flags, rt->fib6_nh->fib_nh_dev,
3731 struct net_device *dev = fib6_nh->fib_nh_dev;
3896 struct fib6_nh *nh)
3916 static int fib6_nh_del_cached_rt(struct fib6_nh *nh, void *_arg)
3958 struct fib6_nh *nh;
3972 nh = rt->fib6_nh;
3998 nh = rt->fib6_nh;
4125 /* fib6_info uses a nexthop that does not have fib6_nh
4132 res.nh = res.f6i->fib6_nh;
4189 if (rt->fib6_nh->fib_nh_dev->ifindex != ifindex)
4192 !rt->fib6_nh->fib_nh_gw_family)
4194 if (!ipv6_addr_equal(&rt->fib6_nh->fib_nh_gw6, gwaddr))
4252 struct fib6_nh *nh;
4258 nh = rt->fib6_nh;
4509 ((void *)rt->fib6_nh->fib_nh_dev == dev || !dev) &&
4537 struct fib6_nh *nh;
4543 nh = rt->fib6_nh;
4590 /* only called for fib entries with builtin fib6_nh */
4593 if (rt->fib6_nh->fib_nh_flags & RTNH_F_DEAD ||
4594 (rt->fib6_nh->fib_nh_flags & RTNH_F_LINKDOWN &&
4595 ip6_ignore_linkdown(rt->fib6_nh->fib_nh_dev)))
4607 total += rt->fib6_nh->fib_nh_weight;
4611 total += iter->fib6_nh->fib_nh_weight;
4622 *weight += rt->fib6_nh->fib_nh_weight;
4626 atomic_set(&rt->fib6_nh->fib_nh_upper_bound, upper_bound);
4670 rt->fib6_nh->fib_nh_dev == arg->dev) {
4671 rt->fib6_nh->fib_nh_flags &= ~arg->nh_flags;
4694 /* only called for fib entries with inline fib6_nh */
4700 if (rt->fib6_nh->fib_nh_dev == dev)
4703 if (iter->fib6_nh->fib_nh_dev == dev)
4724 if (rt->fib6_nh->fib_nh_dev == down_dev ||
4725 rt->fib6_nh->fib_nh_flags & RTNH_F_DEAD)
4728 if (iter->fib6_nh->fib_nh_dev == down_dev ||
4729 iter->fib6_nh->fib_nh_flags & RTNH_F_DEAD)
4741 if (rt->fib6_nh->fib_nh_dev == dev)
4742 rt->fib6_nh->fib_nh_flags |= nh_flags;
4744 if (iter->fib6_nh->fib_nh_dev == dev)
4745 iter->fib6_nh->fib_nh_flags |= nh_flags;
4760 return rt->fib6_nh->fib_nh_dev == dev ? -1 : 0;
4765 return rt->fib6_nh->fib_nh_dev == dev ? -1 : 0;
4781 if (rt->fib6_nh->fib_nh_dev != dev ||
4784 rt->fib6_nh->fib_nh_flags |= RTNH_F_LINKDOWN;
4821 static int fib6_nh_mtu_change(struct fib6_nh *nh, void *_arg)
4872 return fib6_nh_mtu_change(f6i->fib6_nh, arg);
5210 rt->fib6_nh->fib_nh_weight = rtnh->rtnh_hops + 1;
5413 /* add the overhead of this fib6_nh to nexthop_len */
5414 static int rt6_nh_nlmsg_size(struct fib6_nh *nh, void *arg)
5442 struct fib6_nh *nh = f6i->fib6_nh;
5450 rt6_nh_nlmsg_size(sibling->fib6_nh, &nexthop_len);
5487 struct fib6_nh *fib6_nh;
5489 fib6_nh = nexthop_fib6_nh(nh);
5490 if (fib_nexthop_info(skb, &fib6_nh->nh_common, AF_INET6,
5618 if (fib_add_nexthop(skb, &rt->fib6_nh->nh_common,
5619 rt->fib6_nh->fib_nh_weight, AF_INET6,
5625 if (fib_add_nexthop(skb, &sibling->fib6_nh->nh_common,
5626 sibling->fib6_nh->fib_nh_weight,
5645 if (fib_nexthop_info(skb, &rt->fib6_nh->nh_common, AF_INET6,
5679 static int fib6_info_nh_uses_dev(struct fib6_nh *nh, void *arg)
5700 if (f6i->fib6_nh->fib_nh_dev == dev)
5708 if (sibling->fib6_nh->fib_nh_dev == dev)
5724 static int rt6_nh_dump_exceptions(struct fib6_nh *nh, void *arg)
5832 err = rt6_nh_dump_exceptions(rt->fib6_nh, &w);
6127 net->ipv6.fib6_null_entry->fib6_nh->fib_nh_dev = dev;
6470 init_net.ipv6.fib6_null_entry->fib6_nh->fib_nh_dev = init_net.loopback_dev;