aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/sctp_output.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix build issues for the userland stack on 32-bit platforms.Michael Tuexen2020-01-281-1/+1
| | | | | | | | Reported by: Felix Weinrank MFC after: 1 week Notes: svn path=/head/; revision=357197
* Don't make the sendall iterator as being up if it could not be started.Michael Tuexen2020-01-051-1/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=356378
* Make the message size limit used for SCTP_SENDALL configurable viaMichael Tuexen2020-01-041-2/+2
| | | | | | | | | a sysctl variable instead of a compiled in constant. This is based on a patch provided by nwhitehorn@. Notes: svn path=/head/; revision=356357
* Separate out SCTP related dtrace code.Michael Tuexen2019-10-141-1/+1
| | | | | | | | | | This is based on work done by markj@. Discussed with: markj@ MFC after: 3 days Notes: svn path=/head/; revision=353518
* Ensure that local variables are reset to their initial value whenMichael Tuexen2019-10-121-2/+4
| | | | | | | | | | | | | | 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 MFC after: 3 days Notes: svn path=/head/; revision=353452
* Fix the adding of padding to COOKIE-ECHO chunks.Michael Tuexen2019-10-051-2/+1
| | | | | | | | | | | 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 MFC after: 3 days Notes: svn path=/head/; revision=353119
* Improve the handling of state cookie parameters in INIT-ACK chunks.Michael Tuexen2019-09-011-7/+32
| | | | | | | | | | | | | | | | | 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 MFC after: 3 days Notes: svn path=/head/; revision=351654
* Fix build issues for the userland stack on Raspbian.Michael Tuexen2019-08-061-10/+9
| | | | Notes: svn path=/head/; revision=350625
* IPv6 cleanup: kernelBjoern A. Zeeb2019-08-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Finish what was started a few years ago and harmonize IPv6 and IPv4 kernel names. We are down to very few places now that it is feasible to do the change for everything remaining with causing too much disturbance. Remove "aliases" for IPv6 names which confusingly could indicate that we are talking about a different data structure or field or have two fields, one for each address family. Try to follow common conventions used in FreeBSD. * Rename sin6p to sin6 as that is how it is spelt in most places. * Remove "aliases" (#defines) for: - in6pcb which really is an inpcb and nothing separate - sotoin6pcb which is sotoinpcb (as per above) - in6p_sp which is inp_sp - in6p_flowinfo which is inp_flow * Try to use ia6 for in6_addr rather than in6p. * With all these gone also rename the in6p variables to inp as that is what we call it in most of the network stack including parts of netinet6. The reasons behind this cleanup are that we try to further unify netinet and netinet6 code where possible and that people will less ignore one or the other protocol family when doing code changes as they may not have spotted places due to different names for the same thing. No functional changes. Discussed with: tuexen (SCTP changes) MFC after: 3 months Sponsored by: Netflix Notes: svn path=/head/; revision=350531
* Fix the reporting of multiple unknown parameters in an received INITMichael Tuexen2019-08-011-26/+47
| | | | | | | | | | | chunk. This also plugs an potential mbuf leak. Thanks to Felix Weinrank for reporting this issue found by fuzz-testing the userland stack. MFC after: 3 days Notes: svn path=/head/; revision=350520
* When responding with an ABORT to an INIT chunk containing aMichael Tuexen2019-08-011-55/+35
| | | | | | | | | | | 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. MFC after: 3 days Notes: svn path=/head/; revision=350508
* Small cleanup, no functional change intended.Michael Tuexen2019-07-311-8/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=350488
* Consistently cleanup mbufs in case of other memory errors.Michael Tuexen2019-07-311-4/+10
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=350487
* Don't hold a mutex while calling sbwait. This was found by syzkaller.Michael Tuexen2019-07-231-4/+4
| | | | | | | | | Submitted by: rrs@ Reported by: markj@ MFC after: 1 week Notes: svn path=/head/; revision=350254
* Add support for MSG_EOR and MSG_EOF in sendmsg() for SCTP.Michael Tuexen2019-07-151-11/+25
| | | | | | | | | | | This is an FreeBSD extension, not covered by Posix. This issue was found by running syzkaller. MFC after: 1 week Notes: svn path=/head/; revision=349999
* When calling sctp_initialize_auth_params(), the inp must have atMichael Tuexen2019-07-141-4/+2
| | | | | | | | | | | least a read lock. To avoid more complex locking dances, just call it in sctp_aloc_assoc() when the write lock is still held. Reported by: syzbot+08a486f7e6966f1c3cfb@syzkaller.appspotmail.com MFC after: 1 week Notes: svn path=/head/; revision=349986
* Fix build issue for the userland stack.Michael Tuexen2019-03-241-18/+19
| | | | | | | | | Joint work with rrs@. MFC after: 1 week Notes: svn path=/head/; revision=345467
* Fox more signed unsigned issues. This time on the send path.Michael Tuexen2019-03-241-7/+7
| | | | | | | | | This is joint work with rrs@ and was found by running syzkaller. MFC after: 1 week Notes: svn path=/head/; revision=345466
* Limit the size of messages sent on 1-to-many style SCTP sockets with theMichael Tuexen2019-03-231-0/+13
| | | | | | | | | | | 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@. MFC after: 1 week Notes: svn path=/head/; revision=345461
* Limit the number of bytes which can be queued for SCTP sockets.Michael Tuexen2019-03-231-6/+1
| | | | | | | | | This is joint work with rrs@. Reported by: syzbot+307f167f9bc214f095bc@syzkaller.appspotmail.com MFC after: 1 week Notes: svn path=/head/; revision=345460
* Only reduce the PMTU after the send call. The only way to increase it, isMichael Tuexen2019-02-051-6/+10
| | | | | | | | | | | via PMTUD. This fixes an MTU issue reported by Timo Voelker. MFC after: 3 days Notes: svn path=/head/; revision=343770
* Support MSG_DONTWAIT in send*(2).Mark Johnston2019-01-041-1/+1
| | | | | | | | | | | | | | | As it does for recv*(2), MSG_DONTWAIT indicates that the call should not block, returning EAGAIN instead. Linux and OpenBSD both implement this, so the change makes porting easier, especially since we do not return EINVAL or so when unrecognized flags are specified. Submitted by: Greg V <greg@unrelenting.technology> Reviewed by: tuexen MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D18728 Notes: svn path=/head/; revision=342768
* Don't use a function when neither INET nor INET6 are defined.Michael Tuexen2018-11-061-0/+4
| | | | | | | | | | This is a valid case for the userland stack, where this fixes two set-but-not-used warnings in this case. Thanks to Christian Wright for reporting the issue. Notes: svn path=/head/; revision=340179
* Avoid truncating unrecognised parameters when reporting them.Michael Tuexen2018-10-071-34/+15
| | | | | | | | | | This resulted in sending malformed packets. Approved by: re (kib@) MFC after: 1 week Notes: svn path=/head/; revision=339221
* After allocating chunks set the fields in a consistent way.Michael Tuexen2018-10-011-5/+3
| | | | | | | | | | | | | 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. Approved by: re (kib@) MFC after: 1 week Notes: svn path=/head/; revision=339040
* Plug mbuf leaks in the SCTP output path in error cases.Michael Tuexen2018-09-301-0/+3
| | | | | | | | | Approved by: re (kib@) MFC after: 1 week CID: 1395307 Notes: svn path=/head/; revision=339027
* Fix the handling of ancillary data for SCTP socket. ImplementMichael Tuexen2018-09-301-26/+28
| | | | | | | | | | | | | | | | 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. Approved by: re (kib@) MFC after: 1 week Notes: svn path=/head/; revision=339024
* Increment the corresponding UDP stats counter (udps_opackets) whenMichael Tuexen2018-09-301-0/+9
| | | | | | | | | | | | | 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. Approved by: re (kib@) MFC after: 1 week Notes: svn path=/head/; revision=339022
* Fix typo in comment.Michael Tuexen2018-09-281-1/+1
| | | | | | | | | | Reported by: @danfe Approved by: re (kib@) MFC after: 1 week X-MFC: r338941 Notes: svn path=/head/; revision=339004
* Whitespace changes and fixing a typo. No functional change.Michael Tuexen2018-09-261-1/+1
| | | | | | | | Approved by: re (kib@) MFC after: 1 week Notes: svn path=/head/; revision=338941
* Add support for send, receive and state-change DTrace providers forMichael Tuexen2018-08-221-0/+5
| | | | | | | | | | | | SCTP. They are based on what is specified in the Solaris DTrace manual for Solaris 11.4. Reviewed by: 0mp, dteske, markj Relnotes: yes Differential Revision: https://reviews.freebsd.org/D16839 Notes: svn path=/head/; revision=338213
* Refactor the SHUTDOWN_PENDING state handling.Michael Tuexen2018-08-211-2/+0
| | | | | | | | | | | | This is not a functional change but a preperation for the upcoming DTrace support. It is necessary to change the state in one logical operation, even if it involves clearing the sub state SHUTDOWN_PENDING. MFC after: 1 month Notes: svn path=/head/; revision=338134
* Use the stacb instead of the asoc in state macros.Michael Tuexen2018-08-131-49/+49
| | | | | | | | This is not a functional change. Just a preparation for upcoming dtrace state change provider support. Notes: svn path=/head/; revision=337708
* Use consistently the macors to modify the assoc state.Michael Tuexen2018-08-131-6/+6
| | | | | | | No functional change. Notes: svn path=/head/; revision=337706
* Add explicit cast to silence a warning for the userland stack.Michael Tuexen2018-08-121-2/+2
| | | | | | | Thanks to Felix Weinrank for providing the patch. Notes: svn path=/head/; revision=337688
* Revert https://svnweb.freebsd.org/changeset/base/336503Michael Tuexen2018-07-191-82/+85
| | | | | | | since I also ran the export script with different parameters. Notes: svn path=/head/; revision=336508
* Whitespace changes due to change if ident.Michael Tuexen2018-07-191-85/+82
| | | | Notes: svn path=/head/; revision=336503
* Provide the ip6_plen in network byte order when calling ip6_output().Michael Tuexen2018-06-141-2/+2
| | | | | | | | This is not strictly required by ip6_output(), since it overrides it, but it is needed for upcoming dtrace support. Notes: svn path=/head/; revision=335179
* Whitespace changes.Michael Tuexen2018-06-141-1/+37
| | | | Notes: svn path=/head/; revision=335176
* Do the appropriate accounting when ip_output() fails.Michael Tuexen2018-05-211-2/+5
| | | | Notes: svn path=/head/; revision=333980
* netinet silence warningsMatt Macy2018-05-191-1/+1
| | | | Notes: svn path=/head/; revision=333869
* sctp_get_mbuf_for_msg() should honor the allinone parameter.Michael Tuexen2018-05-141-1/+1
| | | | | | | | 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. Notes: svn path=/head/; revision=333604
* Cleaup, no functional change.Michael Tuexen2017-12-131-4/+5
| | | | Notes: svn path=/head/; revision=326829
* Retire SCTP_WITH_NO_CSUM option.Michael Tuexen2017-12-071-32/+0
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=326672
* sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326023
* Allow the setting of the MTU for future paths using an SCTP socket option.Michael Tuexen2017-11-031-8/+4
| | | | | | | | | This functionality was missing. MFC after: 1 week Notes: svn path=/head/; revision=325370
* Fix parsing error when processing cmsg in SCTP send calls. Thei bug isMichael Tuexen2017-10-271-17/+22
| | | | | | | | | | 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. Notes: svn path=/head/; revision=325046
* Code cleanup, not functional change.Michael Tuexen2017-10-141-1/+4
| | | | | | | | | | This avoids taking a pointer of a packed structure which allows simpler compilation of the userland stack. MFC after: 1 week Notes: svn path=/head/; revision=324615
* Code cleanup, no functional change.Michael Tuexen2017-09-211-7/+3
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=323861
* Fix MTU computation. Coverity scanning usrsctp pointed to this code...Michael Tuexen2017-09-091-12/+14
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=323378