aboutsummaryrefslogtreecommitdiff
path: root/toys/pending
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2018-06-09 13:10:29 -0500
committerRob Landley <rob@landley.net>2018-06-09 13:10:29 -0500
commitc88d216f221e49031f8fa6f924a9b1e8dffa1463 (patch)
tree856c82d52a4dbbb05ae37c1a354e6c9247c3524b /toys/pending
parent5efc1674a81ce1fd423ca8aac2ce3c02144751fc (diff)
downloadtoybox-c88d216f221e49031f8fa6f924a9b1e8dffa1463.tar.gz
Show workaround for the kernel bug when ping hits it.
Patches were submitted upstream to fix it at https://patchwork.kernel.org/patch/9847017/ and http://lkml.iu.edu/hypermail/linux/kernel/1710.3/04715.html to no effect.
Diffstat (limited to 'toys/pending')
-rw-r--r--toys/pending/ping.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/toys/pending/ping.c b/toys/pending/ping.c
index 3802918d..c29fb9df 100644
--- a/toys/pending/ping.c
+++ b/toys/pending/ping.c
@@ -149,8 +149,16 @@ void ping_main(void)
// Open DGRAM socket
sa->sa_family = ai->ai_family;
- TT.sock = xsocket(ai->ai_family, SOCK_DGRAM,
- (ai->ai_family == AF_INET) ? IPPROTO_ICMP : IPPROTO_ICMPV6);
+ TT.sock = socket(ai->ai_family, SOCK_DGRAM,
+ len = (ai->ai_family == AF_INET) ? IPPROTO_ICMP : IPPROTO_ICMPV6);
+ if (TT.sock == -1) {
+ perror_msg("socket SOCK_DGRAM %x", len);
+ if (errno == EACCES) {
+ fprintf(stderr, "Kernel bug workaround (as root):\n");
+ fprintf(stderr, "echo 0 9999999 > /proc/sys/net/ipv4/ping_group_range\n");
+ }
+ xexit();
+ }
if (TT.I && bind(TT.sock, sa, sizeof(src_addr))) perror_exit("bind");
if (TT.t) {