summaryrefslogtreecommitdiff
path: root/networking/ping.c
diff options
context:
space:
mode:
authorDenys Vlasenko2015-08-24 19:48:03 +0200
committerDenys Vlasenko2015-08-24 20:00:17 +0200
commitc52cbea2bba6582b44facb424a15dc544b54fb28 (patch)
treeb048b3f7832621a16ed9ba2441756e2fc69ee316 /networking/ping.c
parent2db782bc7be70c34a756e2bc6d4a53e8f47bab20 (diff)
downloadbusybox-c52cbea2bba6582b44facb424a15dc544b54fb28.zip
busybox-c52cbea2bba6582b44facb424a15dc544b54fb28.tar.gz
libbb: add setsockopt_foo helpers
function old new delta setsockopt_int - 23 +23 do_load 918 934 +16 setsockopt_SOL_SOCKET_int - 14 +14 setsockopt_keepalive - 10 +10 setsockopt_SOL_SOCKET_1 - 10 +10 buffer_fill_and_print 169 178 +9 setsockopt_1 - 8 +8 nfsmount 3560 3566 +6 redirect 1277 1282 +5 tcpudpsvd_main 1782 1786 +4 d6_send_kernel_packet 272 275 +3 i2cget_main 380 382 +2 ed_main 2544 2545 +1 scan_recursive 380 378 -2 nbdclient_main 492 490 -2 hash_find 235 233 -2 cmdputs 334 332 -2 parse_command 1443 1440 -3 static.two 4 - -4 ntpd_main 1039 1035 -4 const_int_1 4 - -4 const_IPTOS_LOWDELAY 4 - -4 RCVBUF 4 - -4 ntp_init 474 469 -5 change_listen_mode 316 310 -6 uevent_main 416 409 -7 arping_main 1697 1690 -7 telnet_main 1612 1603 -9 socket_want_pktinfo 42 33 -9 setsockopt_reuseaddr 21 10 -11 setsockopt_broadcast 21 10 -11 httpd_main 772 757 -15 get_remote_transfer_fd 109 94 -15 make_new_session 503 487 -16 ftpd_main 2177 2160 -17 read_bunzip 1896 1866 -30 common_traceroute_main 4099 4058 -41 common_ping_main 1836 1783 -53 ------------------------------------------------------------------------------ (add/remove: 5/4 grow/shrink: 8/21 up/down: 111/-283) Total: -172 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/ping.c')
-rw-r--r--networking/ping.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/networking/ping.c b/networking/ping.c
index 20489a0..e1f9ebc 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -247,7 +247,7 @@ static void ping6(len_and_sockaddr *lsa)
pkt->icmp6_type = ICMP6_ECHO_REQUEST;
sockopt = offsetof(struct icmp6_hdr, icmp6_cksum);
- setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, &sockopt, sizeof(sockopt));
+ setsockopt_int(pingsock, SOL_RAW, IPV6_CHECKSUM, sockopt);
xsendto(pingsock, G.packet, DEFDATALEN + sizeof(struct icmp6_hdr), &lsa->u.sa, lsa->len);
@@ -700,12 +700,12 @@ static void ping4(len_and_sockaddr *lsa)
/* set recv buf (needed if we can get lots of responses: flood ping,
* broadcast ping etc) */
sockopt = (datalen * 2) + 7 * 1024; /* giving it a bit of extra room */
- setsockopt(pingsock, SOL_SOCKET, SO_RCVBUF, &sockopt, sizeof(sockopt));
+ setsockopt_SOL_SOCKET_int(pingsock, SO_RCVBUF, sockopt);
if (opt_ttl != 0) {
- setsockopt(pingsock, IPPROTO_IP, IP_TTL, &opt_ttl, sizeof(opt_ttl));
+ setsockopt_int(pingsock, IPPROTO_IP, IP_TTL, opt_ttl);
/* above doesnt affect packets sent to bcast IP, so... */
- setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_TTL, &opt_ttl, sizeof(opt_ttl));
+ setsockopt_int(pingsock, IPPROTO_IP, IP_MULTICAST_TTL, opt_ttl);
}
signal(SIGINT, print_stats_and_exit);
@@ -766,15 +766,15 @@ static void ping6(len_and_sockaddr *lsa)
/* set recv buf (needed if we can get lots of responses: flood ping,
* broadcast ping etc) */
sockopt = (datalen * 2) + 7 * 1024; /* giving it a bit of extra room */
- setsockopt(pingsock, SOL_SOCKET, SO_RCVBUF, &sockopt, sizeof(sockopt));
+ setsockopt_SOL_SOCKET_int(pingsock, SO_RCVBUF, sockopt);
sockopt = offsetof(struct icmp6_hdr, icmp6_cksum);
- if (offsetof(struct icmp6_hdr, icmp6_cksum) != 2)
+ if (sockopt != 2)
BUG_bad_offsetof_icmp6_cksum();
- setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, &sockopt, sizeof(sockopt));
+ setsockopt_int(pingsock, SOL_RAW, IPV6_CHECKSUM, sockopt);
/* request ttl info to be returned in ancillary data */
- setsockopt(pingsock, SOL_IPV6, IPV6_HOPLIMIT, &const_int_1, sizeof(const_int_1));
+ setsockopt_1(pingsock, SOL_IPV6, IPV6_HOPLIMIT);
if (if_index)
pingaddr.sin6.sin6_scope_id = if_index;