aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-06-13 15:01:17 -0700
committerRob Landley <rob@landley.net>2018-06-14 12:09:44 -0500
commit442f7a0c90b537c1af56c6ce7b3f40a0a47f822d (patch)
tree494e77764460d7b21928b8615b7ebedea824432c /toys
parent36772a1926beb55f6077d29484955ddbcee026d7 (diff)
downloadtoybox-442f7a0c90b537c1af56c6ce7b3f40a0a47f822d.tar.gz
ping: support ping6 as a synonym for `ping -6`.
Sadly, this is what existing scripts seem to do.
Diffstat (limited to 'toys')
-rw-r--r--toys/net/ping.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/toys/net/ping.c b/toys/net/ping.c
index f7c6ca12..c329949d 100644
--- a/toys/net/ping.c
+++ b/toys/net/ping.c
@@ -12,6 +12,7 @@
// -s > 4088 = sizeof(toybuf)-sizeof(struct icmphdr), then kernel adds 20 bytes
USE_PING(NEWTOY(ping, "<1>1m#t#<0>255=64c#<0=3s#<0>4088=56I:i:W#<0=10w#<0qf46[-46]", TOYFLAG_USR|TOYFLAG_BIN))
+USE_PING(OLDTOY(ping6, ping, TOYFLAG_USR|TOYFLAG_BIN))
config PING
bool "ping"
@@ -125,7 +126,7 @@ void ping_main(void)
if ((toys.optflags&(FLAG_f|FLAG_c)) == FLAG_f) TT.c = 15;
// ipv4 or ipv6? (0 = autodetect if -I or arg have only one address type.)
- if (toys.optflags&FLAG_6) family = AF_INET6;
+ if (toys.optflags&FLAG_6 || toys.which->name[4] == '6') family = AF_INET6;
else if (toys.optflags&FLAG_4) family = AF_INET;
else family = 0;