
That's a fair question but not one for these forums.wswartzendruber wrote:Is there some reason why the two are separate? Why are they not merged together with -4 and -6 paramters?

Maintainer: YOSHIFUJI Hideaki <yoshfuji at linux-ipv6 dot org>
* Previous maintainer was Alexey Kuznetsov <kuznet at ms2.inr.ac.ru>

Now I'm waiting for a reply.Dear Mr. Hideaki:
I have noticed that ping functionality for IPv4 and IPv6 reside in two separate commands, and I am wondering why this is. Actually, a few of us on the Gentoo Forums are wondering why (relevant thread).
OpenSSH has functionality for both protocols, and you can manually specify which one by passing either "-4" or "-6" to ssh. This is also how ping on Windows works.
I suppose this also applies to traceroute/traceroute6.
Thank you,
William Swartzendruber

I understand that, it's just a nightmare usage-wise. Okay, so I can't get to a website. Uh, do I use ping or ping6 to test it? I know, I'll first do nslookup to see what kind of records it returns.salahx wrote:I would suspect the reason why is that the difference between ping and ping6 isn't simple just a change to socket(). ping has to use a raw socket, and thus has to build the all the headers by hand. ipv4 and ipv6 have totally different structures, protocol number, etc - so the only thing they'd share would be the argument parsing code.

EDIT: This still doesn't make it any easier to use.The ping6 utility is intentionally separate from ping(8).
There have been many discussions on why we separate ping6 and ping(8).
Some people argued that it would be more convenient to uniform the ping
command for both IPv4 and IPv6. The followings are an answer to the
request.
From a developer's point of view: since the underling raw sockets API is
totally different between IPv4 and IPv6, we would end up having two types
of code base. There would actually be less benefit to uniform the two
commands into a single command from the developer's standpoint.
From an operator's point of view: unlike ordinary network applications
like remote login tools, we are usually aware of address family when
using network management tools. We do not just want to know the reacha-
bility to the host, but want to know the reachability to the host via a
particular network protocol such as IPv6. Thus, even if we had a unified
ping(8) command for both IPv4 and IPv6, we would usually type a -6 or -4
option (or something like those) to specify the particular address fam-
ily. This essentially means that we have two different commands.

As you know, this was because "raw" API and packet format are
different. We put ping/ping6 common parts in "ping_common.c".
Note: In SSH case, there is little difference in the wire format.
In fact, I am okay to unify them if backward-compatibility is okay.
- If the program is invoked as "ping", it is for IPv4 (by default).
- If the program is invoked as "ping6", it is for IPv6.
For usefullness,
- We might have new name/option to ping all targets specified by
name: e.g., you might want to do
$ pingx www,linux-ipv6.org
to ping all ip (regardless of ipv4/ipv6) addresses specified by
the name.
- Or
$ pingx -4 www.linux-ipv6.org
to ping all ipv4 addresses by that name.
- ...
--yoshfuji

What about:
1. Have a single "ping" binary.
2. Have a symlink from "ping6" to "ping" that forces IPv6 (check argv[0]).
3. The "-4" and "-6" command line options can still be used with "ping"
4. Should "ping" be invoked without specifying a protocol, it will default to IPv4...
5. ...unless a predefined environment variable tells it to use IPv6 by default.
How does this sound to you?