summaryrefslogtreecommitdiff
path: root/networking/arping.c
diff options
context:
space:
mode:
authorDenys Vlasenko2018-02-11 14:55:46 +0100
committerDenys Vlasenko2018-02-11 14:55:46 +0100
commitba3b9dbf065438402d89655d7baefb0ccc6f0663 (patch)
tree4669edd0fb031940a794eaf8942bdbf314efea2e /networking/arping.c
parentd3162773d5c722cc1f5c5b1ea5171c8d3c208135 (diff)
downloadbusybox-ba3b9dbf065438402d89655d7baefb0ccc6f0663.zip
busybox-ba3b9dbf065438402d89655d7baefb0ccc6f0663.tar.gz
libbb: introduce and use bb_getsockname()
function old new delta bb_getsockname - 18 +18 xrtnl_open 88 83 -5 do_iplink 1216 1209 -7 arping_main 1686 1668 -18 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/3 up/down: 18/-30) Total: -12 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/arping.c')
-rw-r--r--networking/arping.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/networking/arping.c b/networking/arping.c
index a16f04b..59092a7 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -363,15 +363,13 @@ int arping_main(int argc UNUSED_PARAM, char **argv)
xbind(probe_fd, (struct sockaddr *) &saddr, sizeof(saddr));
} else { /* !(option_mask32 & DAD) case */
/* Find IP address on this iface */
- socklen_t alen = sizeof(saddr);
-
saddr.sin_port = htons(1025);
saddr.sin_addr = dst;
if (setsockopt_SOL_SOCKET_1(probe_fd, SO_DONTROUTE) != 0)
bb_perror_msg("setsockopt(%s)", "SO_DONTROUTE");
xconnect(probe_fd, (struct sockaddr *) &saddr, sizeof(saddr));
- getsockname(probe_fd, (struct sockaddr *) &saddr, &alen);
+ bb_getsockname(probe_fd, (struct sockaddr *) &saddr, sizeof(saddr));
//never happens:
//if (getsockname(probe_fd, (struct sockaddr *) &saddr, &alen) == -1)
// bb_perror_msg_and_die("getsockname");
@@ -387,13 +385,10 @@ int arping_main(int argc UNUSED_PARAM, char **argv)
me.sll_protocol = htons(ETH_P_ARP);
xbind(sock_fd, (struct sockaddr *) &me, sizeof(me));
- {
- socklen_t alen = sizeof(me);
- getsockname(sock_fd, (struct sockaddr *) &me, &alen);
- //never happens:
- //if (getsockname(sock_fd, (struct sockaddr *) &me, &alen) == -1)
- // bb_perror_msg_and_die("getsockname");
- }
+ bb_getsockname(sock_fd, (struct sockaddr *) &me, sizeof(me));
+ //never happens:
+ //if (getsockname(sock_fd, (struct sockaddr *) &me, &alen) == -1)
+ // bb_perror_msg_and_die("getsockname");
if (me.sll_halen == 0) {
bb_error_msg(err_str, "is not ARPable (no ll address)");
BUILD_BUG_ON(DAD != 2);