Changeset View
Changeset View
Standalone View
Standalone View
sys/netlink/route/rt.c
Show First 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | if (off == 0) | ||||
return; | return; | ||||
for (int i = 0; i < num_nhops; i++) { | for (int i = 0; i < num_nhops; i++) { | ||||
int nh_off = nlattr_save_offset(nw); | int nh_off = nlattr_save_offset(nw); | ||||
struct rtnexthop *rtnh = nlmsg_reserve_object(nw, struct rtnexthop); | struct rtnexthop *rtnh = nlmsg_reserve_object(nw, struct rtnexthop); | ||||
if (rtnh == NULL) | if (rtnh == NULL) | ||||
return; | return; | ||||
rtnh->rtnh_flags = 0; | rtnh->rtnh_flags = 0; | ||||
rtnh->rtnh_ifindex = wn[i].nh->nh_ifp->if_index; | rtnh->rtnh_ifindex = if_getindex(wn[i].nh->nh_ifp); | ||||
rtnh->rtnh_hops = wn[i].weight; | rtnh->rtnh_hops = wn[i].weight; | ||||
dump_rc_nhop_gw(nw, wn[i].nh); | dump_rc_nhop_gw(nw, wn[i].nh); | ||||
uint32_t rtflags = nhop_get_rtflags(wn[i].nh); | uint32_t rtflags = nhop_get_rtflags(wn[i].nh); | ||||
if (rtflags != base_rtflags) | if (rtflags != base_rtflags) | ||||
nlattr_add_u32(nw, NL_RTA_RTFLAGS, rtflags); | nlattr_add_u32(nw, NL_RTA_RTFLAGS, rtflags); | ||||
if (rtflags & RTF_FIXEDMTU) | if (rtflags & RTF_FIXEDMTU) | ||||
dump_rc_nhop_mtu(nw, wn[i].nh); | dump_rc_nhop_mtu(nw, wn[i].nh); | ||||
rtnh = nlattr_restore_offset(nw, nh_off, struct rtnexthop); | rtnh = nlattr_restore_offset(nw, nh_off, struct rtnexthop); | ||||
Show All 38 Lines | #endif | ||||
if (rtflags & RTF_FIXEDMTU) | if (rtflags & RTF_FIXEDMTU) | ||||
dump_rc_nhop_mtu(nw, nh); | dump_rc_nhop_mtu(nw, nh); | ||||
uint32_t nh_expire = nhop_get_expire(nh); | uint32_t nh_expire = nhop_get_expire(nh); | ||||
if (nh_expire > 0) | if (nh_expire > 0) | ||||
nlattr_add_u32(nw, NL_RTA_EXPIRES, nh_expire - time_uptime); | nlattr_add_u32(nw, NL_RTA_EXPIRES, nh_expire - time_uptime); | ||||
/* In any case, fill outgoing interface */ | /* In any case, fill outgoing interface */ | ||||
nlattr_add_u32(nw, NL_RTA_OIF, nh->nh_ifp->if_index); | nlattr_add_u32(nw, NL_RTA_OIF, if_getindex(nh->nh_ifp)); | ||||
if (rnd->rnd_weight != RT_DEFAULT_WEIGHT) | if (rnd->rnd_weight != RT_DEFAULT_WEIGHT) | ||||
nlattr_add_u32(nw, NL_RTA_WEIGHT, rnd->rnd_weight); | nlattr_add_u32(nw, NL_RTA_WEIGHT, rnd->rnd_weight); | ||||
} | } | ||||
/* | /* | ||||
* Dumps output from a rib command into an rtmsg | * Dumps output from a rib command into an rtmsg | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 850 Lines • Show Last 20 Lines |