History log of /src/usr.bin/netstat/main.c (Results 1 – 25 of 657)
Revision Date Author Comments
# c2b08c13 23-Oct-2025 Michael Tuexen <tuexen@FreeBSD.org>

netstat: add support for UDP-Lite endpoints

With this patch UDP-Lite endpoints are also shown per default.

Reviewed by: Nick Banks
MFC after: 3 days
Differential Revision: https://reviews.freebsd

netstat: add support for UDP-Lite endpoints

With this patch UDP-Lite endpoints are also shown per default.

Reviewed by: Nick Banks
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D53252

show more ...


# 49f31b5e 20-Apr-2025 Kyle Evans <kevans@FreeBSD.org>

netstat: strip the binary of sgid

Everything in the live path seems to use sysctls these days, with kvm
only being used for pulling information from core dumps. Strip the
binary of /dev/{k,}mem acc

netstat: strip the binary of sgid

Everything in the live path seems to use sysctls these days, with kvm
only being used for pulling information from core dumps. Strip the
binary of /dev/{k,}mem access to reduce the surface area with access
to kmem.

Reviewed by: glebius, markj
Differential Revision: https://reviews.freebsd.org/D47210

show more ...


# c032fb85 03-Feb-2025 Ed Maste <emaste@FreeBSD.org>

netstat: Use bool more widely

