Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/netstat/route_netlink.c
| Show First 20 Lines • Show All 229 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| struct snl_parsed_route rt = {}; | struct snl_parsed_route rt = {}; | ||||
| if (!snl_parse_nlmsg(ss, hdr, &snl_rtm_route_parser, &rt)) | if (!snl_parse_nlmsg(ss, hdr, &snl_rtm_route_parser, &rt)) | ||||
| return; | return; | ||||
| if (rt.rtax_weight == 0) | if (rt.rtax_weight == 0) | ||||
| rt.rtax_weight = rt_default_weight; | rt.rtax_weight = rt_default_weight; | ||||
| if (rt.rta_multipath.num_nhops != 0) { | if (rt.rta_multipath.count != 0) { | ||||
| uint32_t orig_rtflags = rt.rta_rtflags; | uint32_t orig_rtflags = rt.rta_rtflags; | ||||
| uint32_t orig_mtu = rt.rtax_mtu; | uint32_t orig_mtu = rt.rtax_mtu; | ||||
| for (uint32_t i = 0; i < rt.rta_multipath.num_nhops; i++) { | for (uint32_t i = 0; i < rt.rta_multipath.count; i++) { | ||||
| struct rta_mpath_nh *nhop = rt.rta_multipath.nhops[i]; | struct rta_mpath_nh *nhop = | ||||
| rt.rta_multipath.items[i]; | |||||
| rt.rta_gw = nhop->gw; | rt.rta_gw = nhop->gw; | ||||
| rt.rta_oif = nhop->ifindex; | rt.rta_oif = nhop->ifindex; | ||||
| rt.rtax_weight = nhop->rtnh_weight; | rt.rtax_weight = nhop->rtnh_weight; | ||||
| rt.rta_metric = nhop->rta_metric; | rt.rta_metric = nhop->rta_metric; | ||||
| rt.rta_rtflags = nhop->rta_rtflags ? nhop->rta_rtflags : orig_rtflags; | rt.rta_rtflags = nhop->rta_rtflags ? nhop->rta_rtflags : orig_rtflags; | ||||
| rt.rtax_mtu = nhop->rtax_mtu ? nhop->rtax_mtu : orig_mtu; | rt.rtax_mtu = nhop->rtax_mtu ? nhop->rtax_mtu : orig_mtu; | ||||
| rt.rta_expire = nhop->rta_expire; | rt.rta_expire = nhop->rta_expire; | ||||
| ▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | if (need_table_close) { | ||||
| xo_close_instance("rt-family"); | xo_close_instance("rt-family"); | ||||
| } | } | ||||
| xo_close_list("rt-family"); | xo_close_list("rt-family"); | ||||
| xo_close_container("route-table"); | xo_close_container("route-table"); | ||||
| snl_free(&ss); | snl_free(&ss); | ||||
| return (true); | return (true); | ||||
| } | } | ||||