History log of /freebsd-11-stable/sys/netinet/sctp_output.c
Revision Date Author Comments
# 364948 29-Aug-2020 tuexen

MFC r364937:
Fix a regression with the explicit EOR mode I introduced in r364268.


# 364651 24-Aug-2020 tuexen

MFC r364268:
Improve the handling of concurrent send() calls for SCTP sockets,
especially when having the explicit EOR mode enabled.
Manually resolved merge conflicts.

MFC r364270:
Remove a line which is needed and was added in
https://svnweb.freebsd.org/changeset/base/364268


# 361469 25-May-2020 tuexen

MFC r360869: Fix bug in PR-SCTP

Only drop DATA chunk with lower priorities as specified in RFC 7496.
This issue was found by looking at a reproducer generated by syzkaller.


# 360772 07-May-2020 tuexen

MFC r360671: Avoid integer underflow

Avoid underflowing a variable, which would result in taking more
data from the stream queues then needed.

Thanks to Timo Voelker for finding this bug and providing a fix.


# 360771 07-May-2020 tuexen

MFC r360662: Fix a bug in SCTP SACK generation

Fix the computation of the numbers of entries of the mapping array to
look at when generating a SACK. This was wrong in case of sequence
numbers wrap arounds.

Thanks to Gwenael FOURRE for reporting the issue for the userland stack:
https://github.com/sctplab/usrsctp/issues/462


# 360761 07-May-2020 tuexen

MFC r357705: Cleanup timer handling

Submitted by: Taylor Brandstetter


# 360757 07-May-2020 tuexen

MFC r356378: Improve SCTP iterator

Don't make the sendall iterator as being up if it could not be started.


# 360747 07-May-2020 tuexen

MFC r353452: Improve remote address scanning in SCTP

Ensure that local variables are reset to their initial value when
dealing with error cases in a loop over all remote addresses.
This issue was found and reported by OSS_Fuzz in:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18080
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18086
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18121
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18163


# 360742 07-May-2020 tuexen

MFC r353119: Fix padding of COOKIE_ECHO chunks

Fix the adding of padding to COOKIE-ECHO chunks.

Thanks to Mark Wodrich who found this issue while fuzz testing the
usrsctp stack and reported the issue in
https://github.com/sctplab/usrsctp/issues/382


# 360731 07-May-2020 tuexen

MFC r351654: Improve handling of cookie parameters in INIT-ACK chunks

Improve the handling of state cookie parameters in INIT-ACK chunks.
This fixes problem with parameters indicating a zero length or partial
parameters after an unknown parameter indicating to stop processing. It
also fixes a problem with state cookie parameters after unknown
parametes indicating to stop porcessing.
Thanks to Mark Wodrich from Google for finding two of these issues
by fuzz testing the userland stack and reporting them in
https://github.com/sctplab/usrsctp/issues/355
and
https://github.com/sctplab/usrsctp/issues/352


# 360726 07-May-2020 tuexen

MFC r350625: Improve compilation on 32-bit OS/

Fix build issues for the userland stack on Raspbian.


# 360725 07-May-2020 tuexen

MFC r350520: Fix reporting of unknown paramters in an INIT chunk

Fix the reporting of multiple unknown parameters in an received INIT
chunk. This also plugs an potential mbuf leak.
Thanks to Felix Weinrank for reporting this issue found by fuzz-testing
the userland stack.


# 360724 07-May-2020 tuexen

MFC r350508: Improve sending of ABORT message in SCTP

When responding with an ABORT to an INIT chunk containing a
HOSTNAME parameter or a parameter with an illegal length, only
include an error cause indicating why the ABORT was sent.
This also fixes an mbuf leak which could occur.


# 360716 06-May-2020 tuexen

MFC r350488: Cleanup in SCTP code

Small cleanup, no functional change intended.


# 360715 06-May-2020 tuexen

MFC r350487: mbuf cleanup for SCTP

Consistently cleanup mbufs in case of other memory errors.


# 360714 06-May-2020 tuexen

MFC r350254: Improve SCTP locking

Don't hold a mutex while calling sbwait. This was found by syzkaller.

Submitted by: rrs
Reported by: markj


# 360707 06-May-2020 tuexen

MFC r349999: Honor MSG_EOR and MSG_EOF in sendmsg() for SCTP sockets

Add support for MSG_EOR and MSG_EOF in sendmsg() for SCTP.
This is an FreeBSD extension, not covered by Posix.
This issue was found by running syzkaller.


# 352057 09-Sep-2019 tuexen

MFC r349986:

When calling sctp_initialize_auth_params(), the inp must have at
least a read lock. To avoid more complex locking dances, just
call it in sctp_aloc_assoc() when the write lock is still held.


# 347676 16-May-2019 tuexen

MFC r345467:

Fix build issue for the userland stack.
Joint work with rrs@.


# 347675 16-May-2019 tuexen

MFC r345466:

Fix more signed unsigned issues. This time on the send path.
This is joint work with rrs@ and was found by running syzkaller.


# 347673 16-May-2019 tuexen

