lb: lb_add_del_vip and lb_add_del_as doesn't work.

Ticket: FDIO-753
Type: fix

Change-Id: I4a8cf06970b658dfa15768459a3ff76571d6dfff
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
(cherry picked from commit e69f4714323e1f7e7754fef58a2d75949e146317)
This commit is contained in:
Hongjun Ni
2019-11-26 19:36:17 +08:00
committed by Andrew Yourtchenko
parent f540ca8016
commit 5ec78926b6
2 changed files with 14 additions and 4 deletions

View File

@ -120,7 +120,7 @@ vl_api_lb_add_del_vip_t_handler
mp->protocol = ~0; mp->protocol = ~0;
} }
ip_address_decode (&mp->pfx.address, &(args.prefix)); memcpy (&(args.prefix.ip6), &mp->pfx.address.un.ip6, sizeof(args.prefix.ip6));
if (mp->is_del) { if (mp->is_del) {
u32 vip_index; u32 vip_index;
@ -210,10 +210,20 @@ vl_api_lb_add_del_as_t_handler
int rv = 0; int rv = 0;
u32 vip_index; u32 vip_index;
ip46_address_t vip_ip_prefix; ip46_address_t vip_ip_prefix;
/* if port == 0, it means all-port VIP */
if (mp->port == 0)
{
mp->protocol = ~0;
}
memcpy(&vip_ip_prefix.ip6, &mp->pfx.address.un.ip6,
sizeof(vip_ip_prefix.ip6));
ip46_address_t as_address; ip46_address_t as_address;
ip_address_decode (&mp->pfx.address, &vip_ip_prefix); memcpy(&as_address.ip6, &mp->as_address.un.ip6,
ip_address_decode (&mp->as_address, &as_address); sizeof(as_address.ip6));
if ((rv = lb_vip_find_index(&vip_ip_prefix, mp->pfx.len, if ((rv = lb_vip_find_index(&vip_ip_prefix, mp->pfx.len,
mp->protocol, ntohs(mp->port), &vip_index))) mp->protocol, ntohs(mp->port), &vip_index)))

View File

@ -326,7 +326,7 @@ static int api_lb_add_del_as (vat_main_t * vam)
mp->pfx.len = vip_plen; mp->pfx.len = vip_plen;
mp->protocol = (u8)protocol; mp->protocol = (u8)protocol;
mp->port = htons((u16)port); mp->port = htons((u16)port);
clib_memcpy (&mp->as_address, &as_addr, sizeof (as_addr)); clib_memcpy (&mp->as_address.un.ip6, &as_addr.ip6, sizeof (as_addr.ip6));
mp->is_del = is_del; mp->is_del = is_del;
mp->is_flush = is_flush; mp->is_flush = is_flush;