summaryrefslogtreecommitdiff
path: root/networking/ping.c
diff options
context:
space:
mode:
authorDenys Vlasenko2010-11-29 12:07:12 +0100
committerDenys Vlasenko2010-11-29 12:07:12 +0100
commit3c8799b8a45def567705bfd07b8745e99d5f2dd9 (patch)
tree0248f53ec6dd69e0ac07491dd64e11cb2d2a2c60 /networking/ping.c
parent8027a202a89b31b33c94eae29895f14ceceef5af (diff)
downloadbusybox-3c8799b8a45def567705bfd07b8745e99d5f2dd9.zip
busybox-3c8799b8a45def567705bfd07b8745e99d5f2dd9.tar.gz
ping: set not only IP_TTL, but also IP_MULTICAST_TTL
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'networking/ping.c')
-rw-r--r--networking/ping.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/networking/ping.c b/networking/ping.c
index 8571d17..7f74c26 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -675,9 +675,11 @@ static void ping4(len_and_sockaddr *lsa)
sockopt = (datalen * 2) + 7 * 1024; /* giving it a bit of extra room */
setsockopt(pingsock, SOL_SOCKET, SO_RCVBUF, &sockopt, sizeof(sockopt));
- if (opt_ttl != 0)
- //setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_TTL, &opt_ttl, sizeof(opt_ttl));
+ if (opt_ttl != 0) {
setsockopt(pingsock, IPPROTO_IP, IP_TTL, &opt_ttl, sizeof(opt_ttl));
+ /* above doesnt affect packets sent to bcast IP, so... */
+ setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_TTL, &opt_ttl, sizeof(opt_ttl));
+ }
signal(SIGINT, print_stats_and_exit);