Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ping vs. ping6
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
wswartzendruber
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1261
Location: Idaho, USA

PostPosted: Sat Apr 23, 2011 6:03 am    Post subject: ping vs. ping6 Reply with quote

Is there some reason why the two are separate? Why are they not merged together with -4 and -6 paramters?
Back to top
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 622
Location: Yeovil, Somerset, UK

PostPosted: Mon Apr 25, 2011 11:57 pm    Post subject: Re: ping vs. ping6 Reply with quote

wswartzendruber wrote:
Is there some reason why the two are separate? Why are they not merged together with -4 and -6 paramters?


That's a fair question but not one for these forums.

ping6 is not a symlink to ping so I think they are separate binaries.

"man ping" and "man"ping6" seem to be identical.

It might to help to think of the word dialect:
Why does ps not need "-" for its switches or tar?
Why do "key" and "quay" sound similar in en_GB (at least)?

You should probably contact the writers of ping itself.

Cheers
Jon
Back to top
View user's profile Send private message
wswartzendruber
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1261
Location: Idaho, USA

PostPosted: Fri Jan 06, 2012 3:48 am    Post subject: Reply with quote

I'm having trouble finding an email address.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23578

PostPosted: Sat Jan 07, 2012 1:36 am    Post subject: Reply with quote

The package homepage leads me through a few redirects, but dropped me on a page that linked to iputils. Near the bottom of the useful content of that page, I see:
Quote:

Maintainer: YOSHIFUJI Hideaki <yoshfuji at linux-ipv6 dot org>
* Previous maintainer was Alexey Kuznetsov <kuznet at ms2.inr.ac.ru>
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Sat Jan 07, 2012 1:13 pm    Post subject: Reply with quote

I'd also be interested in his answer, so if you get one, please share it with us. I suppose it'll also apply to traceroute6/traceroute
_________________
The End of the Internet!
Back to top
View user's profile Send private message
wswartzendruber
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1261
Location: Idaho, USA

PostPosted: Sat Jan 07, 2012 5:43 pm    Post subject: Reply with quote

Here's what I said:

Quote:
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

Now I'm waiting for a reply.
Back to top
View user's profile Send private message
salahx
Guru
Guru


Joined: 12 Mar 2005
Posts: 559

PostPosted: Sat Jan 07, 2012 7:18 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
wswartzendruber
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1261
Location: Idaho, USA

PostPosted: Sat Jan 07, 2012 9:00 pm    Post subject: Reply with quote

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.

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.

See, if a website is down on Windows, you just use "ping" and it automatically selects depending on what's returned from the DNS query.

EDIT: Or you can force one via a command line argument.
Back to top
View user's profile Send private message
wswartzendruber
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1261
Location: Idaho, USA

PostPosted: Sat Jan 07, 2012 10:29 pm    Post subject: Reply with quote

I found the reasoning in the ping6 man page that's online:

Quote:
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.

EDIT: This still doesn't make it any easier to use.
Back to top
View user's profile Send private message
wswartzendruber
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1261
Location: Idaho, USA

PostPosted: Tue Jan 10, 2012 7:43 pm    Post subject: Reply with quote

Just got this back from the author:

Quote:
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
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Wed Jan 11, 2012 12:52 pm    Post subject: Reply with quote

I think I agree with how it works in windows/

ping -> IP proto not specified so so do as any other software do, check IPv6 first then fallback on IPv4, then ping -4 ping -6,


This retro-compatibility requirement sucks IMO
_________________
The End of the Internet!
Back to top
View user's profile Send private message
wswartzendruber
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1261
Location: Idaho, USA

PostPosted: Wed Jan 11, 2012 5:49 pm    Post subject: Reply with quote

I just sent him this:

Quote:
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?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum