History log of /freebsd/sys/netinet/sctp_usrreq.c (Results 1 – 25 of 602)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 3ff865c6 20-Mar-2025 Mark Johnston <markj@FreeBSD.org>

netinet: Fix getcred sysctl handlers to do nothing if no input is given

These routines were all assuming that the sysctl handler has some new
value, but this is not the case. SYSCTL_IN() returns 0

netinet: Fix getcred sysctl handlers to do nothing if no input is given

These routines were all assuming that the sysctl handler has some new
value, but this is not the case. SYSCTL_IN() returns 0 in this
scenario, so they were all operating on an uninitialized address. This
is mostly harmless, but trips KMSAN checks, so let's fix them.

Reviewed by: zlei, rrs, glebius
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D49348

show more ...


Revision tags: release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4
# 6472c6ba 03-Feb-2025 Gleb Smirnoff <glebius@FreeBSD.org>

sctp: don't specify pr_poll = sopoll_generic

Trust the framework to set the generic methods. No functional change.


Revision tags: release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0, release/14.1.0
# 8c370940 09-May-2024 Michael Tuexen <tuexen@FreeBSD.org>

sctp: allow stcb == NULL in sctp_shutdown()

Consistently handle this case.
Reported by: Coverity Scan
CID: 1533813
MFC after: 3 days


Revision tags: release/13.3.0
# abe8379b 15-Feb-2024 Gleb Smirnoff <glebius@FreeBSD.org>

sockets: repair wakeup of accept(2) by shutdown(2)

That was lost in transition from one-for-all soshutdown() to protocol
specific methods. Only protocols that listen(2) were affected. This is
not

sockets: repair wakeup of accept(2) by shutdown(2)

That was lost in transition from one-for-all soshutdown() to protocol
specific methods. Only protocols that listen(2) were affected. This is
not a documented or specified feature, but some software relies on it. At
least the FreeSWITCH telephony software uses this behavior on
PF_INET/SOCK_STREAM.

Fixes: 5bba2728079ed4da33f727dbc2b6ae1de02ba897

show more ...


# ce69e373 03-Feb-2024 Gleb Smirnoff <glebius@FreeBSD.org>

Revert "sockets: retire sorflush()"

Provide a comment in sorflush() why the socket I/O sx(9) lock is actually
important.

This reverts commit 507f87a799cf0811ce30f0ae7f10ba19b2fd3db3.


# a079c891 17-Jan-2024 Gleb Smirnoff <glebius@FreeBSD.org>

sctp: restore missing inpcb lock

Fixes: 5bba2728079ed4da33f727dbc2b6ae1de02ba897
Reported-by: syzbot+b8636c973dc20fea4a9b@syzkaller.appspotmail.com
Reported-by: syzbot+d76a18ee8bbe6f7d3056@syzkaller

sctp: restore missing inpcb lock

Fixes: 5bba2728079ed4da33f727dbc2b6ae1de02ba897
Reported-by: syzbot+b8636c973dc20fea4a9b@syzkaller.appspotmail.com
Reported-by: syzbot+d76a18ee8bbe6f7d3056@syzkaller.appspotmail.com

show more ...


# 507f87a7 16-Jan-2024 Gleb Smirnoff <glebius@FreeBSD.org>

sockets: retire sorflush()

With removal of dom_dispose method the function boils down to two
meaningful function calls: socantrcvmore() and sbrelease(). The latter is
only relevant for protocols th

sockets: retire sorflush()

With removal of dom_dispose method the function boils down to two
meaningful function calls: socantrcvmore() and sbrelease(). The latter is
only relevant for protocols that use generic socket buffers.

The socket I/O sx(9) lock acquisition in sorflush() is not relevant for
shutdown(2) operation as it doesn't do any I/O that may interleave with
read(2) or write(2). The socket buffer mutex acquisition inside
sbrelease() is what guarantees thread safety. This sx(9) acquisition in
soshutdown() can be tracked down to 4.4BSD times, where it used to be
sblock(), and it was carried over through the years evolving together with
sockets with no reconsideration of why do we carry it over. I can't tell
if that sblock() made sense back then, but it doesn't make any today.

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D43415

show more ...


# 5bba2728 16-Jan-2024 Gleb Smirnoff <glebius@FreeBSD.org>

sockets: make pr_shutdown fully protocol specific method

Disassemble a one-for-all soshutdown() into protocol specific methods.
This creates a small amount of copy & paste, but makes code a lot more

sockets: make pr_shutdown fully protocol specific method

