Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

ping vs. ping6

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
12 posts • Page 1 of 1
Author
Message
wswartzendruber
Veteran
Veteran
User avatar
Posts: 1261
Joined: Tue Mar 23, 2004 1:16 am
Location: Idaho, USA

ping vs. ping6

  • Quote

Post by wswartzendruber » Sat Apr 23, 2011 6:03 am

Is there some reason why the two are separate? Why are they not merged together with -4 and -6 paramters?
Top
gerdesj
l33t
l33t
User avatar
Posts: 622
Joined: Thu Sep 29, 2005 1:44 pm
Location: Yeovil, Somerset, UK
Contact:
Contact gerdesj
Website

Re: ping vs. ping6

  • Quote

Post by gerdesj » Mon Apr 25, 2011 11:57 pm

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
Top
wswartzendruber
Veteran
Veteran
User avatar
Posts: 1261
Joined: Tue Mar 23, 2004 1:16 am
Location: Idaho, USA

  • Quote

Post by wswartzendruber » Fri Jan 06, 2012 3:48 am

I'm having trouble finding an email address.
Top
Hu
Administrator
Administrator
Posts: 24401
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Sat Jan 07, 2012 1:36 am

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:
Maintainer: YOSHIFUJI Hideaki <yoshfuji at linux-ipv6 dot org>
* Previous maintainer was Alexey Kuznetsov <kuznet at ms2.inr.ac.ru>
Top
truc
Advocate
Advocate
User avatar
Posts: 3199
Joined: Mon Jul 25, 2005 9:24 am

  • Quote

Post by truc » Sat Jan 07, 2012 1:13 pm

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!
Top
wswartzendruber
Veteran
Veteran
User avatar
Posts: 1261
Joined: Tue Mar 23, 2004 1:16 am
Location: Idaho, USA

  • Quote

Post by wswartzendruber » Sat Jan 07, 2012 5:43 pm

Here's what I said:
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.
Top
salahx
Guru
Guru
Posts: 572
Joined: Sat Mar 12, 2005 6:39 am

  • Quote

Post by salahx » Sat Jan 07, 2012 7:18 pm

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.
Top
wswartzendruber
Veteran
Veteran
User avatar
Posts: 1261
Joined: Tue Mar 23, 2004 1:16 am
Location: Idaho, USA

  • Quote

Post by wswartzendruber » Sat Jan 07, 2012 9:00 pm

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.
Top
wswartzendruber
Veteran
Veteran
User avatar
Posts: 1261
Joined: Tue Mar 23, 2004 1:16 am
Location: Idaho, USA

  • Quote

Post by wswartzendruber » Sat Jan 07, 2012 10:29 pm

I found the reasoning in the ping6 man page that's online:
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.
Top
wswartzendruber
Veteran
Veteran
User avatar
Posts: 1261
Joined: Tue Mar 23, 2004 1:16 am
Location: Idaho, USA

  • Quote

Post by wswartzendruber » Tue Jan 10, 2012 7:43 pm

Just got this back from the author:
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
Top
truc
Advocate
Advocate
User avatar
Posts: 3199
Joined: Mon Jul 25, 2005 9:24 am

  • Quote

Post by truc » Wed Jan 11, 2012 12:52 pm

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!
Top
wswartzendruber
Veteran
Veteran
User avatar
Posts: 1261
Joined: Tue Mar 23, 2004 1:16 am
Location: Idaho, USA

  • Quote

Post by wswartzendruber » Wed Jan 11, 2012 5:49 pm

I just sent him this:
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?
Top
Post Reply

12 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic