summaryrefslogtreecommitdiff
path: root/networking/arping.c
diff options
context:
space:
mode:
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 bf0a77c..2e1adf0 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);
}