diff --git a/switchlink/sai/switchlink_handle_neigh.c b/switchlink/sai/switchlink_handle_neigh.c index d8acf7b..881595e 100644 --- a/switchlink/sai/switchlink_handle_neigh.c +++ b/switchlink/sai/switchlink_handle_neigh.c @@ -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); diff --git a/switchlink/switchlink_route.c b/switchlink/switchlink_route.c index 948618d..4fdaa1d 100644 --- a/switchlink/switchlink_route.c +++ b/switchlink/switchlink_route.c @@ -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; }