aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/memif/device.c')
-rw-r--r--src/plugins/memif/device.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c
index 446537a3792..899c78dc38f 100644
--- a/src/plugins/memif/device.c
+++ b/src/plugins/memif/device.c
@@ -272,9 +272,11 @@ static clib_error_t *
memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
memif_main_t *apm = &memif_main;
- memif_msg_t msg;
+ vlib_main_t *vm = vlib_get_main ();
+ memif_msg_t msg = { 0 };
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
memif_if_t *mif = pool_elt_at_index (apm->interfaces, hw->dev_instance);
+ static clib_error_t *error = 0;
if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP)
mif->flags |= MEMIF_IF_FLAG_ADMIN_UP;
@@ -286,11 +288,17 @@ memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
msg.version = MEMIF_VERSION;
msg.type = MEMIF_MSG_TYPE_DISCONNECT;
- send (mif->connection.fd, &msg, sizeof (msg), 0);
+ if (send (mif->connection.fd, &msg, sizeof (msg), 0) < 0)
+ {
+ clib_unix_warning ("Failed to send disconnect request");
+ error = clib_error_return_unix (0, "send fd %d",
+ mif->connection.fd);
+ memif_disconnect (vm, mif);
+ }
}
}
- return 0;
+ return error;
}
static clib_error_t *