Skip to content

Commit 80cebed

Browse files
idoschdavem330
authored andcommitted
drop_monitor: Consider all monitoring states before performing configuration
The drop monitor configuration (e.g., alert mode) is global, but user will be able to enable monitoring of only software or hardware drops. Therefore, ensure that monitoring of both software and hardware drops are disabled before allowing drop monitor configuration to take place. Signed-off-by: Ido Schimmel <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent edd3d00 commit 80cebed

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

net/core/drop_monitor.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,11 @@ static int set_all_monitor_traces(int state, struct netlink_ext_ack *extack)
633633
return rc;
634634
}
635635

636+
static bool net_dm_is_monitoring(void)
637+
{
638+
return trace_state == TRACE_ON || monitor_hw;
639+
}
640+
636641
static int net_dm_alert_mode_get_from_info(struct genl_info *info,
637642
enum net_dm_alert_mode *p_alert_mode)
638643
{
@@ -694,8 +699,8 @@ static int net_dm_cmd_config(struct sk_buff *skb,
694699
struct netlink_ext_ack *extack = info->extack;
695700
int rc;
696701

697-
if (trace_state == TRACE_ON) {
698-
NL_SET_ERR_MSG_MOD(extack, "Cannot configure drop monitor while tracing is on");
702+
if (net_dm_is_monitoring()) {
703+
NL_SET_ERR_MSG_MOD(extack, "Cannot configure drop monitor during monitoring");
699704
return -EBUSY;
700705
}
701706

0 commit comments

Comments
 (0)