Major coreutils update.
This commit is contained in:
@@ -47,7 +47,7 @@ static int do_ioctl_get_ifindex(char *dev)
|
||||
strcpy(ifr.ifr_name, dev);
|
||||
fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (ioctl(fd, SIOCGIFINDEX, &ifr)) {
|
||||
perror_msg("ioctl");
|
||||
bb_perror_msg("ioctl");
|
||||
return 0;
|
||||
}
|
||||
close(fd);
|
||||
@@ -62,7 +62,7 @@ static int do_ioctl_get_iftype(char *dev)
|
||||
strcpy(ifr.ifr_name, dev);
|
||||
fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (ioctl(fd, SIOCGIFHWADDR, &ifr)) {
|
||||
perror_msg("ioctl");
|
||||
bb_perror_msg("ioctl");
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
@@ -78,7 +78,7 @@ static char *do_ioctl_get_ifname(int idx)
|
||||
ifr.ifr_ifindex = idx;
|
||||
fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (ioctl(fd, SIOCGIFNAME, &ifr)) {
|
||||
perror_msg("ioctl");
|
||||
bb_perror_msg("ioctl");
|
||||
return NULL;
|
||||
}
|
||||
close(fd);
|
||||
@@ -98,7 +98,7 @@ static int do_get_ioctl(char *basedev, struct ip_tunnel_parm *p)
|
||||
fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
err = ioctl(fd, SIOCGETTUNNEL, &ifr);
|
||||
if (err) {
|
||||
perror_msg("ioctl");
|
||||
bb_perror_msg("ioctl");
|
||||
}
|
||||
close(fd);
|
||||
return err;
|
||||
@@ -119,7 +119,7 @@ static int do_add_ioctl(int cmd, char *basedev, struct ip_tunnel_parm *p)
|
||||
fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
err = ioctl(fd, cmd, &ifr);
|
||||
if (err) {
|
||||
perror_msg("ioctl");
|
||||
bb_perror_msg("ioctl");
|
||||
}
|
||||
close(fd);
|
||||
return err;
|
||||
@@ -140,7 +140,7 @@ static int do_del_ioctl(char *basedev, struct ip_tunnel_parm *p)
|
||||
fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
err = ioctl(fd, SIOCDELTUNNEL, &ifr);
|
||||
if (err) {
|
||||
perror_msg("ioctl");
|
||||
bb_perror_msg("ioctl");
|
||||
}
|
||||
close(fd);
|
||||
return err;
|
||||
@@ -166,26 +166,26 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
|
||||
if (strcmp(*argv, "ipip") == 0 ||
|
||||
strcmp(*argv, "ip/ip") == 0) {
|
||||
if (p->iph.protocol && p->iph.protocol != IPPROTO_IPIP) {
|
||||
error_msg("You managed to ask for more than one tunnel mode.");
|
||||
bb_error_msg("You managed to ask for more than one tunnel mode.");
|
||||
exit(-1);
|
||||
}
|
||||
p->iph.protocol = IPPROTO_IPIP;
|
||||
} else if (strcmp(*argv, "gre") == 0 ||
|
||||
strcmp(*argv, "gre/ip") == 0) {
|
||||
if (p->iph.protocol && p->iph.protocol != IPPROTO_GRE) {
|
||||
error_msg("You managed to ask for more than one tunnel mode.");
|
||||
bb_error_msg("You managed to ask for more than one tunnel mode.");
|
||||
exit(-1);
|
||||
}
|
||||
p->iph.protocol = IPPROTO_GRE;
|
||||
} else if (strcmp(*argv, "sit") == 0 ||
|
||||
strcmp(*argv, "ipv6/ip") == 0) {
|
||||
if (p->iph.protocol && p->iph.protocol != IPPROTO_IPV6) {
|
||||
error_msg("You managed to ask for more than one tunnel mode.");
|
||||
bb_error_msg("You managed to ask for more than one tunnel mode.");
|
||||
exit(-1);
|
||||
}
|
||||
p->iph.protocol = IPPROTO_IPV6;
|
||||
} else {
|
||||
error_msg("Cannot guess tunnel mode.");
|
||||
bb_error_msg("Cannot guess tunnel mode.");
|
||||
exit(-1);
|
||||
}
|
||||
} else if (strcmp(*argv, "key") == 0) {
|
||||
@@ -197,7 +197,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
|
||||
p->i_key = p->o_key = get_addr32(*argv);
|
||||
else {
|
||||
if (get_unsigned(&uval, *argv, 0)<0) {
|
||||
error_msg("invalid value of \"key\"");
|
||||
bb_error_msg("invalid value of \"key\"");
|
||||
exit(-1);
|
||||
}
|
||||
p->i_key = p->o_key = htonl(uval);
|
||||
@@ -210,7 +210,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
|
||||
p->o_key = get_addr32(*argv);
|
||||
else {
|
||||
if (get_unsigned(&uval, *argv, 0)<0) {
|
||||
error_msg("invalid value of \"ikey\"");
|
||||
bb_error_msg("invalid value of \"ikey\"");
|
||||
exit(-1);
|
||||
}
|
||||
p->i_key = htonl(uval);
|
||||
@@ -223,7 +223,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
|
||||
p->o_key = get_addr32(*argv);
|
||||
else {
|
||||
if (get_unsigned(&uval, *argv, 0)<0) {
|
||||
error_msg("invalid value of \"okey\"");
|
||||
bb_error_msg("invalid value of \"okey\"");
|
||||
exit(-1);
|
||||
}
|
||||
p->o_key = htonl(uval);
|
||||
@@ -308,7 +308,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
|
||||
|
||||
if (p->iph.protocol == IPPROTO_IPIP || p->iph.protocol == IPPROTO_IPV6) {
|
||||
if ((p->i_flags & GRE_KEY) || (p->o_flags & GRE_KEY)) {
|
||||
error_msg("Keys are not allowed with ipip and sit.");
|
||||
bb_error_msg("Keys are not allowed with ipip and sit.");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -328,7 +328,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
|
||||
p->o_flags |= GRE_KEY;
|
||||
}
|
||||
if (IN_MULTICAST(ntohl(p->iph.daddr)) && !p->iph.saddr) {
|
||||
error_msg("Broadcast tunnel requires a source address.");
|
||||
bb_error_msg("Broadcast tunnel requires a source address.");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -343,7 +343,7 @@ static int do_add(int cmd, int argc, char **argv)
|
||||
return -1;
|
||||
|
||||
if (p.iph.ttl && p.iph.frag_off == 0) {
|
||||
error_msg("ttl != 0 and noptmudisc are incompatible");
|
||||
bb_error_msg("ttl != 0 and noptmudisc are incompatible");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ static int do_add(int cmd, int argc, char **argv)
|
||||
case IPPROTO_IPV6:
|
||||
return do_add_ioctl(cmd, "sit0", &p);
|
||||
default:
|
||||
error_msg("cannot determine tunnel mode (ipip, gre or sit)");
|
||||
bb_error_msg("cannot determine tunnel mode (ipip, gre or sit)");
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
@@ -464,7 +464,7 @@ static int do_tunnels_list(struct ip_tunnel_parm *p)
|
||||
buf[sizeof(buf) - 1] = 0;
|
||||
if ((ptr = strchr(buf, ':')) == NULL ||
|
||||
(*ptr++ = 0, sscanf(buf, "%s", name) != 1)) {
|
||||
error_msg("Wrong format of /proc/net/dev. Sorry.");
|
||||
bb_error_msg("Wrong format of /proc/net/dev. Sorry.");
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(ptr, "%ld%ld%ld%ld%ld%ld%ld%*d%ld%ld%ld%ld%ld%ld%ld",
|
||||
@@ -477,7 +477,7 @@ static int do_tunnels_list(struct ip_tunnel_parm *p)
|
||||
continue;
|
||||
type = do_ioctl_get_iftype(name);
|
||||
if (type == -1) {
|
||||
error_msg("Failed to get type of [%s]", name);
|
||||
bb_error_msg("Failed to get type of [%s]", name);
|
||||
continue;
|
||||
}
|
||||
if (type != ARPHRD_TUNNEL && type != ARPHRD_IPGRE && type != ARPHRD_SIT)
|
||||
@@ -543,6 +543,6 @@ int do_iptunnel(int argc, char **argv)
|
||||
} else
|
||||
return do_show(0, NULL);
|
||||
|
||||
error_msg("Command \"%s\" is unknown, try \"ip tunnel help\".", *argv);
|
||||
bb_error_msg("Command \"%s\" is unknown, try \"ip tunnel help\".", *argv);
|
||||
exit(-1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user