summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/devices/af_packet/af_packet.c3
-rw-r--r--src/vnet/devices/af_packet/cli.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index d0a241e2a2e..eec3e4bc8ae 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -416,6 +416,9 @@ af_packet_set_l4_cksum_offload (vlib_main_t * vm, u32 sw_if_index, u8 set)
hw = vnet_get_sup_hw_interface (vnm, sw_if_index);
+ if (hw->dev_class_index != af_packet_device_class.index)
+ return VNET_API_ERROR_INVALID_INTERFACE;
+
if (set)
hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
else
diff --git a/src/vnet/devices/af_packet/cli.c b/src/vnet/devices/af_packet/cli.c
index 29c0e060a91..faa07287418 100644
--- a/src/vnet/devices/af_packet/cli.c
+++ b/src/vnet/devices/af_packet/cli.c
@@ -225,7 +225,8 @@ af_packet_set_l4_cksum_offload_command_fn (vlib_main_t * vm,
}
}
- af_packet_set_l4_cksum_offload (vm, sw_if_index, set);
+ if (af_packet_set_l4_cksum_offload (vm, sw_if_index, set) < 0)
+ error = clib_error_return (0, "not an af_packet interface");
done:
unformat_free (line_input);