Before this change the struct route_data rtm_dst_len element was stored as a value that could be fed directly into ipv6_create_mask.
As we prepare for external consumption of this structure this comes across as unexpected, as anyone interacting with this code would expect the element to behave like the well known kernel rtmsg UAPI. Delay conversion of IPv4 prefix length until passing this value to ovs_router_insert(). Suggested-by: Felix Huettner <[email protected]> Signed-off-by: Frode Nordahl <[email protected]> Acked-by: Eelco Chaudron <[email protected]> --- lib/route-table.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/route-table.c b/lib/route-table.c index 3539ac11f..ca56a2f82 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -345,7 +345,7 @@ route_table_parse__(struct ofpbuf *buf, size_t ofs, } change->nlmsg_type = nlmsg->nlmsg_type; - change->rd.rtm_dst_len = rtm->rtm_dst_len + (ipv4 ? 96 : 0); + change->rd.rtm_dst_len = rtm->rtm_dst_len; change->rd.rtm_protocol = rtm->rtm_protocol; change->rd.local = rtm->rtm_type == RTN_LOCAL; if (attrs[RTA_OIF]) { @@ -516,7 +516,9 @@ route_table_handle_msg(const struct route_table_msg *change, rdnh = CONTAINER_OF(ovs_list_front(&change->rd.nexthops), const struct route_data_nexthop, nexthop_node); - ovs_router_insert(rd->mark, &rd->rta_dst, rd->rtm_dst_len, + ovs_router_insert(rd->mark, &rd->rta_dst, + IN6_IS_ADDR_V4MAPPED(&rd->rta_dst) + ? rd->rtm_dst_len + 96 : rd->rtm_dst_len, rd->local, rdnh->ifname, &rdnh->addr, &rd->rta_prefsrc); } -- 2.47.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
