aboutsummaryrefslogtreecommitdiffstats
path: root/vnet/vnet/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'vnet/vnet/interface.c')
-rw-r--r--vnet/vnet/interface.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/vnet/vnet/interface.c b/vnet/vnet/interface.c
index 772c3bca75f..595ed1432bc 100644
--- a/vnet/vnet/interface.c
+++ b/vnet/vnet/interface.c
@@ -449,8 +449,16 @@ vnet_sw_interface_set_flags_helper (vnet_main_t * vnm, u32 sw_if_index,
mc_serialize (vm->mc_main, &vnet_sw_interface_set_flags_msg, &s);
}
- error = call_elf_section_interface_callbacks
- (vnm, sw_if_index, flags, vnm->sw_interface_admin_up_down_functions);
+ /* set the flags now before invoking the registered clients
+ * so that the state they query is consistent with the state here notified */
+ old_flags = si->flags;
+ si->flags &= ~mask;
+ si->flags |= flags;
+ if ((flags | old_flags) & VNET_SW_INTERFACE_FLAG_ADMIN_UP)
+ error = call_elf_section_interface_callbacks
+ (vnm, sw_if_index, flags,
+ vnm->sw_interface_admin_up_down_functions);
+ si->flags = old_flags;
if (error)
goto done;