aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/sctp_input.c
Commit message (Collapse)AuthorAgeFilesLines
* sctp, tcp, udp: improve deferred computation of checksumsTimo Völker46 hours1-1/+5
| | | | | | | | | | | | | | | | | | | | | | When the SCTP, TCP, or UDP implementation send a packet, it does not compute the corresponding checksum but defers that. The network layer will determine whether the network interface selected for the packet has the requested capability and computes the checksum in software, if the selected network interface doesn't have the requested capability. Do this not only for packets being sent by the local SCTP, TCP, and UDP stack, but also when forwarding packets. Furthermore, when such packets are delivered to a local SCTP, TCP, or UDP stack, do not compute or validate the checksum, since such packets never have been on the wire. This allows to support checksum offloading also in the case of local virtual machines or jails. Support for epair, vtnet, and tap interfaces will be added in separate commits. Reviewed by: kp, rgrimes, tuexen, manpages MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D51475
* sctp: store cookie secret change time as time_tMichael Tuexen2024-05-101-2/+2
| | | | | | | Reported by: Coverity Scan CID: 1492349 CID: 1493281 MFC after: 3 days
* sctp: don't provide uninitialized memory to process_chunk_drop()Michael Tuexen2024-05-081-0/+2
| | | | | | | | | Right now, the code in process_chunk_drop() does not look the the corresponding fields. Therefore, no functional change intended. Reported by: Coverity Scan CID: 1472476 MFC after: 3 days
* sctp: improve sending of packets containing an INIT ACK chunkMichael Tuexen2024-02-241-1/+1
| | | | | | | If the peer announced support of zero checksums, do so when sending packets containing an INIT ACK chunk. MFC after: 1 week
* sctp: make sure all SCTP RESET notifications use sctp_ulp_notify()Michael Tuexen2023-09-081-16/+10
| | | | | | | While there, improve consistency of the notification related code. No functional change intended. MFC after: 3 days
* sctp: improve handling of SHUTDOWN and SHUTDOWN ACK chunksMichael Tuexen2023-08-231-12/+42
| | | | | | | | | When handling a SHUTDOWN or SHUTDOWN ACK chunk detect if the peer is violating the protocol by not having made sure all user messages are reveived by the peer. If this situation is detected, abort the association. MFC after: 1 week
* sctp: fix a warningMichael Tuexen2023-08-191-10/+5
| | | | | | | Fix an unused-but-set-variable warning for builds without INVARIANTS. Reported by: O. Hartmann MFC after: 1 week
* sctp: cleanup handling of graceful shutdown of the peerMichael Tuexen2023-08-191-48/+15
| | | | | | | | | | | Don't handle a graceful shutdown of the peer as an implicit signal that all partial messages are complete. First, this is not implemented correctly and second this should not be done by the peer. It is more appropriate to handle this as a protocol violation. Remove the incorrect code and leave detecting the protocol violation and its handling in a followup commit. MFC after: 1 week
* sctp: cleanup cdefs.h includeMichael Tuexen2023-08-181-1/+0
|
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sctp: update zero checksum supportMichael Tuexen2023-07-231-3/+8
| | | | | Implement support for the error detection method identifier. MFC after: 2 weeks
* sctp: only start shutdown guard timer when sending SHUTDOWN chunkMichael Tuexen2023-05-031-14/+0
| | | | | | | The intention is to protect a malicious peer not following the shutdown procedures. MFC after: 1 week
* sctp: improve shutdown(..., SHUT_WR) handlingMichael Tuexen2023-05-031-6/+16
| | | | | | | | When shutdown(..., SHUT_WR) is called in the front states, send a SHUTDOWN chunk when a COOKIE ACK chunk is received and there is no outstanding data. MFC after: 1 week
* sctp: improve handling of stale cookie error causesMichael Tuexen2023-04-301-10/+31
| | | | | | | | | | | * If a measure of staleness of 0 is reported, use the RTT instead. * Ensure that we always send a cookie preservative parameter by rounding up during the calculation. * If allowed, perform a round trip time measurement. * Clear the overall error counter, since the error cause also acts like an ACK. MFC after: 1 week
* sctp: enforce Kahn's rule during the handshakeMichael Tuexen2023-03-161-10/+12
| | | | | | | Don't take RTT measurements on packets containing INIT or COOKIE-ECHO chunks, when they were retransmitted. MFC after: 1 week
* sctp: don't do RTT measurements with cookiesMichael Tuexen2023-03-161-16/+0
| | | | | | | | | | | | | | When receiving a cookie, the receiver does not know whether the peer retransmitted the COOKIE-ECHO chunk or not. Therefore, don't do an RTT measurement. It might be much too long. To overcome this limitation, one could do at least two things: 1. Bundle the INIT-ACK chunk with a HEARTBEAT chunk for doing the RTT measurement. But this is not allowed. 2. Add a flag to the COOKIE-ECHO chunk, which indicates that it is the initial transmission, and not a retransmission. But this requires an RFC. MFC after: 1 week
* sctp: improve negotiation of zero checksum featureMichael Tuexen2023-03-151-0/+2
| | | | | | | Enforce consistency between announcing 0-cksum support and actually using it in the association. The value from the inp when the INIT ACK is sent must be used, not the one from the inp when the cookie is received.
* sctp: initial implementation of draft-tuexen-tsvwg-sctp-zero-checksumMichael Tuexen2023-03-101-46/+111
|
* sctp: improve sending of ABORT packets in response to INIT-ACKsMichael Tuexen2022-10-121-1/+4
| | | | | | | | Ensure that the initiate tag of the INIT-ACK chunk is used as the verification tag of the packet containing the ABORT chunk. Reported by: Suganya Dharma MFC after: 1 week
* sctp: improve handling of sctp inpcb flagsMichael Tuexen2022-06-041-5/+4
| | | | | | | Use an atomic operation when the inp is not write locked. Reported by: syzbot+bf27083e9a3f8fde8b4d@syzkaller.appspotmail.com MFC after: 3 days
* sctp: cleanup, no functional change intendedMichael Tuexen2022-05-141-1/+1
| | | | MFC after: 3 days
* sctp: improve consistencyMichael Tuexen2022-05-141-8/+8
| | | | | | No functional change intended. MFC after: 3 days
* sctp: improve lockingMichael Tuexen2022-04-151-4/+11
| | | | | | | Hold a refcount while giving up an stcp lock. This issue was found by running syzkaller. MFC after: 3 days
* sctp: fix typosMichael Tuexen2022-03-291-10/+10
| | | | | | Thanks to David Sanders for fixing the typos in the userland stack. MFC after: 3 days
* sctp: get rid of stcb send lockMichael Tuexen2022-03-281-7/+4
| | | | | | | | Just use the stcb lock instead to simplify locking. Reported by: syzbot+d00b202063150f85b110@syzkaller.appspotmail.com Reported by: syzbot+87f268a0a6d2d6383306@syzkaller.appspotmail.com MFC after: 3 days
* sctp: improve counting of incoming chunksMichael Tuexen2022-01-011-0/+2
| | | | MFC after: 3 days
* sctp: improve sctp_pathmtu_adjustment()Michael Tuexen2021-12-301-3/+3
| | | | | | | | | | Allow the resending of DATA chunks to be controlled by the caller, which allows retiring sctp_mtu_size_reset() in a separate commit. Also improve the computaion of the overhead and use 32-bit integers consistently. Thanks to Timo Voelker for pointing me to the code. MFC after: 3 days
* sctp: improve consistency, no functional change intendedMichael Tuexen2021-11-261-1/+1
|
* sctp: Fix a typo in a commentGordon Bergling2021-09-261-1/+1
| | | | | | - s/assue/assume/ MFC after: 3 days
* sctp: Simplify stream scheduler usageMichael Tuexen2021-09-211-2/+2
| | | | | | | | Callers are getting the stcb send lock, so just KASSERT that. No need to signal this when calling stream scheduler functions. No functional change intended. MFC after: 1 week
* sctp: cleanup, no functional change intendedMichael Tuexen2021-09-151-3/+2
| | | | MFC after: 1 week
* sctp: avoid LORMichael Tuexen2021-09-121-3/+1
| | | | | | | Don't lock the inp-info lock while holding an stcb lock. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31921
* sctp: Tighten up locking around sctp_aloc_assoc()Mark Johnston2021-09-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All callers of sctp_aloc_assoc() mark the PCB as connected after a successful call (for one-to-one-style sockets). In all cases this is done without the PCB lock, so the PCB's flags can be corrupted. We also do not atomically check whether a one-to-one-style socket is a listening socket, which violates various assumptions in solisten_proto(). We need to hold the PCB lock across all of sctp_aloc_assoc() to fix this. In order to do that without introducing lock order reversals, we have to hold the global info lock as well. So: - Convert sctp_aloc_assoc() so that the inp and info locks are consistently held. It returns with the association lock held, as before. - Fix an apparent bug where we failed to remove an association from a global hash if sctp_add_remote_addr() fails. - sctp_select_a_tag() is called when initializing an association, and it acquires the global info lock. To avoid lock recursion, push locking into its callers. - Introduce sctp_aloc_assoc_connected(), which atomically checks for a listening socket and sets SCTP_PCB_FLAGS_CONNECTED. There is still one edge case in sctp_process_cookie_new() where we do not update PCB/socket state correctly. Reviewed by: tuexen MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31908
* sctp: minor cleanups, no functional change intendedMichael Tuexen2021-09-081-2/+2
|
* sctp: Remove an unused sctp_inpcb fieldMark Johnston2021-09-071-1/+0
| | | | | | | | | | This appears to be unused in usrsctp as well. No functional change intended. Reviewed by: tuexen MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31812
* sctp: Always check for a vanishing inpcb when processing COOKIE-ECHOMark Johnston2021-09-011-5/+5
| | | | | | | | | | | | | | We previously did this only in the normal case where no association exists yet. However, it is not safe to process COOKIE-ECHO even if an association exists, as sctp_process_cookie_existing() may dereference the socket pointer. See also commit 0c7dc84076b64ef74c24f04400d572f75ef61bb4. Reviewed by: tuexen MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31755
* sctp: improve handling of illegal parameters of INIT-ACK chunksMichael Tuexen2021-08-201-43/+26
| | | | MFC after: 3 days
* sctp: improve handling of INIT chunks with invalid parametersMichael Tuexen2021-08-181-16/+16
| | | | MFC after: 3 days
* sctp: Fix errno in case of association setup failuresMichael Tuexen2021-07-091-4/+4
| | | | | | | Do not report always ETIMEDOUT, but only when appropriate. In other cases report ECONNABORTED. MFC after: 3 days
* sctp: initialize sequence numbers for ECN correctlyMichael Tuexen2021-06-271-9/+2
| | | | | MFC after: 3 days Reported by: Junseok Yang (for the userland stack)
* sctp: Fix length check for ECNE chunksMichael Tuexen2021-06-271-5/+2
| | | | MFC after: 3 days
* sctp: fix another locking bug in COOKIE handlingMichael Tuexen2021-05-121-2/+8
| | | | | | | Thanks to Tolya Korniltsev for reporting the issue for the userland stack and testing the fix. MFC after: 3 days
* sctp: fix locking in case of error handling during a restartMichael Tuexen2021-05-121-0/+10
| | | | | | | Thanks to Taylor Brandstetter for finding the issue and providing a patch for the userland stack. MFC after: 3 days
* sctp: improve consistency when handling chunks of wrong sizeMichael Tuexen2021-05-051-6/+8
| | | | MFC after: 3 days
* sctp: drop packet with SHUTDOWN-ACK chunks with wrong vtagsMichael Tuexen2021-05-041-21/+0
| | | | MFC after: 3 days
* sctp: improve restart handlingMichael Tuexen2021-05-031-8/+12
| | | | | | | This fixes in particular a possible use after free bug reported Anatoly Korniltsev and Taylor Brandstetter for the userland stack. MFC after: 3 days
* Fix build after 5f2e1835054ee84f2e68ebc890d92716a91775b7.Alexander Motin2021-05-031-1/+1
|
* sctp: improve error handling in INIT/INIT-ACK processingMichael Tuexen2021-05-021-29/+72
| | | | | | | | When processing INIT and INIT-ACK information, also during COOKIE processing, delete the current association, when it would end up in an inconsistent state. MFC after: 3 days
* sctp: improve consistency in handling chunks with wrong sizeMichael Tuexen2021-04-281-76/+74
| | | | | Just skip the chunk, if no other handling is required by the specification.
* sctp: cleanup verification of INIT and INIT-ACK chunksMichael Tuexen2021-04-271-84/+10
|