From e56a786b7336428075c6db552655f9e7596a3af9 Mon Sep 17 00:00:00 2001 From: Hongjun Ni Date: Tue, 4 Jun 2019 18:58:58 +0800 Subject: lb: crashed with some specific commit under heavy traffic - When deleting VIP member with flush, VPP will crash. - When deleting VIP member without flush, vpp won't crash. - This crash is almost 100% reproductive. Ticket: VPP-1680 Type: fix Change-Id: Ia4e8f9e0f987176c7f6ec52c92e66563f313b0c3 Signed-off-by: Hongjun Ni --- src/plugins/lb/lb.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/plugins/lb/lb.c') diff --git a/src/plugins/lb/lb.c b/src/plugins/lb/lb.c index a75f6761c0e..75ca40f5f00 100644 --- a/src/plugins/lb/lb.c +++ b/src/plugins/lb/lb.c @@ -442,7 +442,7 @@ out: //Let's create a new flow table vec_validate(new_flow_table, vip->new_flow_table_mask); for (i=0; ilast; pr->last = (pr->last + pr->skip) & vip->new_flow_table_mask; - if (new_flow_table[last].as_index == ~0) { + if (new_flow_table[last].as_index == 0) { new_flow_table[last].as_index = pr->as_index; break; } @@ -773,7 +773,7 @@ lb_flush_vip_as (u32 vip_index, u32 as_index) vlib_refcount_add(&lbm->as_refcount, thread_index, b->value[i], -1); vlib_refcount_add(&lbm->as_refcount, thread_index, 0, 1); b->vip[i] = ~0; - b->value[i] = ~0; + b->value[i] = 0; } } if (vip_index == ~0) @@ -1375,6 +1375,7 @@ lb_init (vlib_main_t * vm) //Allocate and init default VIP. lbm->vips = 0; pool_get(lbm->vips, default_vip); + default_vip->new_flow_table_mask = 0; default_vip->prefix.ip6.as_u64[0] = 0xffffffffffffffffL; default_vip->prefix.ip6.as_u64[1] = 0xffffffffffffffffL; default_vip->protocol = ~0; @@ -1418,6 +1419,12 @@ lb_init (vlib_main_t * vm) default_as->address.ip6.as_u64[0] = 0xffffffffffffffffL; default_as->address.ip6.as_u64[1] = 0xffffffffffffffffL; + /* Generate a valid flow table for default VIP */ + default_vip->as_indexes = NULL; + lb_get_writer_lock(); + lb_vip_update_new_flow_table(default_vip); + lb_put_writer_lock(); + lbm->vip_index_by_nodeport = hash_create_mem (0, sizeof(u16), sizeof (uword)); -- cgit 1.2.3-korg