Skip to content

Commit

Permalink
Fix IPv6 ECMP and l2_fwd_rx table population
Browse files Browse the repository at this point in the history
This code changes
- Fixes missing IPv6 details for nexthop, which fails ECMP traffic when a nexthop
  route is learned before nexthop neighbor.
- Fix missing l2_fwd_rx entry with these changes.
- Delete IPv6 neighbor during cleanup

Signed-off-by: Sandeep N <[email protected]>
  • Loading branch information
n-sandeep committed Jan 11, 2024
1 parent 91c6767 commit fde83bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 17 additions & 3 deletions switchlink/sai/switchlink_handle_neigh.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,23 @@ static int delete_neighbor(const switchlink_db_neigh_info_t* neigh_info) {
sai_neighbor_entry_t neighbor_entry;
memset(&neighbor_entry, 0, sizeof(neighbor_entry));
neighbor_entry.rif_id = neigh_info->intf_h;
neighbor_entry.ip_address.addr_family = SAI_IP_ADDR_FAMILY_IPV4;
neighbor_entry.ip_address.addr.ip4 =
htonl(neigh_info->ip_addr.ip.v4addr.s_addr);

if (neigh_info->ip_addr.family == AF_INET) {
neighbor_entry.ip_address.addr_family = SAI_IP_ADDR_FAMILY_IPV4;
neighbor_entry.ip_address.addr.ip4 =
htonl(neigh_info->ip_addr.ip.v4addr.s_addr);
krnlmon_log_info("Delete a neighbor entry: 0x%x",
neigh_info->ip_addr.ip.v4addr.s_addr);
} else {
neighbor_entry.ip_address.addr_family = SAI_IP_ADDR_FAMILY_IPV6;
memcpy(neighbor_entry.ip_address.addr.ip6, &(neigh_info->ip_addr.ip.v6addr),
sizeof(sai_ip6_t));
krnlmon_log_info("Delete a neighbor entry: 0x%x:0x%x:0x%x:0x%x",
neigh_info->ip_addr.ip.v6addr.__in6_u.__u6_addr32[0],
neigh_info->ip_addr.ip.v6addr.__in6_u.__u6_addr32[1],
neigh_info->ip_addr.ip.v6addr.__in6_u.__u6_addr32[2],
neigh_info->ip_addr.ip.v6addr.__in6_u.__u6_addr32[3]);
}

status = sai_neigh_api->remove_neighbor_entry(&neighbor_entry);
return ((status == SAI_STATUS_SUCCESS) ? 0 : -1);
Expand Down
2 changes: 2 additions & 0 deletions switchlink/switchlink_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ static switchlink_handle_t process_ecmp(uint8_t family, struct nlattr* attr,
gateway.ip.v4addr.s_addr = ntohl(*((uint32_t*)RTA_DATA(rta)));
gateway.prefix_len = 32;
} else {
memcpy(&(gateway.ip.v6addr), (struct in6_addr *) RTA_DATA(rta),
sizeof(struct in6_addr));
gateway.prefix_len = 128;
}

Expand Down

0 comments on commit fde83bc

Please sign in to comment.