summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Smith <mgsmith@netgate.com>2021-10-04 15:19:44 -0500
committerNeale Ranns <neale@graphiant.com>2021-10-13 07:17:54 +0000
commitac4e61205dcf365396ca44941ad055c7bd88c631 (patch)
treefb46d814aefbdca434a2e86433f97668e9d8c9b5
parentb5dec932b78c662134bc3c93cc23a355918e1632 (diff)
interface: handle error during admin-up correctly
Type: fix In vnet_sw_interface_set_flags_helper(), the variable old_flags is set to the original value of vnet_sw_interface_t.flags for an interface. If an error occurs during the process of bringing an interface up, old_flags is used to restore the original value. Before the dev class or hw class admin_up_down_function can be called, but after modifying vnet_sw_interface_t.flags to it's new value, old_flags is set to the value of vnet_sw_interface_t.flags a second time. This discards the original flags that were being preserved. As a result, if an interface is being brought up and the dev class or hw class function fails, at the end VPP believes that interface is up. This can cause a crash if packets are routed through the interface and some RX/TX initialization was not completed because of the error while bringing the interface up. Change-Id: Ica6b6bac13c24e88c4136bf084cd392e6217e7d9 Signed-off-by: Matthew Smith <mgsmith@netgate.com>
-rw-r--r--src/vnet/interface.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/src/vnet/interface.c b/src/vnet/interface.c
index ad6d9ccfdb8..ab12da563a5 100644
--- a/src/vnet/interface.c
+++ b/src/vnet/interface.c
@@ -462,9 +462,6 @@ vnet_sw_interface_set_flags_helper (vnet_main_t * vnm, u32 sw_if_index,
goto done;
}
- /* save the si admin up flag */
- old_flags = si->flags;
-
/* update si admin up flag in advance if we are going admin down */
if (!(flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP))
si->flags &= ~VNET_SW_INTERFACE_FLAG_ADMIN_UP;