summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHongjun Ni <hongjun.ni@intel.com>2019-01-21 18:07:11 +0800
committerDamjan Marion <dmarion@me.com>2019-01-21 15:49:53 +0000
commit628aad38f89413d6d6cb5def0ee08af956aa897a (patch)
tree62107e051f7f8a9a5f2158b3c5c41fc63a789ee3
parent8254ab87f2b975c4c3324dc9ac08b7f7b6c167ee (diff)
Fix LB lookup table failed issue
Change-Id: Icd21f456089c72c91a8328f963bf47a8c7725195 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
-rw-r--r--src/plugins/lb/lb.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/plugins/lb/lb.c b/src/plugins/lb/lb.c
index 53264339811..fe7e5450512 100644
--- a/src/plugins/lb/lb.c
+++ b/src/plugins/lb/lb.c
@@ -984,10 +984,15 @@ static int lb_vip_del_port_filter(lb_main_t *lbm, lb_vip_t *vip)
key.vip_prefix_index = vip->vip_prefix_index;
key.protocol = vip->protocol;
key.port = clib_host_to_net_u16(vip->port);
+ key.rsv = 0;
kv.key = key.as_u64;
- if(clib_bihash_search_8_8(&lbm->vip_index_per_port, &kv, &value) == 0)
- m = pool_elt_at_index (lbm->vips, value.value);
+ if(clib_bihash_search_8_8(&lbm->vip_index_per_port, &kv, &value) != 0)
+ {
+ clib_warning("looking up vip_index_per_port failed.");
+ return VNET_API_ERROR_NO_SUCH_ENTRY;
+ }
+ m = pool_elt_at_index (lbm->vips, value.value);
ASSERT (m);
kv.value = m - lbm->vips;
@@ -1190,10 +1195,11 @@ int lb_vip_del(u32 vip_index)
{
lb_main_t *lbm = &lb_main;
lb_vip_t *vip;
+ int rv = 0;
/* Does not remove default vip, i.e. vip_index = 0 */
if (vip_index == 0)
- return 0;
+ return VNET_API_ERROR_INVALID_VALUE;
lb_get_writer_lock();
if (!(vip = lb_vip_get_by_index(vip_index))) {
@@ -1225,14 +1231,14 @@ int lb_vip_del(u32 vip_index)
//Delete per-port vip filtering entry
if (vip->port != 0)
{
- lb_vip_del_port_filter(lbm, vip);
+ rv = lb_vip_del_port_filter(lbm, vip);
}
//Set the VIP as unused
vip->flags &= ~LB_VIP_FLAGS_USED;
lb_put_writer_lock();
- return 0;
+ return rv;
}
/* *INDENT-OFF* */