aboutsummaryrefslogtreecommitdiff
path: root/networking/arping.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
commitcad5364599eb5062d59e0c397ed638ddd61a8d5d (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /networking/arping.c
parente01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff)
downloadbusybox-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz
Major coreutils update.
Diffstat (limited to 'networking/arping.c')
-rw-r--r--networking/arping.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/networking/arping.c b/networking/arping.c
index bf0a77cf4..2e1adf0a2 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -302,9 +302,9 @@ int arping_main(int argc, char **argv)
break;
case 'I':
if (optarg == NULL)
- show_usage();
- if (xstrlen(optarg) > IF_NAMESIZE) {
- error_msg("Interface name `%s' must be less than %d", optarg,
+ bb_show_usage();
+ if (bb_strlen(optarg) > IF_NAMESIZE) {
+ bb_error_msg("Interface name `%s' must be less than %d", optarg,
IF_NAMESIZE);
exit(2);
}
@@ -319,20 +319,20 @@ int arping_main(int argc, char **argv)
case 'h':
case '?':
default:
- show_usage();
+ bb_show_usage();
}
}
argc -= optind;
argv += optind;
if (argc != 1)
- show_usage();
+ bb_show_usage();
target = *argv;
if (s < 0) {
- error_msg("socket");
+ bb_error_msg("socket");
exit(socket_errno);
}
@@ -342,21 +342,21 @@ int arping_main(int argc, char **argv)
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, device, IFNAMSIZ - 1);
if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
- error_msg("Interface %s not found", device);
+ bb_error_msg("Interface %s not found", device);
exit(2);
}
ifindex = ifr.ifr_ifindex;
if (ioctl(s, SIOCGIFFLAGS, (char *) &ifr)) {
- error_msg("SIOCGIFFLAGS");
+ bb_error_msg("SIOCGIFFLAGS");
exit(2);
}
if (!(ifr.ifr_flags & IFF_UP)) {
- error_msg("Interface %s is down", device);
+ bb_error_msg("Interface %s is down", device);
exit(2);
}
if (ifr.ifr_flags & (IFF_NOARP | IFF_LOOPBACK)) {
- error_msg("Interface %s is not ARPable", device);
+ bb_error_msg("Interface %s is not ARPable", device);
exit(dad ? 0 : 2);
}
}
@@ -366,14 +366,14 @@ int arping_main(int argc, char **argv)
hp = gethostbyname2(target, AF_INET);
if (!hp) {
- error_msg("invalid or unknown target %s", target);
+ bb_error_msg("invalid or unknown target %s", target);
exit(2);
}
memcpy(&dst, hp->h_addr, 4);
}
if (source && !inet_aton(source, &src)) {
- error_msg("invalid source address %s", source);
+ bb_error_msg("invalid source address %s", source);
exit(2);
}
@@ -385,21 +385,21 @@ int arping_main(int argc, char **argv)
int probe_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (probe_fd < 0) {
- error_msg("socket");
+ bb_error_msg("socket");
exit(2);
}
if (device) {
if (setsockopt
(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device,
strlen(device) + 1) == -1)
- error_msg("WARNING: interface %s is ignored", device);
+ bb_error_msg("WARNING: interface %s is ignored", device);
}
memset(&saddr, 0, sizeof(saddr));
saddr.sin_family = AF_INET;
if (src.s_addr) {
saddr.sin_addr = src;
if (bind(probe_fd, (struct sockaddr *) &saddr, sizeof(saddr)) == -1) {
- error_msg("bind");
+ bb_error_msg("bind");
exit(2);
}
} else if (!dad) {
@@ -415,12 +415,12 @@ int arping_main(int argc, char **argv)
perror("WARNING: setsockopt(SO_DONTROUTE)");
if (connect(probe_fd, (struct sockaddr *) &saddr, sizeof(saddr))
== -1) {
- error_msg("connect");
+ bb_error_msg("connect");
exit(2);
}
if (getsockname(probe_fd, (struct sockaddr *) &saddr, &alen) ==
-1) {
- error_msg("getsockname");
+ bb_error_msg("getsockname");
exit(2);
}
src = saddr.sin_addr;
@@ -432,7 +432,7 @@ int arping_main(int argc, char **argv)
me.sll_ifindex = ifindex;
me.sll_protocol = htons(ETH_P_ARP);
if (bind(s, (struct sockaddr *) &me, sizeof(me)) == -1) {
- error_msg("bind");
+ bb_error_msg("bind");
exit(2);
}
@@ -440,12 +440,12 @@ int arping_main(int argc, char **argv)
int alen = sizeof(me);
if (getsockname(s, (struct sockaddr *) &me, &alen) == -1) {
- error_msg("getsockname");
+ bb_error_msg("getsockname");
exit(2);
}
}
if (me.sll_halen == 0) {
- error_msg("Interface \"%s\" is not ARPable (no ll address)", device);
+ bb_error_msg("Interface \"%s\" is not ARPable (no ll address)", device);
exit(dad ? 0 : 2);
}
he = me;
@@ -458,7 +458,7 @@ int arping_main(int argc, char **argv)
}
if (!src.s_addr && !dad) {
- error_msg("no src address in the non-DAD mode");
+ bb_error_msg("no src address in the non-DAD mode");
exit(2);
}