Clean up.

This commit is contained in:
Chris Johns 2016-01-23 14:24:00 +11:00 committed by Amar Takhar
parent fabe6d020f
commit bcfdcef840

View File

@ -1,3 +1,7 @@
.. COMMENT: COPYRIGHT (c) 1988-2008.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.
Network Commands Network Commands
################ ################
@ -6,37 +10,38 @@ Introduction
The RTEMS shell has the following network commands: The RTEMS shell has the following network commands:
- ``netstats`` - obtain network statistics - netstats_ - obtain network statistics
- ``ifconfig`` - configure a network interface - ifconfig_ - configure a network interface
- ``route`` - show or manipulate the IP routing table - route_ - show or manipulate the IP routing table
- ``ping`` - ping a host or IP address - ping_ - ping a host or IP address
Commands Commands
======== ========
This section details the Network Commands available. A This section details the Network Commands available. A subsection is dedicated
subsection is dedicated to each of the commands and to each of the commands and describes the behavior and configuration of that
describes the behavior and configuration of that
command as well as providing an example usage. command as well as providing an example usage.
.. _netstats:
netstats - obtain network statistics netstats - obtain network statistics
------------------------------------ ------------------------------------
.. index:: netstats .. index:: netstats
**SYNOPSYS:** **SYNOPSYS:**
.. code:: c .. code:: shell
netstats \[-Aimfpcut] netstats [-Aimfpcut]
**DESCRIPTION:** **DESCRIPTION:**
This command is used to display various types of network statistics. The This command is used to display various types of network statistics. The
information displayed can be specified using command line arguments in information displayed can be specified using command line arguments in various
various combinations. The arguments are interpreted as follows: combinations. The arguments are interpreted as follows:
*-A* *-A*
print All statistics print All statistics
@ -72,11 +77,10 @@ NONE
**EXAMPLES:** **EXAMPLES:**
The following is an example of how to use ``netstats``: The following is an example of using the ``netstats`` command to print the IP
routing table:
The following is an example of using the ``netstats`` .. code:: shell
command to print the IP routing table:
.. code:: c
[/] $ netstats -i [/] $ netstats -i
Destination Gateway/Mask/Hw Flags Refs Use Expire Interface Destination Gateway/Mask/Hw Flags Refs Use Expire Interface
@ -86,12 +90,13 @@ command to print the IP routing table:
192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 840 1202 eth1 192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 840 1202 eth1
192.168.1.151 00:1C:23:B2:0F:BB UHL 1 23 1219 eth1 192.168.1.151 00:1C:23:B2:0F:BB UHL 1 23 1219 eth1
The following is an example of using the ``netstats`` The following is an example of using the ``netstats`` command to print the MBUF
command to print the MBUF statistics: statistics:
.. code:: c
.. code:: shell
[/] $ netstats -m [/] $ netstats -m
\************ MBUF STATISTICS \************ ************ MBUF STATISTICS ************
mbufs:2048 clusters: 128 free: 63 mbufs:2048 clusters: 128 free: 63
drops: 0 waits: 0 drains: 0 drops: 0 waits: 0 drains: 0
free:1967 data:79 header:2 socket:0 free:1967 data:79 header:2 socket:0
@ -99,13 +104,14 @@ command to print the MBUF statistics:
soname:0 soopts:0 ftable:0 rights:0 soname:0 soopts:0 ftable:0 rights:0
ifaddr:0 control:0 oobdata:0 ifaddr:0 control:0 oobdata:0
The following is an example of using the ``netstats`` The following is an example of using the ``netstats`` command to print the
command to print the print the interface statistics: print the interface statistics:
.. code:: c
.. code:: shell
[/] $ netstats -f [/] $ netstats -f
\************ INTERFACE STATISTICS \************ ************ INTERFACE STATISTICS ************
\***** eth1 \***** ***** eth1 *****
Ethernet Address: 00:04:9F:00:5B:21 Ethernet Address: 00:04:9F:00:5B:21
Address:192.168.1.244 Broadcast Address:192.168.1.255 Net mask:255.255.255.0 Address:192.168.1.244 Broadcast Address:192.168.1.255 Net mask:255.255.255.0
Flags: Up Broadcast Running Active Multicast Flags: Up Broadcast Running Active Multicast
@ -116,40 +122,44 @@ command to print the print the interface statistics:
Tx Interrupts:867 Deferred:0 Late Collision:0 Tx Interrupts:867 Deferred:0 Late Collision:0
Retransmit Limit:0 Underrun:0 Misaligned:0 Retransmit Limit:0 Underrun:0 Misaligned:0
The following is an example of using the ``netstats`` The following is an example of using the ``netstats`` command to print the
command to print the print IP statistics: print IP statistics:
.. code:: c
.. code:: shell
[/] $ netstats -p [/] $ netstats -p
\************ IP Statistics \************ ************ IP Statistics ************
total packets received 894 total packets received 894
packets rcvd for unreachable dest 13 packets rcvd for unreachable dest 13
datagrams delivered to upper level 881 datagrams delivered to upper level 881
total ip packets generated here 871 total ip packets generated here 871
The following is an example of using the ``netstats`` The following is an example of using the ``netstats`` command to print the ICMP
command to print the ICMP statistics: statistics:
.. code:: c
.. code:: shell
[/] $ netstats -c [/] $ netstats -c
\************ ICMP Statistics \************ ************ ICMP Statistics ************
Type 0 sent 843 Type 0 sent 843
number of responses 843 number of responses 843
Type 8 received 843 Type 8 received 843
The following is an example of using the ``netstats`` The following is an example of using the ``netstats`` command to print the UDP
command to print the UDP statistics: statistics:
.. code:: c
.. code:: shell
[/] $ netstats -u [/] $ netstats -u
\************ UDP Statistics \************ ************ UDP Statistics ************
The following is an example of using the ``netstats`` The following is an example of using the ``netstats`` command to print the TCP
command to print the TCP statistics: statistics:
.. code:: c
.. code:: shell
[/] $ netstats -t [/] $ netstats -t
\************ TCP Statistics \************ ************ TCP Statistics ************
connections accepted 1 connections accepted 1
connections established 1 connections established 1
segs where we tried to get rtt 34 segs where we tried to get rtt 34
@ -172,13 +182,13 @@ command to print the TCP statistics:
.. index:: CONFIGURE_SHELL_NO_COMMAND_NETSTATS .. index:: CONFIGURE_SHELL_NO_COMMAND_NETSTATS
.. index:: CONFIGURE_SHELL_COMMAND_NETSTATS .. index:: CONFIGURE_SHELL_COMMAND_NETSTATS
This command is included in the default shell command set. This command is included in the default shell command set. When building a
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_NETSTATS`` to have this custom command set, define ``CONFIGURE_SHELL_COMMAND_NETSTATS`` to have this
command included. command included.
This command can be excluded from the shell command set by This command can be excluded from the shell command set by defining
defining ``CONFIGURE_SHELL_NO_COMMAND_NETSTATS`` when all ``CONFIGURE_SHELL_NO_COMMAND_NETSTATS`` when all shell commands have been
shell commands have been configured. configured.
**PROGRAMMING INFORMATION:** **PROGRAMMING INFORMATION:**
@ -186,26 +196,29 @@ shell commands have been configured.
The ``netstats`` is implemented by a C language function The ``netstats`` is implemented by a C language function
which has the following prototype: which has the following prototype:
.. code:: c .. code:: c
int rtems_shell_rtems_main_netstats( int rtems_shell_rtems_main_netstats(
int argc, int argc,
char \**argv char **argv
); );
The configuration structure for the ``netstats`` has the The configuration structure for the ``netstats`` has the following prototype:
following prototype:
.. code:: c .. code:: c
extern rtems_shell_cmd_t rtems_shell_NETSTATS_Command; extern rtems_shell_cmd_t rtems_shell_NETSTATS_Command;
.. _ifconfig:
ifconfig - configure a network interface ifconfig - configure a network interface
---------------------------------------- ----------------------------------------
.. index:: ifconfig .. index:: ifconfig
**SYNOPSYS:** **SYNOPSYS:**
.. code:: c .. code:: shell
ifconfig ifconfig
ifconfig interface ifconfig interface
@ -214,8 +227,8 @@ ifconfig - configure a network interface
**DESCRIPTION:** **DESCRIPTION:**
This command may be used to display information about the This command may be used to display information about the network interfaces in
network interfaces in the system or configure them. the system or configure them.
**EXIT STATUS:** **EXIT STATUS:**
@ -223,16 +236,17 @@ This command returns 0 on success and non-zero if an error is encountered.
**NOTES:** **NOTES:**
Just like its counterpart on GNU/Linux and BSD systems, this command Just like its counterpart on GNU/Linux and BSD systems, this command is
is complicated. More example usages would be a welcome submission. complicated. More example usages would be a welcome submission.
**EXAMPLES:** **EXAMPLES:**
The following is an example of how to use ``ifconfig``: The following is an example of how to use ``ifconfig``:
.. code:: c
************ INTERFACE STATISTICS \************ .. code:: shell
\***** eth1 \*****
************ INTERFACE STATISTICS ************
***** eth1 *****
Ethernet Address: 00:04:9F:00:5B:21 Ethernet Address: 00:04:9F:00:5B:21
Address:192.168.1.244 Broadcast Address:192.168.1.255 Net mask:255.255.255.0 Address:192.168.1.244 Broadcast Address:192.168.1.255 Net mask:255.255.255.0
Flags: Up Broadcast Running Active Multicast Flags: Up Broadcast Running Active Multicast
@ -248,55 +262,59 @@ The following is an example of how to use ``ifconfig``:
.. index:: CONFIGURE_SHELL_NO_COMMAND_IFCONFIG .. index:: CONFIGURE_SHELL_NO_COMMAND_IFCONFIG
.. index:: CONFIGURE_SHELL_COMMAND_IFCONFIG .. index:: CONFIGURE_SHELL_COMMAND_IFCONFIG
This command is included in the default shell command set. This command is included in the default shell command set. When building a
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_IFCONFIG`` to have this custom command set, define ``CONFIGURE_SHELL_COMMAND_IFCONFIG`` to have this
command included. command included.
This command can be excluded from the shell command set by This command can be excluded from the shell command set by defining
defining ``CONFIGURE_SHELL_NO_COMMAND_IFCONFIG`` when all ``CONFIGURE_SHELL_NO_COMMAND_IFCONFIG`` when all shell commands have been
shell commands have been configured. configured.
**PROGRAMMING INFORMATION:** **PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_ifconfig .. index:: rtems_shell_rtems_main_ifconfig
The ``ifconfig`` is implemented by a C language function The ``ifconfig`` is implemented by a C language function which has the
which has the following prototype: following prototype:
.. code:: c .. code:: c
int rtems_shell_rtems_main_ifconfig( int rtems_shell_rtems_main_ifconfig(
int argc, int argc,
char \**argv char **argv
); );
The configuration structure for the ``ifconfig`` has the The configuration structure for the ``ifconfig`` has the following prototype:
following prototype:
.. code:: c .. code:: c
extern rtems_shell_cmd_t rtems_shell_IFCONFIG_Command; extern rtems_shell_cmd_t rtems_shell_IFCONFIG_Command;
.. _route:
route - show or manipulate the ip routing table route - show or manipulate the ip routing table
----------------------------------------------- -----------------------------------------------
.. index:: route .. index:: route
**SYNOPSYS:** **SYNOPSYS:**
.. code:: c .. code:: shell
route \[subcommand] \[args] route [subcommand] [args]
**DESCRIPTION:** **DESCRIPTION:**
This command is used to display and manipulate the routing table. This command is used to display and manipulate the routing table. When invoked
When invoked with no arguments, the current routing information is with no arguments, the current routing information is displayed. When invoked
displayed. When invoked with the subcommands ``add`` or ``del``, with the subcommands ``add`` or ``del``, then additional arguments must be
then additional arguments must be provided to describe the route. provided to describe the route.
Command templates include the following: Command templates include the following:
.. code:: c
route \[add|del] -net IP_ADDRESS gw GATEWAY_ADDRESS \[netmask MASK] .. code:: shell
route \[add|del] -host IP_ADDRESS gw GATEWAY_ADDRES \[netmask MASK]
route [add|del] -net IP_ADDRESS gw GATEWAY_ADDRESS [netmask MASK]
route [add|del] -host IP_ADDRESS gw GATEWAY_ADDRES [netmask MASK]
When not provided the netmask defaults to ``255.255.255.0`` When not provided the netmask defaults to ``255.255.255.0``
@ -306,13 +324,14 @@ This command returns 0 on success and non-zero if an error is encountered.
**NOTES:** **NOTES:**
Just like its counterpart on GNU/Linux and BSD systems, this command Just like its counterpart on GNU/Linux and BSD systems, this command is
is complicated. More example usages would be a welcome submission. complicated. More example usages would be a welcome submission.
**EXAMPLES:** **EXAMPLES:**
The following is an example of how to use ``route`` to display, The following is an example of how to use ``route`` to display, add, and delete
add, and delete a new route: a new route:
.. code:: c .. code:: c
[/] $ route [/] $ route
@ -322,8 +341,8 @@ add, and delete a new route:
192.168.1.14 00:A0:C8:1C:EE:28 UHL 1 0 1444 eth1 192.168.1.14 00:A0:C8:1C:EE:28 UHL 1 0 1444 eth1
192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 10844 1202 eth1 192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 10844 1202 eth1
192.168.1.151 00:1C:23:B2:0F:BB UHL 2 37 1399 eth1 192.168.1.151 00:1C:23:B2:0F:BB UHL 2 37 1399 eth1
\[/] $ route add -net 192.168.3.0 gw 192.168.1.14 [/] $ route add -net 192.168.3.0 gw 192.168.1.14
\[/] $ route [/] $ route
Destination Gateway/Mask/Hw Flags Refs Use Expire Interface Destination Gateway/Mask/Hw Flags Refs Use Expire Interface
default 192.168.1.14 UGS 0 0 0 eth1 default 192.168.1.14 UGS 0 0 0 eth1
192.168.1.0 255.255.255.0 U 0 0 1 eth1 192.168.1.0 255.255.255.0 U 0 0 1 eth1
@ -331,8 +350,8 @@ add, and delete a new route:
192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 14937 1202 eth1 192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 14937 1202 eth1
192.168.1.151 00:1C:23:B2:0F:BB UHL 2 96 1399 eth1 192.168.1.151 00:1C:23:B2:0F:BB UHL 2 96 1399 eth1
192.168.3.0 192.168.1.14 UGS 0 0 0 eth1 192.168.3.0 192.168.1.14 UGS 0 0 0 eth1
\[/] $ route del -net 192.168.3.0 gw 192.168.1.14 [/] $ route del -net 192.168.3.0 gw 192.168.1.14
\[/] $ route [/] $ route
Destination Gateway/Mask/Hw Flags Refs Use Expire Interface Destination Gateway/Mask/Hw Flags Refs Use Expire Interface
default 192.168.1.14 UGS 0 0 0 eth1 default 192.168.1.14 UGS 0 0 0 eth1
192.168.1.0 255.255.255.0 U 0 0 1 eth1 192.168.1.0 255.255.255.0 U 0 0 1 eth1
@ -345,76 +364,78 @@ add, and delete a new route:
.. index:: CONFIGURE_SHELL_NO_COMMAND_ROUTE .. index:: CONFIGURE_SHELL_NO_COMMAND_ROUTE
.. index:: CONFIGURE_SHELL_COMMAND_ROUTE .. index:: CONFIGURE_SHELL_COMMAND_ROUTE
This command is included in the default shell command set. This command is included in the default shell command set. When building a
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_ROUTE`` to have this custom command set, define ``CONFIGURE_SHELL_COMMAND_ROUTE`` to have this
command included. command included.
This command can be excluded from the shell command set by This command can be excluded from the shell command set by defining
defining ``CONFIGURE_SHELL_NO_COMMAND_ROUTE`` when all ``CONFIGURE_SHELL_NO_COMMAND_ROUTE`` when all shell commands have been
shell commands have been configured. configured.
**PROGRAMMING INFORMATION:** **PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_route .. index:: rtems_shell_rtems_main_route
The ``route`` is implemented by a C language function The ``route`` is implemented by a C language function which has the following
which has the following prototype: prototype:
.. code:: c .. code:: c
int rtems_shell_rtems_main_route( int rtems_shell_rtems_main_route(
int argc, int argc,
char \**argv char **argv
); );
The configuration structure for the ``route`` has the The configuration structure for the ``route`` has the following prototype:
following prototype:
.. code:: c .. code:: c
extern rtems_shell_cmd_t rtems_shell_ROUTE_Command; extern rtems_shell_cmd_t rtems_shell_ROUTE_Command;
.. _ping:
ping - ping a host or IP address ping - ping a host or IP address
-------------------------------- --------------------------------
.. index:: ping .. index:: ping
**SYNOPSYS:** **SYNOPSYS:**
.. code:: c .. code:: shell
ping \[-AaDdfnoQqRrv] \[-c count] \[-G sweepmaxsize] \[-g sweepminsize] ping [-AaDdfnoQqRrv] [-c count] [-G sweepmaxsize] [-g sweepminsize]
\[-h sweepincrsize] \[-i wait] \[-l preload] \[-M mask | time] \[-m ttl] [-h sweepincrsize] [-i wait] [-l preload] [-M mask | time] [-m ttl]
\[-p pattern] \[-S src_addr] \[-s packetsize] \[-t timeout] [-p pattern] [-S src_addr] [-s packetsize] [-t timeout]
\[-W waittime] \[-z tos] host [-W waittime] [-z tos] host
ping \[-AaDdfLnoQqRrv] \[-c count] \[-I iface] \[-i wait] \[-l preload] ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]
\[-M mask | time] \[-m ttl] \[-p pattern] \[-S src_addr] [-M mask | time] [-m ttl] [-p pattern] [-S src_addr]
\[-s packetsize] \[-T ttl] \[-t timeout] \[-W waittime] [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
\[-z tos] mcast-group [-z tos] mcast-group
**DESCRIPTION:** **DESCRIPTION:**
The ping utility uses the ICMP protocol's mandatory ECHO_REQUEST The ping utility uses the ICMP protocol's mandatory ECHO_REQUEST datagram to
datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway. elicit an ICMP ECHO_RESPONSE from a host or gateway. ECHO_REQUEST datagrams
ECHO_REQUEST datagrams ("pings") have an IP and ICMP header, ("pings") have an IP and ICMP header, followed by a "struct timeval" and then
followed by a "struct timeval" and then an arbitrary number of an arbitrary number of "pad" bytes used to fill out the packet. The options
"pad" bytes used to fill out the packet. The options are as are as follows:
follows:
*-A* *-A*
Audible. Output a bell (ASCII 0x07) character when no packet is Audible. Output a bell (ASCII 0x07) character when no packet is received
received before the next packet is transmitted. To cater for before the next packet is transmitted. To cater for round-trip times that
round-trip times that are longer than the interval between are longer than the interval between transmissions, further missing packets
transmissions, further missing packets cause a bell only if the cause a bell only if the maximum number of unreceived packets has
maximum number of unreceived packets has increased. increased.
*-a* *-a*
Audible. Include a bell (ASCII 0x07) character in the output when any Audible. Include a bell (ASCII 0x07) character in the output when any
packet is received. This option is ignored if other format options packet is received. This option is ignored if other format options are
are present. present.
*-c count* *-c count*
Stop after sending (and receiving) count ECHO_RESPONSE packets. If Stop after sending (and receiving) count ECHO_RESPONSE packets. If this
this option is not specified, ping will operate until interrupted. If option is not specified, ping will operate until interrupted. If this
this option is specified in conjunction with ping sweeps, each sweep option is specified in conjunction with ping sweeps, each sweep will
will consist of count packets. consist of count packets.
*-D* *-D*
Set the Don't Fragment bit. Set the Don't Fragment bit.
@ -423,126 +444,123 @@ follows:
Set the SO_DEBUG option on the socket being used. Set the SO_DEBUG option on the socket being used.
*-f* *-f*
Flood ping. Outputs packets as fast as they come back or one Flood ping. Outputs packets as fast as they come back or one hundred times
hundred times per second, whichever is more. For every ECHO_REQUEST per second, whichever is more. For every ECHO_REQUEST sent a period "." is
sent a period "." is printed, while for every ECHO_REPLY received a printed, while for every ECHO_REPLY received a backspace is printed. This
backspace is printed. This provides a rapid display of how many provides a rapid display of how many packets are being dropped. Only the
packets are being dropped. Only the super-user may use this option. super-user may use this option. This can be very hard on a network and
This can be very hard on a network and should be used with caution. should be used with caution.
*-G sweepmaxsize* *-G sweepmaxsize*
Specify the maximum size of ICMP payload when sending sweeping pings. Specify the maximum size of ICMP payload when sending sweeping pings. This
This option is required for ping sweeps. option is required for ping sweeps.
*-g sweepminsize* *-g sweepminsize*
Specify the size of ICMP payload to start with when sending sweeping Specify the size of ICMP payload to start with when sending sweeping pings.
pings. The default value is 0. The default value is 0.
*-h sweepincrsize* *-h sweepincrsize*
Specify the number of bytes to increment the size of ICMP payload Specify the number of bytes to increment the size of ICMP payload after
after each sweep when sending sweeping pings. The default value is 1. each sweep when sending sweeping pings. The default value is 1.
*-I iface* *-I iface*
Source multicast packets with the given interface address. This flag Source multicast packets with the given interface address. This flag only
only applies if the ping destination is a multicast address. applies if the ping destination is a multicast address.
*-i wait* *-i wait*
Wait wait seconds between sending each packet. The default is to wait Wait wait seconds between sending each packet. The default is to wait for
for one second between each packet. The wait time may be fractional, one second between each packet. The wait time may be fractional, but only
but only the super-user may specify values less than 1 second. This the super-user may specify values less than 1 second. This option is
option is incompatible with the -f option. incompatible with the -f option.
*-L* *-L*
Suppress loopback of multicast packets. This flag only applies if the Suppress loopback of multicast packets. This flag only applies if the ping
ping destination is a multicast address. destination is a multicast address.
*-l preload* *-l preload*
If preload is specified, ping sends that many packets as fast as If preload is specified, ping sends that many packets as fast as possible
possible before falling into its normal mode of behavior. Only the before falling into its normal mode of behavior. Only the super-user may
super-user may use this option. use this option.
*-M mask | time* *-M mask | time*
Use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO. For mask, print Use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO. For mask, print the
the netmask of the remote machine. Set the net.inet.icmp.maskrepl MIB netmask of the remote machine. Set the net.inet.icmp.maskrepl MIB variable
variable to enable ICMP_MASKREPLY. For time, print the origination, to enable ICMP_MASKREPLY. For time, print the origination, reception and
reception and transmission timestamps. transmission timestamps.
*-m ttl* *-m ttl*
Set the IP Time To Live for outgoing packets. If not specified, the Set the IP Time To Live for outgoing packets. If not specified, the kernel
kernel uses the value of the net.inet.ip.ttl MIB variable. uses the value of the net.inet.ip.ttl MIB variable.
*-n* *-n*
Numeric output only. No attempt will be made to lookup symbolic names Numeric output only. No attempt will be made to lookup symbolic names for
for host addresses. host addresses.
*-o* *-o*
Exit successfully after receiving one reply packet. Exit successfully after receiving one reply packet.
*-p pattern* *-p pattern*
You may specify up to 16 "pad" bytes to fill out the packet you You may specify up to 16 "pad" bytes to fill out the packet you send. This
send. This is useful for diagnosing data-dependent problems in a is useful for diagnosing data-dependent problems in a network. For
network. For example, "-p ff" will cause the sent packet to be example, "-p ff" will cause the sent packet to be filled with all ones.
filled with all ones.
*-Q* *-Q*
Somewhat quiet output. Don't display ICMP error messages that are in Somewhat quiet output. Don't display ICMP error messages that are in
response to our query messages. Originally, the -v flag was required response to our query messages. Originally, the -v flag was required to
to display such errors, but -v displays all ICMP error messages. On a display such errors, but -v displays all ICMP error messages. On a busy
busy machine, this output can be overbear- ing. Without the -Q flag, machine, this output can be overbear- ing. Without the -Q flag, ping
ping prints out any ICMP error mes- sages caused by its own prints out any ICMP error mes- sages caused by its own ECHO_REQUEST
ECHO_REQUEST messages. messages.
*-q* *-q*
Quiet output. Nothing is displayed except the summary lines at Quiet output. Nothing is displayed except the summary lines at startup
startup time and when finished. time and when finished.
*-R* *-R*
Record route. Includes the RECORD_ROUTE option in the ECHO_REQUEST Record route. Includes the RECORD_ROUTE option in the ECHO_REQUEST packet
packet and displays the route buffer on returned packets. Note that and displays the route buffer on returned packets. Note that the IP header
the IP header is only large enough for nine such routes; the is only large enough for nine such routes; the traceroute(8) command is
traceroute(8) command is usually better at determining the route usually better at determining the route packets take to a particular
packets take to a particular destination. If more routes come back destination. If more routes come back than should, such as due to an
than should, such as due to an illegal spoofed packet, ping will print illegal spoofed packet, ping will print the route list and then truncate it
the route list and then truncate it at the correct spot. Many hosts at the correct spot. Many hosts ignore or discard the RECORD_ROUTE option.
ignore or discard the RECORD_ROUTE option.
*-r* *-r*
Bypass the normal routing tables and send directly to a host on an Bypass the normal routing tables and send directly to a host on an attached
attached network. If the host is not on a directly-attached network, network. If the host is not on a directly-attached network, an error is
an error is returned. This option can be used to ping a local host returned. This option can be used to ping a local host through an
through an interface that has no route through it (e.g., after the interface that has no route through it (e.g., after the interface was
interface was dropped). dropped).
*-S src_addr* *-S src_addr*
Use the following IP address as the source address in outgoing Use the following IP address as the source address in outgoing packets. On
packets. On hosts with more than one IP address, this option can be hosts with more than one IP address, this option can be used to force the
used to force the source address to be something other than the IP source address to be something other than the IP address of the interface
address of the interface the probe packet is sent on. If the IP the probe packet is sent on. If the IP address is not one of this
address is not one of this machine's interface addresses, an error is machine's interface addresses, an error is returned and nothing is sent.
returned and nothing is sent.
*-s packetsize* *-s packetsize*
Specify the number of data bytes to be sent. The default is 56, which Specify the number of data bytes to be sent. The default is 56, which
translates into 64 ICMP data bytes when combined with the 8 bytes of translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP
ICMP header data. Only the super-user may specify val- ues more than header data. Only the super-user may specify val- ues more than default.
default. This option cannot be used with ping sweeps. This option cannot be used with ping sweeps.
*-T ttl* *-T ttl*
Set the IP Time To Live for multicasted packets. This flag only Set the IP Time To Live for multicasted packets. This flag only applies if
applies if the ping destination is a multicast address. the ping destination is a multicast address.
*-t timeout* *-t timeout*
Specify a timeout, in seconds, before ping exits regardless of how Specify a timeout, in seconds, before ping exits regardless of how many
many packets have been received. packets have been received.
*-v* *-v*
Verbose output. ICMP packets other than ECHO_RESPONSE that are Verbose output. ICMP packets other than ECHO_RESPONSE that are received
received are listed. are listed.
*-W waittime* *-W waittime*
Time in milliseconds to wait for a reply for each packet sent. If a Time in milliseconds to wait for a reply for each packet sent. If a reply
reply arrives later, the packet is not printed as replied, but arrives later, the packet is not printed as replied, but considered as
considered as replied when calculating statistics. replied when calculating statistics.
*-z tos* *-z tos*
Use the specified type of service. Use the specified type of service.
@ -556,31 +574,32 @@ The ping utility exits with one of the following values:
2 The transmission was successful but no responses were 2 The transmission was successful but no responses were
received. received.
any other value an error occurred. These values are defined in any other value an error occurred. These values are defined in <sysexits.h>.
<sysexits.h>.
**NOTES:** **NOTES:**
When using ping for fault isolation, it should first be run on the When using ping for fault isolation, it should first be run on the local host,
local host, to verify that the local network interface is up and to verify that the local network interface is up and running. Then, hosts and
running. Then, hosts and gateways further and further away should be gateways further and further away should be "pinged". Round-trip times and
"pinged". Round-trip times and packet loss statistics are computed. packet loss statistics are computed. If duplicate packets are received, they
If duplicate packets are received, they are not included in the packet are not included in the packet loss calculation, although the round trip time
loss calculation, although the round trip time of these packets is of these packets is used in calculating the round-trip time statistics. When
used in calculating the round-trip time statistics. When the the specified number of packets have been sent a brief summary is displayed,
specified number of packets have been sent a brief summary is showing the number of packets sent and received, and the minimum, mean,
displayed, showing the number of packets sent and received, and the maximum, and standard deviation of the round-trip times.
minimum, mean, maximum, and standard deviation of the round-trip
times.
This program is intended for use in network testing, measurement and This program is intended for use in network testing, measurement and
management. Because of the load it can impose on the network, it is management. Because of the load it can impose on the network, it is unwise to
unwise to use ping during normal operations or from automated scripts. use ping during normal operations or from automated scripts.
This command can fail if more than the FD_SET size number of file descriptors
are open.
**EXAMPLES:** **EXAMPLES:**
The following is an example of how to use ``oing`` to ping: The following is an example of how to use ``oing`` to ping:
.. code:: c
.. code:: shell
[/] # ping 10.10.10.1 [/] # ping 10.10.10.1
PING 10.10.10.1 (10.10.10.1): 56 data bytes PING 10.10.10.1 (10.10.10.1): 56 data bytes
@ -592,7 +611,7 @@ The following is an example of how to use ``oing`` to ping:
--- 10.10.10.1 ping statistics --- --- 10.10.10.1 ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss 5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.229/0.256/0.356/0.050 ms round-trip min/avg/max/stddev = 0.229/0.256/0.356/0.050 ms
\[/] # ping -f -c 10000 10.10.10.1 [/] # ping -f -c 10000 10.10.10.1
PING 10.10.10.1 (10.10.10.1): 56 data bytes PING 10.10.10.1 (10.10.10.1): 56 data bytes
. .
--- 10.10.10.1 ping statistics --- --- 10.10.10.1 ping statistics ---
@ -604,29 +623,30 @@ The following is an example of how to use ``oing`` to ping:
.. index:: CONFIGURE_SHELL_NO_COMMAND_PING .. index:: CONFIGURE_SHELL_NO_COMMAND_PING
.. index:: CONFIGURE_SHELL_COMMAND_PING .. index:: CONFIGURE_SHELL_COMMAND_PING
This command is included in the default shell command set. This command is included in the default shell command set. When building a
When building a custom command set, define``CONFIGURE_SHELL_COMMAND_PING`` to have this custom command set, define ``CONFIGURE_SHELL_COMMAND_PING`` to have this
command included. command included.
This command can be excluded from the shell command set by This command can be excluded from the shell command set by defining
defining ``CONFIGURE_SHELL_NO_COMMAND_PING`` when all ``CONFIGURE_SHELL_NO_COMMAND_PING`` when all shell commands have been
shell commands have been configured. configured.
**PROGRAMMING INFORMATION:** **PROGRAMMING INFORMATION:**
.. index:: rtems_shell_rtems_main_ping .. index:: rtems_shell_rtems_main_ping
The ``ping`` is implemented by a C language function The ``ping`` is implemented by a C language function which has the following
which has the following prototype: prototype:
.. code:: c .. code:: c
int rtems_shell_rtems_main_ping( int rtems_shell_rtems_main_ping(
int argc, int argc,
char \**argv char **argv
); );
The configuration structure for the ``ping`` has the The configuration structure for the ``ping`` has the following prototype:
following prototype:
.. code:: c .. code:: c
extern rtems_shell_cmd_t rtems_shell_PING_Command; extern rtems_shell_cmd_t rtems_shell_PING_Command;