Lines Matching refs:nh

53 #define for_nexthops(fi) { int nhsel; const struct dn_fib_nh *nh;\
54 for(nhsel = 0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++)
56 #define change_nexthops(fi) { int nhsel; struct dn_fib_nh *nh;\
57 for(nhsel = 0, nh = (struct dn_fib_nh *)((fi)->fib_nh); nhsel < (fi)->fib_nhs; nh++, nhsel++)
95 dev_put(nh->nh_dev); in dn_fib_free_info()
96 nh->nh_dev = NULL; in dn_fib_free_info()
122 if (nh->nh_oif != onh->nh_oif || in dn_fib_nh_comp()
123 nh->nh_gw != onh->nh_gw || in dn_fib_nh_comp()
124 nh->nh_scope != onh->nh_scope || in dn_fib_nh_comp()
125 nh->nh_weight != onh->nh_weight || in dn_fib_nh_comp()
126 ((nh->nh_flags^onh->nh_flags)&~RTNH_F_DEAD)) in dn_fib_nh_comp()
175 nh->nh_flags = (r->rtm_flags&~0xFF) | nhp->rtnh_flags; in dn_fib_get_nhs()
176 nh->nh_oif = nhp->rtnh_ifindex; in dn_fib_get_nhs()
177 nh->nh_weight = nhp->rtnh_hops + 1; in dn_fib_get_nhs()
184 nh->nh_gw = gw_attr ? nla_get_le16(gw_attr) : 0; in dn_fib_get_nhs()
194 static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct dn_fib_nh *nh) in dn_fib_check_nh() argument
198 if (nh->nh_gw) { in dn_fib_check_nh()
202 if (nh->nh_flags&RTNH_F_ONLINK) { in dn_fib_check_nh()
207 if (dnet_addr_type(nh->nh_gw) != RTN_UNICAST) in dn_fib_check_nh()
209 if ((dev = __dev_get_by_index(&init_net, nh->nh_oif)) == NULL) in dn_fib_check_nh()
213 nh->nh_dev = dev; in dn_fib_check_nh()
215 nh->nh_scope = RT_SCOPE_LINK; in dn_fib_check_nh()
220 fld.daddr = nh->nh_gw; in dn_fib_check_nh()
221 fld.flowidn_oif = nh->nh_oif; in dn_fib_check_nh()
233 nh->nh_scope = res.scope; in dn_fib_check_nh()
234 nh->nh_oif = DN_FIB_RES_OIF(res); in dn_fib_check_nh()
235 nh->nh_dev = DN_FIB_RES_DEV(res); in dn_fib_check_nh()
236 if (nh->nh_dev == NULL) in dn_fib_check_nh()
238 dev_hold(nh->nh_dev); in dn_fib_check_nh()
240 if (!(nh->nh_dev->flags & IFF_UP)) in dn_fib_check_nh()
249 if (nh->nh_flags&(RTNH_F_PERVASIVE|RTNH_F_ONLINK)) in dn_fib_check_nh()
252 dev = __dev_get_by_index(&init_net, nh->nh_oif); in dn_fib_check_nh()
257 nh->nh_dev = dev; in dn_fib_check_nh()
258 dev_hold(nh->nh_dev); in dn_fib_check_nh()
259 nh->nh_scope = RT_SCOPE_HOST; in dn_fib_check_nh()
328 struct dn_fib_nh *nh = fi->fib_nh; in dn_fib_create_info() local
331 nh->nh_oif = nla_get_u32(attrs[RTA_OIF]); in dn_fib_create_info()
334 nh->nh_gw = nla_get_le16(attrs[RTA_GATEWAY]); in dn_fib_create_info()
336 nh->nh_flags = r->rtm_flags; in dn_fib_create_info()
337 nh->nh_weight = 1; in dn_fib_create_info()
359 struct dn_fib_nh *nh = fi->fib_nh; in dn_fib_create_info() local
362 if (nhs != 1 || nh->nh_gw) in dn_fib_create_info()
364 nh->nh_scope = RT_SCOPE_NOWHERE; in dn_fib_create_info()
365 nh->nh_dev = dev_get_by_index(&init_net, fi->fib_nh->nh_oif); in dn_fib_create_info()
367 if (nh->nh_dev == NULL) in dn_fib_create_info()
371 if ((err = dn_fib_check_nh(r, fi, nh)) != 0) in dn_fib_create_info()
433 if (nh->nh_flags & RTNH_F_DEAD) in dn_fib_semantic_match()
436 fld->flowidn_oif == nh->nh_oif) in dn_fib_semantic_match()
466 if (!(nh->nh_flags&RTNH_F_DEAD)) { in dn_fib_select_multipath()
467 power += nh->nh_weight; in dn_fib_select_multipath()
468 nh->nh_power = nh->nh_weight; in dn_fib_select_multipath()
482 if (!(nh->nh_flags&RTNH_F_DEAD) && nh->nh_power) { in dn_fib_select_multipath()
483 if ((w -= nh->nh_power) <= 0) { in dn_fib_select_multipath()
484 nh->nh_power--; in dn_fib_select_multipath()
718 if (nh->nh_flags&RTNH_F_DEAD) in dn_fib_sync_down()
720 else if (nh->nh_dev == dev && in dn_fib_sync_down()
721 nh->nh_scope != scope) { in dn_fib_sync_down()
723 nh->nh_flags |= RTNH_F_DEAD; in dn_fib_sync_down()
724 fi->fib_power -= nh->nh_power; in dn_fib_sync_down()
725 nh->nh_power = 0; in dn_fib_sync_down()
751 if (!(nh->nh_flags&RTNH_F_DEAD)) { in dn_fib_sync_up()
755 if (nh->nh_dev == NULL || !(nh->nh_dev->flags&IFF_UP)) in dn_fib_sync_up()
757 if (nh->nh_dev != dev || dev->dn_ptr == NULL) in dn_fib_sync_up()
761 nh->nh_power = 0; in dn_fib_sync_up()
762 nh->nh_flags &= ~RTNH_F_DEAD; in dn_fib_sync_up()