summaryrefslogtreecommitdiff
path: root/usr.bin/netstat
AgeCommit message (Collapse)Author
2024-05-18remove prototypes with no matching functionJonathan Gray
2024-04-17Use struct ipsec_level within inpcb.Alexander Bluhm
Instead of passing around u_char[4], introduce struct ipsec_level that contains 4 ipsec levels. This provides better type safety. The embedding struct inpcb is globally visible for netstat(1), so put struct ipsec_level outside of #ifdef _KERNEL. OK deraadt@ mvs@
2024-02-13Merge struct route and struct route_in6.Alexander Bluhm
Use a common struct route for both inet and inet6. Unfortunately struct sockaddr is shorter than sockaddr_in6, so netinet/in.h has to be exposed from net/route.h. Struct route has to be bsd visible for userland as netstat kvm code inspects inp_route. Internet PCB and TCP SYN cache can use a plain struct route now. All specific sockaddr types for inet and inet6 are embeded there. OK claudio@
2024-02-05Add netstat counter for route cache.Alexander Bluhm
To optimize route caching, count cache hits and misses. This is shown in netstat -s for both inet and inet6. Reuse the old IPv6 forward cache counter. Sort ip6s_wrongif consistently. For now only IPv4 cache counter has been implemented. OK mvs@
2023-11-14This code depends on internals from net/art.h so include it explicitly.Claudio Jeker
OK bluhm@
2023-09-04Fix netstat output of uses of current SYN cache left.Alexander Bluhm
TCP syn cache variable scs_use is basically counting packet insertions into syn cache. Prefer type long to exclude overflow on fast machines. Due to counting downwards from a limit, it can become negative. Copy it out as tcps_sc_uses_left via sysctl, and print it as signed long long integer. OK mvs@
2023-07-16Make the mbstat preserve the same size which is actually used. AlsoYASUOKA Masahiko
revert the previous that the mbstat is located on the stack. ok claudio
2023-07-07Expand the counters in struct mbstat from u_short to u_long.YASUOKA Masahiko
ok blumn mvs
2023-07-07Use "llu%" for printing the uint64_t fields in tcpcb.YASUOKA Masahiko
ok blumn
2023-07-02Use TSO and LRO on the loopback interface to transfer TCP faster.Alexander Bluhm
If tcplro is activated on lo(4), ignore the MTU with TCP packets. They are passed along with the information that they have to be chopped in case they are forwarded later. New netstat(1) counter shows that software LRO is in effect. The feature is currently turned off by default. tested by jan@; OK claudio@ jan@
2023-05-23New counters for LRO packets from hardware TCP offloading.Jan Klemkow
With tweaks from patrick@ and bluhm@. OK bluhm@
2023-05-10Implement TCP send offloading, for now in software only. This isAlexander Bluhm
meant as a fallback if network hardware does not support TSO. Driver support is still work in progress. TCP output generates large packets. In IP output the packet is chopped to TCP maximum segment size. This reduces the CPU cycles used by pf. The regular output could be assisted by hardware later, but pf route-to and IPsec needs the software fallback in general. For performance comparison or to workaround possible bugs, sysctl net.inet.tcp.tso=0 disables the feature. netstat -s -p tcp shows TSO counter with chopped and generated packets. based on work from jan@ tested by jmc@ jan@ Hrvoje Popovski OK jan@ claudio@
2023-03-08Delete obsolete /* ARGSUSED */ lint comments.Philip Guenther
ok miod@ millert@
2023-01-04minor text shuffle, for clarity; ok millertJason McIntyre
2022-12-23remove "-p protocol" from the -r synopsis: it no longer makes senseJason McIntyre
pointed out by pguemther ok pguenther kn claudio
2022-12-22move the flag mappings displayed by "route show" from netstat(1) to route(8):Jason McIntyre
diff from paul tagliamonte, who was surprised to find them not documented in route(8); claudio agreed placement was not ideal; deraadt confirmed users better served by route(8) than netstat(1); i've tweaked some of the spacing and text so it displays better, and removed some macros incorrectly associated with the "nameserver" list item, which was messing up the formatting. should display better now
2022-12-04userspace: remove vestigial '?' cases from top-level getopt(3) loopsScott Soule Cheloha
getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@
2022-11-09ndp, route, netstat: adjust ipv6 address widthKlemens Nanni
It has been annoying me for too long that fully specififed GUAs (2001:0db8:3333:4444:5555:6666:7777:8888) mess up alignment. systat(1)'s netstat is the only view that has a big enough limit and thus never misaligns. Unify ndp(8), route(8) and netstat(1) views to always align nicely. Feedback OK claudio
2022-09-08Remove useless -tKlemens Nanni
"Make if.c kvm free by fetching the interface stats via sysctl ..." if.c r1.56 in 2008 neutered the -d and -t flags. -d functionality was eventually restored with if.c r1.76 in 2015. -t has been printing zeroes for over fourteen now; this cannot have been useful to anyone and noone complained about a wrong watchdog timer values. Remove -t entirely without printing a warning; `netstat -t ...' now fails. Feedback jsg OK jsg bluhm
2022-08-26Remove stale comment about nonexistent ifnetaddrKlemens Nanni
Obsolete since if.c r1.56 (2008) "Make if.c kvm free by fetching the interface stats via sysctl [...]".
2022-08-12There are some places in ip and ip6 input where operations fail dueAlexander Bluhm
to out of memory. Use a generic idropped counter for those. OK mvs@
2022-06-28Adapt netstat kvm code to ref count change in struct rtentry.Alexander Bluhm
found by otto@ the hard way
2022-06-19There is no reason to print the RTF_DONE bit in the routing table output.Claudio Jeker
It is now set on all routes (and before it was never set). OK tb@ anton@
2022-03-31man pages: add missing commas between subordinate and main clausesChristian Weisgerber
jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@
2021-12-05sys/select.h is not needed, if howmany/NBBY are needed they will arriveTheo de Raadt
via netinet/in.h and sys/time.h, which I must say surprises me a bit
2021-11-29local copy of roundup() means no more sys/param.hTheo de Raadt
2021-11-21Add the new `ipsec_exctdb' ipsec(4) counter to count and expose to theVitaliy Makkoveev
userland the TDBs which exceeded hard limit. Also the `ipsec_notdb' counter description in header doesn't math to netstat(1) description. We never count `ipsec_notdb' and the netstat(1) description looks more appropriate so it's used to avoid confusion with the new counter. ok bluhm@
2021-03-17Netstat wants to access kernel internal structures for the kvm walker ofClaudio Jeker
the routing table. Define _KERNEL around the net/route.h include. OK florian@
2021-01-26satisfy -fno-common, by (1) copying all the variable decls fromTheo de Raadt
indent_globs.h to indent.c, and (2) changing all the same decls in indent_globs.h to be extern ok mortimer
2021-01-26sockb variable is unused (and even worse, was common unused)Theo de Raadt
2021-01-24Add missing __KAME__ markers.Florian Obser
OK claudio
2021-01-17Replace SB_KNOTE and sb_flagsintr with direct checking of klist.Visa Hankala
OK mpi@ as part of a larger diff
2021-01-16Unle recover the scope_id from a possible embedded scope if the scope_idClaudio Jeker
is not initalized. Do not reset the scope_id if it was already set. OK bluhm@ florian@
2021-01-02Add missing .Cm macros to the Address Family table.Ingo Schwarze
While here, trim pointless quoting and one excessive column width.
2021-01-02Markup route flags such that apropos(1) finds themkn
netstat(1) is where the mapping between letters and flags is documented, but searching for them ("man -k any=RTF_" or "man -k -i any=blackhole") would only list route(4) and route(8). Markup preprocessor defines as such. OK schwarze
2020-12-29getifaddrs() can return entries where ifa_addr is NULL. Check for thisSebastian Benoit
before accessing anything in ifa_addr. ok claudio@
2020-12-23Print specific headline for TCP state and IP protocol in netstat.Alexander Bluhm
OK claudio@ sthen@
2020-09-15"Route show" and "netstat -r" provide formatting for routing tables withpamela
sufficient space to display v4 addresses cleanly, but which truncate v6 addresses. The -n flag on each already provides additional column width for IPv6 addresses. Make this formatting the default. OK phessler kn
2020-07-18oops - the description of -i had a similarly incorrect text as -I concerningJason McIntyre
use of -f; remove that too; pointed out by guenther
2020-07-18the text describing the effect of -f on -I is apparently wrong - no such codeJason McIntyre
was ever added; the text was added 21 years ago when ip6 support was added; marfabastewart noticed it, and guenther tracked down the commit responsible; this commit removes that text;
2020-06-16rework SYNOPSIS/usage() to show better the various use formats,Jason McIntyre
and rework the man text to reflect this; guenther supplied the details on the various modes; deraadt suggested __progname be banished from usage();
2020-06-12Remove superflous space I added with my last commit.remi
noticed by jmc@
2020-06-12update usage() with -R.remi
reminded by jmc@
2020-06-12Add -R to show a summary of rdomains with associated interfaces and tables.remi
My first version also displayed the number of routes per table. But duming all routing tables to count the entries in userland is expensive. Once the kernel can export these counters the numbers can be added to the output of -R. OK benno@ previous version OK sthen@
2020-01-15Print the correct field, sb_timeo has been replaced by sb_timeo_nsecs.Martin Pieuchot
Breakage reported by espie@, ok bluhm@
2019-12-08Make sure packet destination address matches interface address,Alexandr Nedvedicky
where such packet is bound to. This check is enforced if and only IP forwarding is disabled. Change discussed with bluhm@, claudio@, deraadt@, markus@, tobhe@ OK bluhm@, claudio@, tobhe@
2019-09-02The output of netstat -g was mangled. Fix header line and printAlexander Bluhm
format. OK mpi@
2019-07-16Prevent integer overflow in kernel and userland when checking mbufAlexander Bluhm
limits. Convert kernel variables and calculations for mbuf memory into long to allow larger values on 64 bit machines. Put a range check into the kernel sysctl. For the interface itself int is still sufficient. In netstat -m cast all multiplications to unsigned long to hold the product of two unsigned int. input and OK visa@
2019-07-12Count the number of TCP SACK options that were dropped due to theAlexander Bluhm
sack hole list length or pool limit. OK claudio@
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.