[Devel] [PATCH 10/12] drop_monitor: Require CAP_NET_ADMIN for drop monitor configuration

Alexander Mikhalitsyn alexander.mikhalitsyn at virtuozzo.com
Mon Jul 4 21:52:00 MSK 2022


From: Ido Schimmel <idosch at mellanox.com>

Currently, the configure command does not do anything but return an
error. Subsequent patches will enable the command to change various
configuration options such as alert mode and packet truncation.

Similar to other netlink-based configuration channels, make sure only
users with the CAP_NET_ADMIN capability set can execute this command.

Signed-off-by: Ido Schimmel <idosch at mellanox.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit c5ab9b1c41f6d89d84fe147e51fe623f90bd026c)
---
 net/core/drop_monitor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index eaa1a0c7a028..309f52500408 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -399,6 +399,7 @@ static const struct genl_ops dropmon_ops[] = {
 	{
 		.cmd = NET_DM_CMD_CONFIG,
 		.doit = net_dm_cmd_config,
+		.flags = GENL_ADMIN_PERM,
 	},
 	{
 		.cmd = NET_DM_CMD_START,
-- 
2.36.1



More information about the Devel mailing list