Lines Matching refs:nh

63 	int nhsel; const struct fib_nh *nh;				\
64 for (nhsel = 0, nh = (fi)->fib_nh; \
66 nh++, nhsel++)
79 int nhsel; const struct fib_nh *nh = (fi)->fib_nh; \
158 static void free_nh_exceptions(struct fib_nh *nh) in free_nh_exceptions() argument
163 hash = rcu_dereference_protected(nh->nh_exceptions, 1); in free_nh_exceptions()
260 if (nh->nh_oif != onh->nh_oif || in nh_comp()
261 nh->nh_gw != onh->nh_gw || in nh_comp()
262 nh->nh_scope != onh->nh_scope || in nh_comp()
264 nh->nh_weight != onh->nh_weight || in nh_comp()
267 nh->nh_tclassid != onh->nh_tclassid || in nh_comp()
269 ((nh->nh_flags ^ onh->nh_flags) & ~RTNH_F_DEAD)) in nh_comp()
294 val ^= fib_devindex_hashfn(nh->nh_oif); in fib_info_hashfn()
335 struct fib_nh *nh; in ip_fib_check_default() local
342 hlist_for_each_entry(nh, head, nh_hash) { in ip_fib_check_default()
343 if (nh->nh_dev == dev && in ip_fib_check_default()
344 nh->nh_gw == gw && in ip_fib_check_default()
345 !(nh->nh_flags & RTNH_F_DEAD)) { in ip_fib_check_default()
518 if (rtnh->rtnh_ifindex && rtnh->rtnh_ifindex != nh->nh_oif) in fib_nh_match()
526 if (nla && nla_get_in_addr(nla) != nh->nh_gw) in fib_nh_match()
530 if (nla && nla_get_u32(nla) != nh->nh_tclassid) in fib_nh_match()
586 struct fib_nh *nh) in fib_check_nh() argument
593 if (nh->nh_gw) { in fib_check_nh()
596 if (nh->nh_flags & RTNH_F_ONLINK) { in fib_check_nh()
600 if (inet_addr_type(net, nh->nh_gw) != RTN_UNICAST) in fib_check_nh()
602 dev = __dev_get_by_index(net, nh->nh_oif); in fib_check_nh()
607 nh->nh_dev = dev; in fib_check_nh()
609 nh->nh_scope = RT_SCOPE_LINK; in fib_check_nh()
615 .daddr = nh->nh_gw, in fib_check_nh()
617 .flowi4_oif = nh->nh_oif, in fib_check_nh()
633 nh->nh_scope = res.scope; in fib_check_nh()
634 nh->nh_oif = FIB_RES_OIF(res); in fib_check_nh()
635 nh->nh_dev = dev = FIB_RES_DEV(res); in fib_check_nh()
643 if (nh->nh_flags & (RTNH_F_PERVASIVE | RTNH_F_ONLINK)) in fib_check_nh()
648 in_dev = inetdev_by_index(net, nh->nh_oif); in fib_check_nh()
654 nh->nh_dev = in_dev->dev; in fib_check_nh()
655 dev_hold(nh->nh_dev); in fib_check_nh()
656 nh->nh_scope = RT_SCOPE_HOST; in fib_check_nh()
750 __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh) in fib_info_update_nh_saddr() argument
752 nh->nh_saddr = inet_select_addr(nh->nh_dev, in fib_info_update_nh_saddr()
753 nh->nh_gw, in fib_info_update_nh_saddr()
754 nh->nh_parent->fib_scope); in fib_info_update_nh_saddr()
755 nh->nh_saddr_genid = atomic_read(&net->ipv4.dev_addr_genid); in fib_info_update_nh_saddr()
757 return nh->nh_saddr; in fib_info_update_nh_saddr()
880 struct fib_nh *nh = fi->fib_nh; in fib_create_info() local
882 nh->nh_oif = cfg->fc_oif; in fib_create_info()
883 nh->nh_gw = cfg->fc_gw; in fib_create_info()
884 nh->nh_flags = cfg->fc_flags; in fib_create_info()
886 nh->nh_tclassid = cfg->fc_flow; in fib_create_info()
887 if (nh->nh_tclassid) in fib_create_info()
891 nh->nh_weight = 1; in fib_create_info()
916 struct fib_nh *nh = fi->fib_nh; in fib_create_info() local
919 if (nhs != 1 || nh->nh_gw) in fib_create_info()
921 nh->nh_scope = RT_SCOPE_NOWHERE; in fib_create_info()
922 nh->nh_dev = dev_get_by_index(net, fi->fib_nh->nh_oif); in fib_create_info()
924 if (!nh->nh_dev) in fib_create_info()
1056 rtnh->rtnh_flags = nh->nh_flags & 0xFF; in fib_dump_info()
1057 rtnh->rtnh_hops = nh->nh_weight - 1; in fib_dump_info()
1058 rtnh->rtnh_ifindex = nh->nh_oif; in fib_dump_info()
1060 if (nh->nh_gw && in fib_dump_info()
1061 nla_put_in_addr(skb, RTA_GATEWAY, nh->nh_gw)) in fib_dump_info()
1064 if (nh->nh_tclassid && in fib_dump_info()
1065 nla_put_u32(skb, RTA_FLOW, nh->nh_tclassid)) in fib_dump_info()
1117 struct fib_nh *nh; in fib_sync_down_dev() local
1122 hlist_for_each_entry(nh, head, nh_hash) { in fib_sync_down_dev()
1123 struct fib_info *fi = nh->nh_parent; in fib_sync_down_dev()
1127 if (nh->nh_dev != dev || fi == prev_fi) in fib_sync_down_dev()
1228 struct fib_nh *nh; in fib_sync_up() local
1239 hlist_for_each_entry(nh, head, nh_hash) { in fib_sync_up()
1240 struct fib_info *fi = nh->nh_parent; in fib_sync_up()
1244 if (nh->nh_dev != dev || fi == prev_fi) in fib_sync_up()