Following c2aa91745e87 ("netstat: restore printing the "default"
keyword, provide -nn option"), consistently use bool where appropriate
for commandline flags.

Reviewed

netstat: Use bool more widely

Following c2aa91745e87 ("netstat: restore printing the "default"
keyword, provide -nn option"), consistently use bool where appropriate
for commandline flags.

Reviewed by: glebius
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48832

show more ...


# c2aa9174 03-Feb-2025 Gleb Smirnoff <glebius@FreeBSD.org>

netstat: restore printing the "default" keyword, provide -nn option

Avoid POLA breakage and preserve output standard that really predates
the FreeBSD project itself. There are scripts in the wild t

netstat: restore printing the "default" keyword, provide -nn option

Avoid POLA breakage and preserve output standard that really predates
the FreeBSD project itself. There are scripts in the wild that rely
on the behavior.

Provide option to specify -nn twice to have a completely numeric
output of the routing tables.

Fixes: 9206c79961986c2114a9a2cfccf009ac010ad259
This reverts commit e090646d6f5a4a6848ecd4bcb1f2db498ea3b3e2.

Reviewed by: zlei, gallatin, melifaro, allanjude, markj, emaste
Differential Revision: https://reviews.freebsd.org/D48729

show more ...


# f3a097d0 24-Oct-2024 Kyle Evans <kevans@FreeBSD.org>

netstat: switch to using the sysctl-exported stats for live stats

Now that we export the relevant stats via the net.route.stats sysctl,
switch to using that to avoid having to dig around in mem(4) f

netstat: switch to using the sysctl-exported stats for live stats

Now that we export the relevant stats via the net.route.stats sysctl,
switch to using that to avoid having to dig around in mem(4) for live
kernel statistics. Based on callers of kresolve_list(), this is the
last live path using mem(4) that could be functional today.

Tested both with `netstat -rs` and `netstat -rs -M`.

Note that this will not be able to extract stats from a running kernel
that predates 3360a15898 / 1500026, but this can be worked around by
specifying `-M /dev/mem` explicitly in the interim to fallback to
libkvm against /dev/mem.

Reviewed by: glebius, markj, zlei
Differential Revision: https://reviews.freebsd.org/D47231

show more ...


# 95968ea7 12-Oct-2024 Yan-Hao Wang <yanhaowang@FreeBSD.org>

netstat(1): Complete libxo transition

Reviewed by: des
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D41427


# 5c4f64bd 27-Aug-2024 Bram <bram@cbbg.nl>

netstat: Add version information to libxo output

Add version information to libxo output so that
libxo content consumers can track changes.

Reviewed by: imp, markj
Pull Request: https://github.com/

netstat: Add version information to libxo output

Add version information to libxo output so that
libxo content consumers can track changes.

Reviewed by: imp, markj
Pull Request: https://github.com/freebsd/freebsd-src/pull/1350

show more ...


# 5dea523b 06-Dec-2023 Kristof Provost <kp@FreeBSD.org>

pflow: netstat statistics

Expose pflow counters via netstat.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D43107


# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals.

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix

show more ...


# bdcbfde3 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a pe

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix

show more ...


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 182e8ae2 14-Aug-2023 Doug Rabson <dfr@FreeBSD.org>

netstat(1): teach netstat to attach to jails

Add -j <jail> flag to netstat(1) to allow access to network information
from a jail.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.or

netstat(1): teach netstat to attach to jails

Add -j <jail> flag to netstat(1) to allow access to network information
from a jail.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41446

show more ...


# 1a7ac2bd 07-Jul-2023 Alfonso Gregory <gfunni234@gmail.com>

Mark usage function as __dead2 in programs where it does not return

In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dea

Mark usage function as __dead2 in programs where it does not return

In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735

show more ...


# ddf24a50 20-Apr-2023 Michael Tuexen <tuexen@FreeBSD.org>

netstat: cleanup

protopr does not support reading from a core anymore.
So don't state that it can.

Reviewed by: glebius, rscheff, rrs
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential R

netstat: cleanup

protopr does not support reading from a core anymore.
So don't state that it can.

Reviewed by: glebius, rscheff, rrs
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D39688

show more ...


# 2b1c7217 30-Aug-2022 Gleb Smirnoff <glebius@FreeBSD.org>

divert(4): provide statistics

Instead of incrementing pretty random counters in the IP statistics,
create divert socket statistics structure. Export via netstat(1).

Differential revision: https://

divert(4): provide statistics

Instead of incrementing pretty random counters in the IP statistics,
create divert socket statistics structure. Export via netstat(1).

Differential revision: https://reviews.freebsd.org/D36381

show more ...


# 8624f434 30-Aug-2022 Gleb Smirnoff <glebius@FreeBSD.org>

divert: declare PF_DIVERT domain and stop abusing PF_INET

The divert(4) is not a protocol of IPv4. It is a socket to
intercept packets from ipfw(4) to userland and re-inject them
back. It can dive

divert: declare PF_DIVERT domain and stop abusing PF_INET

The divert(4) is not a protocol of IPv4. It is a socket to
intercept packets from ipfw(4) to userland and re-inject them
back. It can divert and re-inject IPv4 and IPv6 packets today,
but potentially it is not limited to these two protocols. The
IPPROTO_DIVERT does not belong to known IP protocols, it
doesn't even fit into u_char. I guess, the implementation of
divert(4) was done the way it is done basically because it was
easier to do it this way, back when protocols for sockets were
intertwined with IP protocols and domains were statically
compiled in.

Moving divert(4) out of inetsw accomplished two important things:

1) IPDIVERT is getting much closer to be not dependent on INET.
This will be finalized in following changes.
2) Now divert socket no longer aliases with raw IPv4 socket.
Domain/proto selection code won't need a hack for SOCK_RAW and
multiple entries in inetsw implementing different flavors of
raw socket can merge into one without requirement of raw IPv4
being the last member of dom_protosw.

Differential revision: https://reviews.freebsd.org/D36379

show more ...


# 0e5e35e3 09-Oct-2020 Richard Scheffenegger <rscheff@FreeBSD.org>

Extend netstat to display TCP stack and detailed congestion state

Adding the "-c" option used to show detailed per-connection
congestion control state for TCP sessions.

This is one summary patch, w

Extend netstat to display TCP stack and detailed congestion state

Adding the "-c" option used to show detailed per-connection
congestion control state for TCP sessions.

This is one summary patch, which adds the relevant variables into
xtcpcb. As previous "spare" space is used, these changes are ABI
compatible.

Reviewed by: tuexen
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26518

show more ...


# fedeb08b 03-Oct-2020 Alexander V. Chernikov <melifaro@FreeBSD.org>

Introduce scalable route multipath.

This change is based on the nexthop objects landed in D24232.