MFC r345461:

Limit the size of messages sent on 1-to-many style SCTP sockets with the
SCTP_SENDALL flag. Allow also only one operation per SCTP endpoint.

This fixes an issue found by running syzkaller and is joint work with rrs@.


# 347672 16-May-2019 tuexen

MFC r345460:

Limit the number of bytes which can be queued for SCTP sockets.
This is joint work with rrs@.


# 347655 16-May-2019 tuexen

MFC r343770:

Only reduce the PMTU after the send call. The only way to increase it, is
via PMTUD.

This fixes an MTU issue reported by Timo Voelker.


# 347653 16-May-2019 tuexen

MFC r339221:

Avoid truncating unrecognised parameters when reporting them.
This resulted in sending malformed packets.


# 347651 16-May-2019 tuexen

MFC r339040:

After allocating chunks set the fields in a consistent way.
This removes two assignments for the flags field being done
twice and adds one, which was missing.
Thanks to Felix Weinrank for reporting the issue he found
by using fuzz testing of the userland stack.


# 347649 16-May-2019 tuexen

MFC r339027:

Plug mbuf leaks in the SCTP output path in error cases.


# 347648 16-May-2019 tuexen

MFC r339024:

Fix the handling of ancillary data for SCTP socket. Implement
sctp_process_cmsgs_for_init() and sctp_findassociation_cmsgs()
similar to sctp_find_cmsg() to improve consistency and avoid
the signed/unsigned issues in sctp_process_cmsgs_for_init()
and sctp_findassociation_cmsgs().

Thanks to andrew@ for reporting the problem he found using
syzcaller.


# 347647 16-May-2019 tuexen

MFC r339022:
Increment the corresponding UDP stats counter (udps_opackets) when
sending UDP encapsulated SCTP packets.
This is consistent with the behaviour that when such packets are received,
the corresponding UDP stats counter (udps_ipackets) is incremented.
Thanks to Peter Lei for making me aware of this inconsistency.


# 347165 05-May-2019 tuexen

MFC r337708:

Use the stcb instead of the asoc in state macros.
This is not a functional change. Just a preparation for upcoming
dtrace state change provider support.


# 347163 05-May-2019 tuexen

MFC r337706:
Use consistently the macors to modify the assoc state.
No functional change.


# 347162 05-May-2019 tuexen

MFC r337688:
Add explicit cast to silence a warning for the userland stack.

Thanks to Felix Weinrank for providing the patch.


# 347149 05-May-2019 tuexen

MFC r333980:
Do the appropriate accounting when ip_output() fails.
Manually remove a merge conflict.


# 347146 05-May-2019 tuexen

MFC r333604:
sctp_get_mbuf_for_msg() should honor the allinone parameter.

When it is not required that the buffer is not a chain, return
a chain. This is based on a patch provided by Irene Ruengeler.


# 347144 05-May-2019 tuexen

MFC r335179:
Provide the ip6_plen in network byte order when calling ip6_output().

This is not strictly required by ip6_output(), since it overrides it,
but it is needed for upcoming dtrace support.


# 347143 05-May-2019 tuexen

MFC r335176:
Whitespace changes.


# 332228 07-Apr-2018 tuexen

MFC r326829:

Cleaup, no functional change.


# 332227 07-Apr-2018 tuexen

MFC r326672:

Retire SCTP_WITH_NO_CSUM option.

This option was used in the early days to allow performance measurements
extrapolating the use of SCTP checksum offloading. Since this feature
is now available, get rid of this option.
This also un-breaks the LINT kernel. Thanks to markj@ for making me
aware of the problem.


# 332222 07-Apr-2018 tuexen

MFC r325370:

Allow the setting of the MTU for future paths using an SCTP socket option.
This functionality was missing.


# 332220 07-Apr-2018 tuexen

MFC r325046:

Fix parsing error when processing cmsg in SCTP send calls. The bug is
related to a signed/unsigned mismatch.
This should most likely fix the issue in sctp_sosend reported by
Dmitry Vyukov on the freebsd-hackers mailing list and found by
running syzkaller.


# 332212 07-Apr-2018 tuexen

MFC r324615:

Code cleanup, not functional change.

This avoids taking a pointer of a packed structure which allows simpler
compilation of the userland stack.


# 332201 07-Apr-2018 tuexen

MFC r323861:

Code cleanup, no functional change.


# 332187 07-Apr-2018 tuexen

MFC r323378:

Fix MTU computation. Coverity scanning usrsctp pointed to this code...


# 332172 07-Apr-2018 tuexen

MFC r321204:

Use memset/memcpy instead of bzero/bcopy.

Just use one variant instead of both. Use the memset/memcpy
ones since they cause less problems in crossplatform deployment.


# 332169 07-Apr-2018 tuexen

MFC r321034:

Fix the handling of Explicit EOR mode.

While there, appropriately handle the overhead depending on
the usage of DATA or I-DATA chunks. Take the overhead only
into account, when required.

Joint work with rrs@


# 331722 29-Mar-2018 eadler

