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);
}