Changeset View
Changeset View
Standalone View
Standalone View
sys/netlink/netlink_snl_route_parsers.h
| Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | _cb_p_mp_nh(struct snl_state *ss __unused, void *_target) | ||||
| return (true); | return (true); | ||||
| } | } | ||||
| #undef _IN | #undef _IN | ||||
| #undef _OUT | #undef _OUT | ||||
| SNL_DECLARE_PARSER_EXT(_mpath_nh_parser, sizeof(struct rtnexthop), | SNL_DECLARE_PARSER_EXT(_mpath_nh_parser, sizeof(struct rtnexthop), | ||||
| sizeof(struct rta_mpath_nh), _fp_p_mp_nh, _nla_p_mp_nh, | sizeof(struct rta_mpath_nh), _fp_p_mp_nh, _nla_p_mp_nh, | ||||
| _cb_p_mp_nh); | _cb_p_mp_nh); | ||||
| struct rta_mpath { | |||||
| uint32_t num_nhops; | |||||
| struct rta_mpath_nh **nhops; | |||||
| }; | |||||
| static bool | static bool | ||||
| nlattr_get_multipath(struct snl_state *ss, struct nlattr *nla, | nlattr_get_multipath(struct snl_state *ss, struct nlattr *nla, | ||||
| const void *arg __unused, void *target) | const void *arg __unused, void *target) | ||||
| { | { | ||||
| struct snl_parray *mpath = target; | |||||
| uint32_t start_size = 4; | uint32_t start_size = 4; | ||||
| while (start_size < NLA_DATA_LEN(nla) / sizeof(struct rtnexthop)) | while (start_size < NLA_DATA_LEN(nla) / sizeof(struct rtnexthop)) | ||||
| start_size *= 2; | start_size *= 2; | ||||
| return (snl_attr_get_parray_sz(ss, nla, start_size, &_mpath_nh_parser, target)); | return (snl_attr_get_parray_sz(ss, nla, start_size, | ||||
| &_mpath_nh_parser, mpath)); | |||||
| } | } | ||||
| struct snl_parsed_route { | struct snl_parsed_route { | ||||
| struct sockaddr *rta_dst; | struct sockaddr *rta_dst; | ||||
| struct sockaddr *rta_gw; | struct sockaddr *rta_gw; | ||||
| struct sockaddr *rta_pref_src; | struct sockaddr *rta_pref_src; | ||||
| struct nlattr *rta_metrics; | struct nlattr *rta_metrics; | ||||
| struct rta_mpath rta_multipath; | struct snl_parray rta_multipath; | ||||
| uint32_t rta_oif; | uint32_t rta_oif; | ||||
| uint32_t rta_expire; | uint32_t rta_expire; | ||||
| uint32_t rta_table; | uint32_t rta_table; | ||||
| uint32_t rta_knh_id; | uint32_t rta_knh_id; | ||||
| uint32_t rta_nh_id; | uint32_t rta_nh_id; | ||||
| uint32_t rta_rtflags; | uint32_t rta_rtflags; | ||||
| uint32_t rtax_mtu; | uint32_t rtax_mtu; | ||||
| uint32_t rtax_weight; | uint32_t rtax_weight; | ||||
| ▲ Show 20 Lines • Show All 273 Lines • Show Last 20 Lines | |||||