Revert r330897:

This was intended to be a non-functional change. It wasn't. The commit
message was thus wrong. In addition it broke arm, and merged crypto
related code.

Revert with prejudice.

This revert skips files touched in r316370 since that commit was since
MFCed. This revert also skips files that require $FreeBSD$ property
changes.

Thank you to those who helped me get out of this mess including but not
limited to gonzo, kevans, rgrimes.

Requested by: gjb (re)


# 330897 14-Mar-2018 eadler

Partial merge of the SPDX changes

These changes are incomplete but are making it difficult
to determine what other changes can/should be merged.

No objections from: pfg


# 320457 28-Jun-2017 tuexen

MFC r320263:
Use a longer buffer for messages in ERROR chunks.

MFC r320264:
Check the length of a COOKIE chunk before accessing fields in it.

MFC r320300:
Handle sctp_get_next_param() in a consistent way.

Approved by: re (marius@)


# 319405 01-Jun-2017 tuexen

MFC r317558:

Set the DF bit for responses to out-of-the-blue packets.


# 319396 01-Jun-2017 tuexen

MFC r313032:

Ensure that the variable bail is always initialized before used.


# 319393 01-Jun-2017 tuexen

MFC r312722:

Fix a bug where the overhead of the I-DATA chunk was not considered.


# 316714 11-Apr-2017 markj

MFC r306829, r310286, r311695:
Lock the ND prefix list and add refcounting for prefixes.


# 310895 31-Dec-2016 tuexen

MFC r310642:

Consistent handling of errors reported from the lower layer.


# 310773 29-Dec-2016 tuexen

MFC r310590:

Whitespace changes.

The toolchain for processing the sources has been updated. No functional
change.


# 310222 18-Dec-2016 tuexen

MFC r309743:

Don't send multiple SHUTDOWN chunks in a single packet.

Thanks to Felix Weinrank for making me aware of this issue.


# 310221 18-Dec-2016 tuexen

MFC r309685:

Silence a warning produced by newer versions of gcc.


# 310219 18-Dec-2016 tuexen

MFC r309682:

Cleanup the names of SSN, SID, TSN, FSN, PPID and MID.

This made a couple of bugs visible in handling SSN wrap-arounds
when using DATA chunks. Now bulk transfer seems to work fine...
This fixes the issue reported in
https://github.com/sctplab/usrsctp/issues/111


# 310217 18-Dec-2016 tuexen

MFC r307779:

No functional changes, mostly getting the whitespace changes resulting
from an updated formatting tool chain.


# 304792 25-Aug-2016 tuexen

MFC r304543:
Unbreak sctp_connectx().

MFC r304573:
Remove duplicate code, which is not protected by the appropriate locks.

MFC r304579:
Improve the locking when sending user messages.

First, keep a ref count on the stcb after looking it up, as
done in the other lookup cases.
Second, before looking again at sp, ensure that it is not
freed, because the assoc is about to be freed.


# 303956 11-Aug-2016 tuexen

MFC r303792:
Fix various bugs in relation to the I-DATA chunk support
This is joint work with rrs.

MFC r303793:
Mark an unused parameter as such.

MFC r303798:
Don't modify a structure without holding a reference count on it.

MFC r303813:
Remove stream queue entry consistently from wheel.
While there, improve the handling of drain.

MFC r303819:
Consistently check for unsent data on the stream queues.

MFC r303831:
Fix a locking issue found by stress testing with tsctp.
The inp read lock neeeds to be held when considering control->do_not_ref_stcb.

MFC r303834:
Fix the sending of FORWARD-TSN and I-FORWARD-TSN chunks. The
last SID/SSN pair wasn't filled in.
Thanks to Julian Cordes for providing a packetdrill script
triggering the issue and making me aware of the bug.

Approved by: re (kib)


# 303267 24-Jul-2016 tuexen

MFC r302904:
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 r302907:
When calling netstat -Laptcp the local address values are not aligned
with the corresponding entry in the table header. r295136
increased the value width from 14 to 32 without the corresponding
change to the table header. This commit adds the change to the table
header width.

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

MFC r302928:
Address a potential memory leak found a the clang static code analyzer
running on the userland stack.

MFC r302930:
Don't free a data chunk twice.
Found by the clang static code analyzer running for the userland stack.

MFC r302935:
Deal with a portential memory allocation failure, which was reported
by the clang static code analyzer.
Joint work with rrs@.

MFC r302942:
Add missing sctps_reasmusrmsgs counter.
Joint work with rrs@.

MFC r302945:
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 r302949:
Fix the PR-SCTP behaviour.
This is done by rrs@.

MFC r302950:
Add a constant required by RFC 7496.

MFC r303024:
netstat and sockstat expect the IPv6 link local addresses to
have an embedded scope. So don't recover.

MFC r303025:
Use correct order of conditions to avoid NULL deref.

MFC r303073:
Fix a bug in deferred stream reset processing which results
in using a length field before it is set.
Thanks to Taylor Brandstetter for reporting the issue and
providing a fix.

Approved by: re (kib)