History log of /freebsd-current/usr.bin/netstat/sctp.c
Revision Date Author Comments
# 5e3934b1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.bin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 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 perl script.

Sponsored by: Netflix


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

Remove $FreeBSD$: one-line .c pattern

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


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# f193c8ce 05-Jan-2017 Xin LI <delphij@FreeBSD.org>

Use strlcpy and snprintf in netstat(1).

Expand inet6name() line buffer to NI_MAXHOST and use strlcpy/snprintf
in various places.

Reported by: Anton Yuzhaninov <citrin citrin ru>
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D8916


# 9bf9ce81 17-Jul-2016 Michael Tuexen <tuexen@FreeBSD.org>

Don't duplicate code for SCTP, just use the ones used for UDP and TCP.

This fixes a bug with link local addresses. This will require and
upcoming change in the kernel to bring SCTP to the same behaviour
as UDP and TCP.

MFC after: 3 days


# ca658db3 15-Jul-2016 Michael Tuexen <tuexen@FreeBSD.org>

Ensure that the -a, -W, -L options for SCTP behave similar
as for TCP.

MFC after: 3 days


# 282d1dd7 15-Jul-2016 Michael Tuexen <tuexen@FreeBSD.org>

Fix a bug which results in a core dump when running netstat with
the -W option and having a listening SCTP socket.
The bug was introduced in r279122 when adding support for libxo.

MFC after: 3 days


# fcc0131f 21-Apr-2016 Marcelo Araujo <araujo@FreeBSD.org>

Use macro MAX() from sys/param.h.

MFC after: 2 weeks.


# ef1cb629 17-Apr-2016 Marcelo Araujo <araujo@FreeBSD.org>

Use NULL instead of 0 for pointers.

Also malloc will return NULL if it cannot allocate memory.

MFC after: 2 weeks.


# 7325dfbb 01-Feb-2016 Alfred Perlstein <alfred@FreeBSD.org>

Increase max allowed backlog for listen sockets
from short to int.

PR: 203922
Submitted by: White Knight <white_knight@2ch.net>
MFC After: 4 weeks


# 9eddb899 10-Sep-2015 Mark Johnston <markj@FreeBSD.org>

Use a common subroutine to fetch and zero protocol stats instead of
duplicating roughly similar code for each protocol.

MFC after: 2 weeks


# 10d5269f 01-Sep-2015 Hiroki Sato <hrs@FreeBSD.org>

- Add -W flag support for network column in intpr() (-i flag) and
routepr() (-r flag). It is too narrow to show an IPv6 prefix
in most cases.

- Accept "local" as a synonym of "unix" in protocol family name.

- Show a prefix length in CIDR notation when name resolution failed in
netname().

- Make routename() and netname() AF-independent and remove
unnecessary typecasting from struct sockaddr.

- Use getnameinfo(3) to format L2 addr in intpr().

- Fix a bug which showed "Address" when -A flag is specfied in pr_rthdr().

- Replace cryptic GETSA() macro with SA_SIZE().

- Fix declarations shadowing local variables with the same names.

- Add more static, remove unused header files and variables.

MFC after: 1 week


# 0835304f 29-Aug-2015 Michael Tuexen <tuexen@FreeBSD.org>

Use the userland exported states and handle them completely.


# ade9ccfe 21-Feb-2015 Marcel Moolenaar <marcel@FreeBSD.org>

Convert netstat to use libxo.

Obtained from: Phil Shafer <phil@juniper.net>
Ported to -current by: alfred@ (mostly), Kim Shrier
Formatting: marcel@
Sponsored by: Juniper Networks, Inc.


# 321ae07f 19-Feb-2013 Philippe Charnier <charnier@FreeBSD.org>

WARNS=6 compliance


# 3dcc856b 16-Jul-2012 Michael Tuexen <tuexen@FreeBSD.org>

Allow netstat to be build if INET is not defined in the kernel.
Thanks to Garrett Cooper for reporting the issue.

MFC after: 3 days
X-MFC: 238501


# 23a0e422 25-Jan-2012 Michael Tuexen <tuexen@FreeBSD.org>

Don't print a warning when using netstat to print
SCTP statistics when there is not SCTP in the kernel.
This problem was reported by Sean Mahood.

MFC after: 1 week.


# b3608ae1 03-Jan-2012 Ed Schouten <ed@FreeBSD.org>

Replace index() and rindex() calls with strchr() and strrchr().

The index() and rindex() functions were marked LEGACY in the 2001
revision of POSIX and were subsequently removed from the 2008 revision.
The strchr() and strrchr() functions are part of the C standard.

This makes the source code a lot more consistent, as most of these C
files also call into other str*() routines. In fact, about a dozen
already perform strchr() calls.


# 2e34c19b 22-Jul-2011 Michael Tuexen <tuexen@FreeBSD.org>

