Skip to content

Commit

Permalink
route-table: Store orignal value for rtm_dst_len.
Browse files Browse the repository at this point in the history
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]>
Signed-off-by: 0-day Robot <[email protected]>
  • Loading branch information
fnordahl authored and ovsrobot committed Dec 18, 2024
1 parent 851e3a9 commit b6b8201
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/route-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,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]) {
Expand Down Expand Up @@ -511,7 +511,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);
}
Expand Down

0 comments on commit b6b8201

Please sign in to comment.