aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lb
diff options
context:
space:
mode:
authorYulong Pei <yulong.pei@intel.com>2019-08-23 17:24:13 +0800
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-09-25 06:48:00 +0000
commit7cd964ee45e845e0f02d9dbcecc3c1cc9088e447 (patch)
tree27aeba75f9087c4fe341402b74de11e16f3ea2ea /src/plugins/lb
parent54ff3fc834b9e97b77313501437260699e617e7c (diff)
lb: fix memcpy error issue
vl_api_prefix_t size is 21 byte, ip46_address_t size is 16 byte, only copy 16 byte of vl_api_prefix_t to ip46_address_t is not correct. Type:fix Change-Id: I35ede7836a0c878d39388b29b15d91bb08f87a07 Signed-off-by: Yulong Pei <yulong.pei@intel.com> (cherry picked from commit 71f36067ca923fa4eb10060d6f6878f5fa864673)
Diffstat (limited to 'src/plugins/lb')
-rw-r--r--src/plugins/lb/api.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/plugins/lb/api.c b/src/plugins/lb/api.c
index 86e2ce08ed7..53541799f49 100644
--- a/src/plugins/lb/api.c
+++ b/src/plugins/lb/api.c
@@ -120,7 +120,7 @@ vl_api_lb_add_del_vip_t_handler
mp->protocol = ~0;
}
- memcpy (&(args.prefix), &mp->pfx, sizeof(args.prefix));
+ ip_address_decode (&mp->pfx.address, &(args.prefix));
if (mp->is_del) {
u32 vip_index;
@@ -210,14 +210,10 @@ vl_api_lb_add_del_as_t_handler
int rv = 0;
u32 vip_index;
ip46_address_t vip_ip_prefix;
-
- memcpy(&vip_ip_prefix, &mp->pfx,
- sizeof(vip_ip_prefix));
-
ip46_address_t as_address;
- memcpy(&as_address, &mp->as_address,
- sizeof(as_address));
+ ip_address_decode (&mp->pfx.address, &vip_ip_prefix);
+ ip_address_decode (&mp->as_address, &as_address);
if ((rv = lb_vip_find_index(&vip_ip_prefix, mp->pfx.len,
mp->protocol, ntohs(mp->port), &vip_index)))