Fix the following bugs related to the SCTP support of netstat:
* Correctly handle -a.
* -A isn't supported.
* Show all closed 1-to-1 and 1-to-many style sockets.
* Show all listening 1-to-many style sockets.
* Use consistent formatting for -W.

PR: 150642
Approved by: re@
MFC after: 4 weeks.


# e17c4d4e 13-Mar-2011 Rebecca Cran <brucec@FreeBSD.org>

Fix typo.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 93f8854c 08-Oct-2010 Dimitry Andric <dim@FreeBSD.org>

Remove superfluous cast in usr.bin/netstat/sctp.c.

Found by: clang
Submitted by: Norberto Lopes, nlopes dot ml at gmail dot com
Approved by: rpaulo (mentor)


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 821df508 12-Dec-2009 Xin LI <delphij@FreeBSD.org>

Revert most part of 200420 as requested, as more review and polish is
needed.


# 6f2d3221 11-Dec-2009 Xin LI <delphij@FreeBSD.org>

Remove unneeded header includes from usr.bin/ except contributed code.

Tested with: make universe


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 4db051c8 16-Apr-2008 Randall Stewart <rrs@FreeBSD.org>

Fixes typo's in sctp.c


# 65475bc8 02-Jan-2008 David E. O'Brien <obrien@FreeBSD.org>

style(9)
+ kread is not a boolean, so check it as such
+ fix $FreeBSD$ Ids
+ denote copyrights with /*-
+ misc whitespace changes.


# e5221e8b 17-Oct-2007 Randall Stewart <rrs@FreeBSD.org>

Fix incorrect string formats for netstat/s

PR: 117175
Obtained from: Weongyo Jeong (weongyo.jeong@gmail.com)
MFC after: 1 week


# a3a60860 09-Sep-2007 Randall Stewart <rrs@FreeBSD.org>

- Netstat warning removal for 64 bit aware platforms.
Approved by: re@freebsd.org (B Mah)


# d37c5193 23-Aug-2007 Randall Stewart <rrs@FreeBSD.org>

- Fix typo in netstat's display of Nagle algorithm - refer to the RFC.

Submitted by: bruce@cran.org.uk
Approved by: re@freebsd.org (Bruce Mah)


# feda1a43 16-Jul-2007 John Baldwin <jhb@FreeBSD.org>

Restore netstat -M functionality for most statistics on core dumps. In
general, when support was added to netstat for fetching data using sysctl,
no provision was left for fetching equivalent data from a core dump, and
in fact, netstat would _always_ fetch data from the live kernel using
sysctl even when -M was specified resulting in the user believing they
were getting data from coredumps when they actually weren't. Some specific
changes:
- Add a global 'live' variable that is true if netstat is running against
the live kernel and false if -M has been specified.
- Stop abusing the sysctl flag in the protocol tables to hold the protocol
number. Instead, the protocol is now its own field in the tables, and
it is passed as a separate parameter to the PCB and stat routines rather
than overloading the KVM offset parameter.
- Don't run PCB or stats functions who don't have a namelist offset if we
are being run against a crash dump (!live).
- For the inet and unix PCB routines, we generate the same buffer from KVM
that the sysctl usually generates complete with the header and trailer.
- Don't run bpf stats for !live (before it would just silently always run
live).
- kread() no longer trashes memory when opening the buffer if there is an
error on open and the passed in buffer is smaller than _POSIX2_LINE_MAX.
- The multicast routing code doesn't fallback to kvm on live kernels if
the sysctl fails. Keeping this made the code rather hairy, and netstat
is already tied to the kernel ABI anyway (even when using sysctl's since
things like xinpcb contain an inpcb) so any kernels this is run against
that have the multicast routing stuff should have the sysctls.
- Don't try to dig around in the kernel linker in the netgraph PCB routine
for core dumps.

Other notes:
- sctp's PCB routine only works on live kernels, it looked rather
complicated to generate all the same stuff via KVM. Someone can always
add it later if desired though.
- Fix the ipsec removal bug where N_xxx for IPSEC stats weren't renumbered.
- Use sysctlbyname() everywhere rather than hardcoded mib values.

MFC after: 1 week
Approved by: re (rwatson)


# b8a1761e 17-Jun-2007 Randall Stewart <rrs@FreeBSD.org>

o style(9) nit.
o shorten explainations which are over 80 columns in console.
o group rows
o clean up and change explanations a little bit.
Obtained from: weongyo.jeong@gmail.com


# 3f8d71d5 16-Jun-2007 Randall Stewart <rrs@FreeBSD.org>

- Forced commit to update who actually did this code (I forgot
the obtained from in the original line)
Obtained from: Weongyo Jeong (weongyo.jeong@gmail.com)


# 04b764d8 12-Jun-2007 Xin LI <delphij@FreeBSD.org>

sctp_process_inpcb() wants an offset parameter in size_t,
so define it as what it is expected. This fixes WARNS=3
without NO_WERROR build.


# 74fd40c9 09-Jun-2007 Randall Stewart <rrs@FreeBSD.org>

Adds support for SCTP.