Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux ifconfig eth0:1 192.168.3.1网络掩码255.255.255.0返回SIOCSIFFLAGS:无法分配请求的地址_Linux_Ifconfig - Fatal编程技术网

Linux ifconfig eth0:1 192.168.3.1网络掩码255.255.255.0返回SIOCSIFFLAGS:无法分配请求的地址

Linux ifconfig eth0:1 192.168.3.1网络掩码255.255.255.0返回SIOCSIFFLAGS:无法分配请求的地址,linux,ifconfig,Linux,Ifconfig,我正在使用“ifconfig eth0:1 192.168.3.1 netmask 255.255.255.0”在eth0上设置别名IP。但有一个错误弹出窗口: SIOCSIFFLAGS:无法分配请求的地址 SIOCSIFNETMASK:无法分配请求的地址 ifconfig的版本为: net工具1.60 ifconfig 1.42(2001-04-13) 该错误是由ifconfig源代码中的ioctl()函数引起的: /*设置某个接口标志*/ 静态int set_标志(char*ifname,短

我正在使用“ifconfig eth0:1 192.168.3.1 netmask 255.255.255.0”在eth0上设置别名IP。但有一个错误弹出窗口: SIOCSIFFLAGS:无法分配请求的地址 SIOCSIFNETMASK:无法分配请求的地址

ifconfig的版本为: net工具1.60 ifconfig 1.42(2001-04-13)

该错误是由ifconfig源代码中的ioctl()函数引起的: /*设置某个接口标志*/ 静态int set_标志(char*ifname,短标志) { 结构ifreq-ifr

safe_strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0) {
fprintf(stderr, _("%s: unknown interface: %s\n"), 
    ifname, strerror(errno));
return (-1);
}
safe_strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
ifr.ifr_flags |= flag;
**if (ioctl(skfd, SIOCSIFFLAGS, &ifr) < 0) {
perror("SIOCSIFFLAGS");
return -1;
}**
return (0);
safe_strncpy(ifr.ifr_name,ifname,IFNAMSIZ);
如果(ioctl(skfd、SIOCGIFFLAGS和ifr)<0){
fprintf(stderr,uwu(“%s:未知接口:%s\n”),
ifname,strerror(errno));
返回(-1);
}
安全标准(ifr.ifr\U名称、ifname、IFNAMSIZ);
ifr.ifr|U标志|=标志;
**如果(ioctl(skfd、SIOCSIFFLAGS和ifr)<0){
perror(“SIOCSIFFLAGS”);
返回-1;
}**
返回(0);
}


我的问题是,有人能解释一下为什么ioctl(skfd、SIOCSIFFLAGS和ifr)返回不能分配请求的地址(errno=99)

虽然没有人回答这个问题,但我想我已经找到了根本原因

net\ipv4中的devinet.c提供了一些信息