Linux 日志:Loading kernel module for a network device with CAP_SYS_MODULE (deprecated)

CAP_SYS_MODULE已经被遗弃,不再使用,如果有module 还在使用的话,就会打印这条log;希望引起module开发者的注意,尽快使用新的选项。

pr_warn("Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev-%s instead.\n",

/linux-3.10.0-862.14.4.el7/net/core/dev_ioctl.c

https://github.com/torvalds/linux/commit/e020836d953eb1ce5b9221b32f46136...

被这个commit 去掉了,原因是这个log会被误报,即使拥有正确的设置,还是会不停的打印log;

根据kernel代码的注释,可以知道这个角色CAP_NET_ADMIN拥有的权限很大:

/* Allow interface configuration */ 允许网卡的配置
/* Allow administration of IP firewall, masquerading and accounting */允许IP防火墙管理
/* Allow setting debug option on sockets */ 套接字调试模式
/* Allow modification of routing tables */ 修改路由表
/* Allow setting arbitrary process / process group ownership on
   sockets */ 指定套接字的拥有者
/* Allow binding to any address for transparent proxying (also via NET_RAW) */为透传代理功能绑定地址
/* Allow setting TOS (type of service) */设置服务类型
/* Allow setting promiscuous mode */ 进入混杂模式
/* Allow clearing driver statistics */ 清理计数信息
/* Allow multicasting */ 广播
/* Allow read/write of device-specific registers */ 读取设备特定寄存器
/* Allow activation of ATM control sockets */ 

#define CAP_NET_ADMIN        12

/* Insert and remove kernel modules - modify kernel without limit */ 这个选项只能插入删除kernel模块
#define CAP_SYS_MODULE       16

代码分析

	if (no_module && capable(CAP_NET_ADMIN)) //查看是否有ADMIN的权限,插入模块时,多了netdev前缀,这个有什么用?
		no_module = request_module("netdev-%s", name);
	if (no_module && capable(CAP_SYS_MODULE)) {  //查看是否有module权限
		if (!request_module("%s", name))
			pr_warn("Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev-%s instead.\n",
				name);
	}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

mzhan017

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值