+.\" Copyright (c) 2015 Apple Inc. All rights reserved.
+.\"
+.\" @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+.\"
+.\" This file contains Original Code and/or Modifications of Original Code
+.\" as defined in and that are subject to the Apple Public Source License
+.\" Version 2.0 (the 'License'). You may not use this file except in
+.\" compliance with the License. The rights granted to you under the License
+.\" may not be used to create, or enable the creation or redistribution of,
+.\" unlawful or unlicensed copies of an Apple operating system, or to
+.\" circumvent, violate, or enable the circumvention or violation of, any
+.\" terms of an Apple operating system software license agreement.
+.\"
+.\" Please obtain a copy of the License at
+.\" http://www.opensource.apple.com/apsl/ and read it before using this file.
+.\"
+.\" The Original Code and all software distributed under the License are
+.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+.\" Please see the License for the specific language governing rights and
+.\" limitations under the License.
+.\"
+.\" @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+.\"
.\" Copyright (c) 1983, 1990, 1992, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.Op Fl f Ar address_family | Fl p Ar protocol
.Nm
.Op Fl gilns
+.Op Fl v
.Op Fl f Ar address_family
+.Op Fl I Ar interface
.Nm
.Fl i | I Ar interface
.Op Fl w Ar wait
-.Op Fl abdgt
+.Op Fl c Ar queue
+.Op Fl abdgqRtS
.Nm
.Fl s Op Fl s
.Op Fl f Ar address_family | Fl p Ar protocol
.Bl -tag -width flag
.It Fl A
With the default display, show the address of any protocol control blocks associated with
-sockets; used for debugging.
+sockets and the flow hash; used for debugging.
.It Fl a
With the default display, show the state of all sockets; normally sockets used by server
processes are not shown. With the routing table display (option
With the interface display (option
.Fl i ,
as described below), show the number of bytes in and out.
+.It Fl c Ar queue
+With the queue statistics (option
+.Fl q ,
+as described below), show only those for the specified
+.Ar queue .
.It Fl d
With either interface display (option
.Fl i
for
.Dv AF_UNIX .
.It Fl g
-Show information related to multicast (group address) routing. By default, show the
-IP Multicast virtual-interface and routing tables. If the
+Show information related to multicast (group address) membership. If the
.Fl s
-option is also present, show multicast routing statistics.
+option is also present, show extended interface group management statistics. If the
+.Fl v
+option is specified, show link-layer memberships; they are suppressed by default.
+Source lists for each group will also be printed. Specifiying
+.Fl v
+twice will print the control plane timers for each interface and the source list counters
+for each group. If the
+.Fl i
+is specified, only that interface will be shown. If the
+.Fl f
+is specified, only information for the address family will be displayed.
.It Fl I Ar interface
Show information about the specified interface; used with a
.Ar wait
no interesting numbers to report. The program will complain if
.Ar protocol
is unknown or if there is no statistics routine for it.
+.It Fl q
+Show network interface send queue statistics. By default all queues are displayed, unless
+specified with
+.Fl c .
+This option requires specifying an interface with
+.Fl I
+option. More detailed information about the queues, which includes their queueing algorithm related statistics, can be obtained by using
+.Fl qq
+or
+.Fl q
+.Fl q
+option.
.It Fl r
Show the routing tables. Use with
.Fl a
.Fl l
is also present,
.Nm
-assumes more columns are there and the maximum transmission unit
+assumes more columns are there and the maximum transmission unit.
+More detailed information about the route metrics are displayed with
+.Fl ll
+for TCP round trip times
+.Fl lll
+for all metrics.
+Use the
+.Fl z
+flags to display only entries with non-zero RTT values.
.Pq Dq mtu
are also displayed.
+.It Fl R
+Show reachability information. Use with
+.Fl i
+to show link-layer reachability information for a given interface.
.It Fl s
Show per-protocol statistics. If this option is repeated, counters with a value of
-zero are suppressed.
+zero are suppressed. For security reasons, root privileges are required to read TCP statistics and in the absence of such privileges all TCP counters will be reported as zero.
+.It Fl S
+Show interface link status and interface state information about the specified interface. This option requires specifying an interface with
+.Fl I
+option.
+.It Fl v
+Increase verbosity level.
.It Fl W
In certain displays, avoid truncating addresses even if this causes some fields to
overflow.
Show network interface or protocol statistics at intervals of
.Ar wait
seconds.
+.It Fl x
+Show extended link-layer reachability information in addition to that shown by
+the
+.Fl R
+flag.
.El
.Pp
.\"-------------------------------------------------------------------------------
D RTF_DYNAMIC Created dynamically (by redirect)
G RTF_GATEWAY Destination requires forwarding by intermediary
H RTF_HOST Host entry (net otherwise)
+I RTF_IFSCOPE Route is associated with an interface scope
+i RTF_IFREF Route is holding a reference to the interface
L RTF_LLINFO Valid protocol to link address translation
M RTF_MODIFIED Modified dynamically (by redirect)
+m RTF_MULTICAST The route represents a multicast address
R RTF_REJECT Host or net unreachable
+r RTF_ROUTER Host is a default router
S RTF_STATIC Manually added
U RTF_UP Route usable
W RTF_WASCLONED Route was generated as a result of cloning
X RTF_XRESOLVE External daemon translates proto to link address
+Y RTF_PROXY Proxying; cloned routes will not be scoped
+g RTF_GLOBAL Route to a destination of the global internet (policy hint)
.El
.Pp
Direct routes are created for each interface attached to the local host;
obtain a route while sending to the same destination. The use field
provides a count of the number of packets sent using that route. The
interface entry indicates the network interface utilized for the route.
+A route which is marked with the RTF_IFSCOPE flag is instantiated for
+the corresponding interface. A cloning route which is marked with the
+RTF_PROXY flag will not generate new routes that are associated
+with its interface scope.
.Pp
When
.Nm netstat
.Fl I
option.
.Sh SEE ALSO
-.Xr fstat 1 ,
.Xr nfsstat 1 ,
.Xr ps 1 ,
-.Xr sockstat 1 ,
.Xr inet 4 ,
.Xr unix 4 ,
.Xr hosts 5 ,
.Xr networks 5 ,
.Xr protocols 5 ,
+.Xr route 8 ,
.Xr services 5 ,
.Xr iostat 8 ,
-.Xr trpt 8 ,
-.Xr vmstat 8
.Sh HISTORY
The
.Nm netstat