summaryrefslogtreecommitdiffstats
path: root/src/plugins/lb/lb_test.c
diff options
context:
space:
mode:
authorYulong Pei <yulong.pei@intel.com>2020-01-09 01:12:43 +0800
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-12 15:59:46 +0000
commit3311a17e40500263f9a77de8a91b0572fc68ea4c (patch)
tree9aba96d2f6ca966effef896b438f980a1f53a0b5 /src/plugins/lb/lb_test.c
parent4362672562f5b379361f147cbb7a9b72c3332c30 (diff)
lb: fix that lb_add_del_vip and lb_add_del_as api doesn't work correctly
Currently if user want to set ip4 address to the api, it must convert to ip6 format, e.g. user want to ip4 "90.1.2.1" but must convert to "::5A01:0201", it is not acceptable, this fix solved the issue. Ticket: FDIO-753 Type: fix Change-Id: I2ffa5a3d38400ee176cf601421074f71fc395f03 Signed-off-by: Yulong Pei <yulong.pei@intel.com> (cherry picked from commit db43bb6af78c33e47d29889b047cced4b11fe4d7)
Diffstat (limited to 'src/plugins/lb/lb_test.c')
-rw-r--r--src/plugins/lb/lb_test.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/lb/lb_test.c b/src/plugins/lb/lb_test.c
index f38a3f93844..188fa84fe2d 100644
--- a/src/plugins/lb/lb_test.c
+++ b/src/plugins/lb/lb_test.c
@@ -16,6 +16,7 @@
#include <vat/vat.h>
#include <vlibapi/api.h>
#include <vlibmemory/api.h>
+#include <vnet/ip/ip_types_api.h>
#include <vppinfra/error.h>
#include <lb/lb.h>
@@ -247,7 +248,7 @@ static int api_lb_add_del_vip (vat_main_t * vam)
}
M(LB_ADD_DEL_VIP, mp);
- clib_memcpy (mp->pfx.address.un.ip6, &ip_prefix.ip6, sizeof (ip_prefix.ip6));
+ ip_address_encode(&ip_prefix, IP46_TYPE_ANY, &mp->pfx.address);
mp->pfx.len = prefix_length;
mp->protocol = (u8)protocol;
mp->port = htons((u16)port);
@@ -322,11 +323,11 @@ static int api_lb_add_del_as (vat_main_t * vam)
}
M(LB_ADD_DEL_AS, mp);
- clib_memcpy (mp->pfx.address.un.ip6, &vip_prefix.ip6, sizeof (vip_prefix.ip6));
+ ip_address_encode(&vip_prefix, IP46_TYPE_ANY, &mp->pfx.address);
mp->pfx.len = vip_plen;
mp->protocol = (u8)protocol;
mp->port = htons((u16)port);
- clib_memcpy (&mp->as_address.un.ip6, &as_addr.ip6, sizeof (as_addr.ip6));
+ ip_address_encode(&as_addr, IP46_TYPE_ANY, &mp->as_address);
mp->is_del = is_del;
mp->is_flush = is_flush;