Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Jul 97 10:37:27 -0500
From:      "Richard Seaman, Jr." <lists@tar.com>
To:        "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   Whats happened to ping?
Message-ID:  <199707251537.KAA28194@ns.tar.com>

next in thread | raw e-mail | index | archive | help
It seems that there have recently been changes to the sematics of
"ping -c N".  Unless I'm mistaken, the old behavior was that "ping -c N"
meant try to send N packets.  Now it means keep trying until N packets
are actually sent.

The practical effect of this is that "ping -c N" might loop endlessly,
if, for example, the network is down and the sendto fails.  An actual
example:

# ping -c 1 -n -q 204.95.160.35                   
PING 204.95.160.35 (204.95.160.35): 56 data bytes 
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
ping: sendto: Network is down                     
^C                                                
--- 204.95.160.35 ping statistics ---             
0 packets transmitted, 0 packets received,        

The problem with this is that if you put "ping -c N" in a script,
expecting it to return at some point, you can now effectively have
your script hang.  Which, of course, is what happened to me.

While I'm sure there are good reasons for the change, I wonder:

a) If it wouldn't be a good idea to leave the "-c" option with
   the old meaning, and have a new option for the new behaviour

b) If you don't restore the old meaning, a lot of people who
   depend on ping to return when using the "-c" option will
   get burned when they upgrade to current.


Now, if I'm the only one affected, I can certainly work around
this new behaviour.  But, I wonder if there aren't others in the
same boat.






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707251537.KAA28194>