The change introduces the concept of nexthop groups.
Each group contains the collection of nexthops

Introduce scalable route multipath.

This change is based on the nexthop objects landed in D24232.

The change introduces the concept of nexthop groups.
Each group contains the collection of nexthops with their
relative weights and a dataplane-optimized structure to enable
efficient nexthop selection.

Simular to the nexthops, nexthop groups are immutable. Dataplane part
gets compiled during group creation and is basically an array of
nexthop pointers, compiled w.r.t their weights.

With this change, `rt_nhop` field of `struct rtentry` contains either
nexthop or nexthop group. They are distinguished by the presense of
NHF_MULTIPATH flag.
All dataplane lookup functions returns pointer to the nexthop object,
leaving nexhop groups details inside routing subsystem.

User-visible changes:

The change is intended to be backward-compatible: all non-mpath operations
should work as before with ROUTE_MPATH and net.route.multipath=1.

All routes now comes with weight, default weight is 1, maximum is 2^24-1.

Current maximum multipath group width is statically set to 64.
This will become sysctl-tunable in the followup changes.

Using functionality:
* Recompile kernel with ROUTE_MPATH
* set net.route.multipath to 1

route add -6 2001:db8::/32 2001:db8::2 -weight 10
route add -6 2001:db8::/32 2001:db8::3 -weight 20

netstat -6On

Nexthop groups data

Internet6:
GrpIdx NhIdx Weight Slots Gateway Netif Refcnt
1 ------- ------- ------- --------------------------------------- --------- 1
13 10 1 2001:db8::2 vlan2
14 20 2 2001:db8::3 vlan2

Next steps:
* Land outbound hashing for locally-originated routes ( D26523 ).
* Fix net/bird multipath (net/frr seems to work fine)
* Add ROUTE_MPATH to GENERIC
* Set net.route.multipath=1 by default

Tested by: olivier
Reviewed by: glebius
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D26449

show more ...


# b98a21f6 13-Sep-2020 Michael Tuexen <tuexen@FreeBSD.org>

Add a -C option to netstat to display the congestion control for
TCP connections.

Reviewed by: rscheff
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd

Add a -C option to netstat to display the congestion control for
TCP connections.

Reviewed by: rscheff
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D26414

show more ...


# a6663252 12-Apr-2020 Alexander V. Chernikov <melifaro@FreeBSD.org>

Introduce nexthop objects and new routing KPI.

This is the foundational change for the routing subsytem rearchitecture.
More details and goals are available in https://reviews.freebsd.org/D24141 .

Introduce nexthop objects and new routing KPI.

This is the foundational change for the routing subsytem rearchitecture.
More details and goals are available in https://reviews.freebsd.org/D24141 .

This patch introduces concept of nexthop objects and new nexthop-based
routing KPI.

Nexthops are objects, containing all necessary information for performing
the packet output decision. Output interface, mtu, flags, gw address goes
there. For most of the cases, these objects will serve the same role as
the struct rtentry is currently serving.
Typically there will be low tens of such objects for the router even with
multiple BGP full-views, as these objects will be shared between routing
entries. This allows to store more information in the nexthop.

New KPI:

struct nhop_object *fib4_lookup(uint32_t fibnum, struct in_addr dst,
uint32_t scopeid, uint32_t flags, uint32_t flowid);
struct nhop_object *fib6_lookup(uint32_t fibnum, const struct in6_addr *dst6,
uint32_t scopeid, uint32_t flags, uint32_t flowid);

These 2 function are intended to replace all all flavours of
<in_|in6_>rtalloc[1]<_ign><_fib>, mpath functions and the previous
fib[46]-generation functions.

Upon successful lookup, they return nexthop object which is guaranteed to
exist within current NET_EPOCH. If longer lifetime is desired, one can
specify NHR_REF as a flag and get a referenced version of the nexthop.
Reference semantic closely resembles rtentry one, allowing sed-style conversion.

Additionally, another 2 functions are introduced to support uRPF functionality
inside variety of our firewalls. Their primary goal is to hide the multipath
implementation details inside the routing subsystem, greatly simplifying
firewalls implementation:

int fib4_lookup_urpf(uint32_t fibnum, struct in_addr dst, uint32_t scopeid,
uint32_t flags, const struct ifnet *src_if);
int fib6_lookup_urpf(uint32_t fibnum, const struct in6_addr *dst6, uint32_t scopeid,
uint32_t flags, const struct ifnet *src_if);

All functions have a separate scopeid argument, paving way to eliminating IPv6 scope
embedding and allowing to support IPv4 link-locals in the future.

Structure changes:
* rtentry gets new 'rt_nhop' pointer, slightly growing the overall size.
* rib_head gets new 'rnh_preadd' callback pointer, slightly growing overall sz.

Old KPI:
During the transition state old and new KPI will coexists. As there are another 4-5
decent-sized conversion patches, it will probably take a couple of weeks.
To support both KPIs, fields not required by the new KPI (most of rtentry) has to be
kept, resulting in the temporary size increase.
Once conversion is finished, rtentry will notably shrink.

More details:
* architectural overview: https://reviews.freebsd.org/D24141
* list of the next changes: https://reviews.freebsd.org/D24232

Reviewed by: ae,glebius(initial version)
Differential Revision: https://reviews.freebsd.org/D24232

show more ...


# 2ccdd4b3 09-Dec-2019 Baptiste Daroussin <bapt@FreeBSD.org>

Fix: netstat -rs

Routing statistics requires somes symbols that are only loaded when not running
live. Load them only in that specific case

PR: 242423
Submitted by: olivier
MFC after: 3 days


# c2b08c13 23-Oct-2025 Michael Tuexen <tuexen@FreeBSD.org>

netstat: add support for UDP-Lite endpoints

With this patch UDP-Lite endpoints are also shown per default.

Reviewed by: Nick Banks
MFC after: 3 days
Differential Revision: https://reviews.freebsd

netstat: add support for UDP-Lite endpoints

With this patch UDP-Lite endpoints are also shown per default.

Reviewed by: Nick Banks
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D53252

show more ...


# 49f31b5e 20-Apr-2025 Kyle Evans <kevans@FreeBSD.org>

netstat: strip the binary of sgid

Everything in the live path seems to use sysctls these days, with kvm
only being used for pulling information from core dumps. Strip the
binary of /dev/{k,}mem acc

netstat: strip the binary of sgid

Everything in the live path seems to use sysctls these days, with kvm
only being used for pulling information from core dumps. Strip the
binary of /dev/{k,}mem access to reduce the surface area with access
to kmem.

Reviewed by: glebius, markj
Differential Revision: https://reviews.freebsd.org/D47210

show more ...


# c032fb85 03-Feb-2025 Ed Maste <emaste@FreeBSD.org>

netstat: Use bool more widely

Following c2aa91745e87 ("netstat: restore printing the "default"
keyword, provide -nn option"), consistently use bool where appropriate
for commandline flags.

Reviewed

netstat: Use bool more widely

Following c2aa91745e87 ("netstat: restore printing the "default"
keyword, provide -nn option"), consistently use bool where appropriate
for commandline flags.

Reviewed by: glebius
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48832

show more ...


# c2aa9174 03-Feb-2025 Gleb Smirnoff <glebius@FreeBSD.org>

netstat: restore printing the "default" keyword, provide -nn option

Avoid POLA breakage and preserve output standard that really predates
the FreeBSD project itself. There are scripts in the wild t

netstat: restore printing the "default" keyword, provide -nn option

Avoid POLA breakage and preserve output standard that really predates
the FreeBSD project itself. There are scripts in the wild that rely
on the behavior.

Provide option to specify -nn twice to have a completely numeric
output of the routing tables.

Fixes: 9206c79961986c2114a9a2cfccf009ac010ad259
This reverts commit e090646d6f5a4a6848ecd4bcb1f2db498ea3b3e2.

Reviewed by: zlei, gallatin, melifaro, allanjude, markj, emaste
Differential Revision: https://reviews.freebsd.org/D48729

show more ...


12345678910>>...27