aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2021-03-01 15:42:00 -0800
committerFlorin Coras <florin.coras@gmail.com>2021-03-03 05:25:03 +0000
commitc3ba58cd14d6bf1cc0cd4a5e6c439613c1ec3425 (patch)
tree23e6e6c0821057e036238ea29e243c41e39b0506 /src/plugins
parenta6406b962316a02e526899f743c6677943be18f2 (diff)
dhcp: calls to vnet_feature_enable_disable needs to be protected
dhcp is makeing calls to vnet_feature_enable_disable without barrier sync protection. This can cause data contention with the worker threads. Wrap all calls to vnet_feature_enable_disable with barrier sync and barrier release. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I74545b074599273429f47e3e726551156bc11bbc
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dhcp/client.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/dhcp/client.c b/src/plugins/dhcp/client.c
index e15b6cb69f8..e79cb694378 100644
--- a/src/plugins/dhcp/client.c
+++ b/src/plugins/dhcp/client.c
@@ -246,6 +246,7 @@ dhcp_client_addr_callback (u32 * cindex)
static void
dhcp_client_reset (dhcp_client_main_t * dcm, dhcp_client_t * c)
{
+ vlib_worker_thread_barrier_sync (dcm->vlib_main);
if (c->client_detect_feature_enabled == 1)
{
vnet_feature_enable_disable ("ip4-unicast",
@@ -253,8 +254,9 @@ dhcp_client_reset (dhcp_client_main_t * dcm, dhcp_client_t * c)
c->sw_if_index, 0, 0, 0);
c->client_detect_feature_enabled = 0;
}
-
dhcp_client_release_address (dcm, c);
+ vlib_worker_thread_barrier_release (dcm->vlib_main);
+
clib_memset (&c->learned, 0, sizeof (c->installed));
c->state = DHCP_DISCOVER;
c->next_transmit = vlib_time_now (dcm->vlib_main);
@@ -704,9 +706,11 @@ dhcp_discover_state (dhcp_client_main_t * dcm, dhcp_client_t * c, f64 now)
*/
if (c->client_detect_feature_enabled == 0)
{
+ vlib_worker_thread_barrier_sync (dcm->vlib_main);
vnet_feature_enable_disable ("ip4-unicast",
"ip4-dhcp-client-detect",
c->sw_if_index, 1 /* enable */ , 0, 0);
+ vlib_worker_thread_barrier_release (dcm->vlib_main);
c->client_detect_feature_enabled = 1;
}
@@ -754,9 +758,11 @@ dhcp_bound_state (dhcp_client_main_t * dcm, dhcp_client_t * c, f64 now)
*/
if (c->client_detect_feature_enabled == 0)
{
+ vlib_worker_thread_barrier_sync (dcm->vlib_main);
vnet_feature_enable_disable ("ip4-unicast",
"ip4-dhcp-client-detect",
c->sw_if_index, 1 /* enable */ , 0, 0);
+ vlib_worker_thread_barrier_release (dcm->vlib_main);
c->client_detect_feature_enabled = 1;
}