diff options
author | 2019-10-23 08:35:43 -0700 | |
---|---|---|
committer | 2019-10-23 08:36:41 -0700 | |
commit | 9ad27550b54ee65648487b6405bb61925ccd3397 (patch) | |
tree | fd6b31ed47094bcff7a32fbdfdeb79378bf10662 /src/vnet/bonding | |
parent | 66b1689cfa1cd53d1c24fa68cffef6d507b866f9 (diff) |
lacp: add actor steady state check prior to skip processing lacp pdu
In a rare event, we may be skipping processing lacp pdu's when the it is
not in steady state.
Type: fix
Signed-off-by: Steven Luong <sluong@cisco.com>
Change-Id: I0872c49e10bbd3538398030a2aa0fa4c3b7e9426
Diffstat (limited to 'src/vnet/bonding')
-rw-r--r-- | src/vnet/bonding/cli.c | 31 | ||||
-rw-r--r-- | src/vnet/bonding/node.h | 3 |
2 files changed, 18 insertions, 16 deletions
diff --git a/src/vnet/bonding/cli.c b/src/vnet/bonding/cli.c index bccbb2c036e..80470d64383 100644 --- a/src/vnet/bonding/cli.c +++ b/src/vnet/bonding/cli.c @@ -42,7 +42,6 @@ bond_disable_collecting_distributing (vlib_main_t * vm, slave_if_t * sif) switching_active = 1; vec_del1 (bif->active_slaves, i); - hash_unset (bif->active_slave_by_sw_if_index, sif->sw_if_index); /* We got a new slave just becoming active? */ if ((vec_len (bif->active_slaves) >= 1) && @@ -60,21 +59,27 @@ bond_enable_collecting_distributing (vlib_main_t * vm, slave_if_t * sif) { bond_if_t *bif; bond_main_t *bm = &bond_main; + int i; + uword p; bif = bond_get_master_by_dev_instance (sif->bif_dev_instance); clib_spinlock_lock_if_init (&bif->lockp); - if (!hash_get (bif->active_slave_by_sw_if_index, sif->sw_if_index)) - { - hash_set (bif->active_slave_by_sw_if_index, sif->sw_if_index, - sif->sw_if_index); - vec_add1 (bif->active_slaves, sif->sw_if_index); - - /* First slave becomes active? */ - if ((vec_len (bif->active_slaves) == 1) && - (bif->mode == BOND_MODE_ACTIVE_BACKUP)) - vlib_process_signal_event (bm->vlib_main, bond_process_node.index, - BOND_SEND_GARP_NA, bif->hw_if_index); - } + vec_foreach_index (i, bif->active_slaves) + { + p = *vec_elt_at_index (bif->active_slaves, i); + if (p == sif->sw_if_index) + goto done; + } + + vec_add1 (bif->active_slaves, sif->sw_if_index); + + /* First slave becomes active? */ + if ((vec_len (bif->active_slaves) == 1) && + (bif->mode == BOND_MODE_ACTIVE_BACKUP)) + vlib_process_signal_event (bm->vlib_main, bond_process_node.index, + BOND_SEND_GARP_NA, bif->hw_if_index); + +done: clib_spinlock_unlock_if_init (&bif->lockp); } diff --git a/src/vnet/bonding/node.h b/src/vnet/bonding/node.h index 41e945a05f8..377e57996ed 100644 --- a/src/vnet/bonding/node.h +++ b/src/vnet/bonding/node.h @@ -175,9 +175,6 @@ typedef struct /* Slaves that are in DISTRIBUTING state */ u32 *active_slaves; - /* rapidly find an active slave */ - uword *active_slave_by_sw_if_index; - lacp_port_info_t partner; lacp_port_info_t actor; u8 individual_aggregator; |