Disassemble a one-for-all soshutdown() into protocol specific methods.
This creates a small amount of copy & paste, but makes code a lot more
self documented, as protocol specific method would execute only the code
that is relevant to that protocol and nothing else. This also fixes a
couple recent regressions and reduces risk of future regressions. The
extended KPI for the new pr_shutdown removes need for the extra pr_flush
which was added for the sake of SCTP which could not perform its shutdown
properly with the old one. Particularly for SCTP this change streamlines
a lot of code.

Some notes on why certain parts of code were copied or were not to certain
protocols:
* The (SS_ISCONNECTED | SS_ISCONNECTING | SS_ISDISCONNECTING) check is
needed only for those protocols that may be connected or disconnected.
* The above reduces into only SS_ISCONNECTED for those protocols that
always connect instantly.
* The ENOTCONN and continue processing hack is left only for datagram
protocols.
* The SOLISTENING(so) block is copied to those protocols that listen(2).
* sorflush() on SHUT_RD is copied almost to every protocol, but that
will be refactored later.
* wakeup(&so->so_timeo) is copied to protocols that can make a non-instant
connect(2), can SO_LINGER or can accept(2).

There are three protocols (netgraph(4), Bluetooth, SDP) that did not have
pr_shutdown, but old soshutdown() would still perform sorflush() on
SHUT_RD for them and also wakeup(9). Those protocols partially supported
shutdown(2) returning EOPNOTSUP for SHUT_WR/SHUT_RDWR, now they fully lost
shutdown(2) support. I'm pretty sure netgraph(4) and Bluetooth are okay
about that and SDP is almost abandoned anyway.

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D43413

show more ...


# 0fac350c 30-Nov-2023 Gleb Smirnoff <glebius@FreeBSD.org>

sockets: don't malloc/free sockaddr memory on getpeername/getsockname

Just like it was done for accept(2) in cfb1e92912b4, use same approach
for two simplier syscalls that return socket addresses.

sockets: don't malloc/free sockaddr memory on getpeername/getsockname

Just like it was done for accept(2) in cfb1e92912b4, use same approach
for two simplier syscalls that return socket addresses. Although,
these two syscalls aren't performance critical, this change generalizes
some code between 3 syscalls trimming code size.

Following example of accept(2), provide VNET-aware and INVARIANT-checking
wrappers sopeeraddr() and sosockaddr() around protosw methods.

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D42694

show more ...


# cfb1e929 30-Nov-2023 Gleb Smirnoff <glebius@FreeBSD.org>

sockets: don't malloc/free sockaddr memory on accept(2)

Let the accept functions provide stack memory for protocols to fill it in.
Generic code should provide sockaddr_storage, specialized code may

sockets: don't malloc/free sockaddr memory on accept(2)

Let the accept functions provide stack memory for protocols to fill it in.
Generic code should provide sockaddr_storage, specialized code may provide
smaller structure.

While rewriting accept(2) make 'addrlen' a true in/out parameter, reporting
required length in case if provided length was insufficient. Our manual
page accept(2) and POSIX don't explicitly require that, but one can read
the text as they do. Linux also does that. Update tests accordingly.

Reviewed by: rscheff, tuexen, zlei, dchagin
Differential Revision: https://reviews.freebsd.org/D42635

show more ...


Revision tags: release/14.0.0
# bb56b36d 13-Sep-2023 Michael Tuexen <tuexen@FreeBSD.org>

sctp: further improve shutting down the read side of a socket

Deal with the case that the association is already gone.

Reported by: syzbot+e256d42e9b390564530a@syzkaller.appspotmail.com
MFC after:

sctp: further improve shutting down the read side of a socket

Deal with the case that the association is already gone.

Reported by: syzbot+e256d42e9b390564530a@syzkaller.appspotmail.com
MFC after: 3 days

show more ...


# 81c5f0fa 13-Sep-2023 Michael Tuexen <tuexen@FreeBSD.org>

sctp: improve shutting down the read side of a socket

When shutdown(..., SHUT_RD) or shutdown(..., SHUT_RDWR) is called,
really clean up the read queue and issue an ungraceful shutdown if
user messa

sctp: improve shutting down the read side of a socket

When shutdown(..., SHUT_RD) or shutdown(..., SHUT_RDWR) is called,
really clean up the read queue and issue an ungraceful shutdown if
user messages are affected.

Reported by: syzbot+d4e1d30d578891245f59@syzkaller.appspotmail.com
MFC after: 3 days

show more ...


# c3179e66 18-Aug-2023 Michael Tuexen <tuexen@FreeBSD.org>

sctp: cleanup cdefs.h include


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

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


# 85e5480d 09-Aug-2023 Michael Tuexen <tuexen@FreeBSD.org>

sctp: another cleanup

No functional change intended.

MFC after: 1 week


# 9ade2745 08-Aug-2023 Michael Tuexen <tuexen@FreeBSD.org>

sctp: remove duplicate code

No functional change intended.

MFC after: 1 week


# efb04fb4 04-Aug-2023 Michael Tuexen <tuexen@FreeBSD.org>

sctp: improve consistency of acc and ccc handling in snd buffer

Don't clear the counters for the socket snd buffer when
shutdown(..., SHUT_WR) or shutdown(..., SHUT_RDWR) is called.
This was causing

sctp: improve consistency of acc and ccc handling in snd buffer

Don't clear the counters for the socket snd buffer when
shutdown(..., SHUT_WR) or shutdown(..., SHUT_RDWR) is called.
This was causing the system to panic() when SCTP pf tests were
running.

Reported by: dchagin, kp
MFC after: 1 week

show more ...


# 52640d61 23-Jul-2023 Michael Tuexen <tuexen@FreeBSD.org>

sctp: update zero checksum support

Implement support for the error detection method identifier.
MFC after: 2 weeks


# 04ede367 03-May-2023 Michael Tuexen <tuexen@FreeBSD.org>

sctp: only start shutdown guard timer when sending SHUTDOWN chunk

The intention is to protect a malicious peer not following the
shutdown procedures.

MFC after: 1 week


# 66d6fd53 23-Apr-2023 Michael Tuexen <tuexen@FreeBSD.org>

sctp: use constants from RFC 8260 to improve compliance

Keep the old constants for backwards compatibility.

MFC after: 1 week


Revision tags: release/13.2.0
# cee09bda 15-Mar-2023 Michael Tuexen <tuexen@FreeBSD.org>

sctp: allow disabling of SCTP_ACCEPT_ZERO_CHECKSUM socket option


# 4a2b92d9 10-Mar-2023 Michael Tuexen <tuexen@FreeBSD.org>

sctp: initial implementation of draft-tuexen-tsvwg-sctp-zero-checksum


Revision tags: release/12.4.0
# f83db644 06-Nov-2022 Michael Tuexen <tuexen@FreeBSD.org>

sctp: minor changes due to upstreaming of Glebs recent changes


# fcb3f813 04-Oct-2022 Gleb Smirnoff <glebius@FreeBSD.org>

netinet*: remove PRC_ constants and streamline ICMP processing

In the original design of the network stack from the protocol control
input method pr_ctlinput was used notify the protocols about two

netinet*: remove PRC_ constants and streamline ICMP processing

In the original design of the network stack from the protocol control
input method pr_ctlinput was used notify the protocols about two very
different kinds of events: internal system events and receival of an
ICMP messages from outside. These events were coded with PRC_ codes.
Today these methods are removed from the protosw(9) and are isolated
to IPv4 and IPv6 stacks and are called only from icmp*_input(). The
PRC_ codes now just create a shim layer between ICMP codes and errors
or actions taken by protocols.

- Change ipproto_ctlinput_t to pass just pointer to ICMP header. This
allows protocols to not deduct it from the internal IP header.
- Change ip6proto_ctlinput_t to pass just struct ip6ctlparam pointer.
It has all the information needed to the protocols. In the structure,
change ip6c_finaldst fields to sockaddr_in6. The reason is that
icmp6_input() already has this address wrapped in sockaddr, and the
protocols want this address as sockaddr.
- For UDP tunneling control input, as well as for IPSEC control input,
change the prototypes to accept a transparent union of either ICMP
header pointer or struct ip6ctlparam pointer.
- In icmp_input() and icmp6_input() do only validation of ICMP header and
count bad packets. The translation of ICMP codes to errors/actions is
done by protocols.
- Provide icmp_errmap() and icmp6_errmap() as substitute to inetctlerrmap,
inet6ctlerrmap arrays.
- In protocol ctlinput methods either trust what icmp_errmap() recommend,
or do our own logic based on the ICMP header.

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

show more ...


# c0fc81e9 04-Oct-2022 Gleb Smirnoff <glebius@FreeBSD.org>

netinet*: remove dead code from TCP, UDP, SCTP control input

Now these functions are called only from icmp*_input(). The pointer
to the ICMP data is never NULL and cmd has a limited set of values.

netinet*: remove dead code from TCP, UDP, SCTP control input

Now these functions are called only from icmp*_input(). The pointer
to the ICMP data is never NULL and cmd has a limited set of values.

In the past the functions were demultiplexing control messages from
ICMP layer, as well as internally generated events. In the latter
case the the pointer to IP would be NULL.

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

show more ...


12345678910>>...25