summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_output.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r295549:tuexen2016-02-251-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Loopback addresses are 127.0.0.0/8, not 127.0.0.1/32. MFC r295668: Improve the teardown of the SCTP stack. MFC r295670: Whitespace changes. MFC r295708: Address a warning reported by D5245 / PVS. MFC r295709: Code cleanup which will silence a warning in PVS / D5245. MFC r295710: Add protection code for issues reported by PVS / D5245. MFC r295771: Fix reporting of mapped addressed in getpeername() and getsockname() for IPv6 SCTP sockets. This bugs were found because of an issue reported by PVS / D5245. MFC r295772: Add some protection code. MFC r295773: Add protection code. MFC r295805: Use the SCTP level pointer, not the interface level. MFC r295929: Don't leak an address in an error path. Approved by: re (marius)
* MFC r294995:tuexen2016-02-031-46/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Always look in the TCP pool. This fixes issues with a restarting peer when the listening 1-to-1 style socket is closed. MFC r295021: Remove debug output which was committed by accident. Thanks to Oliver Pinter for reporting. MFC r295069: Ignore peer addresses in a consistent way also when checking for new addresses during restart. If this is not done, restart doesn't work when the local socket is IPv4 only and the peer uses IPv4 and IPv6 addresses. MFC r295070: Don't change the remote UDP encapsulation port for SCTP packets containing an INIT chunk. MFC r295072: Don't allow a remote encapsulation port change during the SCTP restart procedure. MFC r295075: Update the path mtu when turning on/off UDP encapsulation for SCTP. MFC r295077: Add missing parentheses. This was reported by ccaughie via GitHub for the userland stack. Approved by: re (kib)
* MFC r292734:tuexen2016-01-171-4/+1
| | | | | | | Don't implicitly terminate a user message when moving it to the send_queue and the socket is closed. This results in strange race conditions for the application. While there, remove a stray character.
* MFC r292060:tuexen2016-01-171-7/+0
| | | | | | | | | Retire sctp_validate_no_locks(). This routine checks that there are no locks held for an inp, without having any lock on the inp. This breaks if the inp goes away when it is called. This happens on stress tests on a RPi B+.
* MFC r291904:tuexen2016-01-171-2/+4
| | | | | | | | | Fix the allocation of outgoing streams: * When processing a cookie, use the number of streams announced in the INIT-ACK. * When sending an INIT-ACK for an existing association, use the value from the association, not from the end-point.
* MFC r291700:tuexen2016-01-171-2/+3
| | | | Ensure that outgoing streams get reset when they run dry.
* MFC r291659:tuexen2016-01-171-1/+1
| | | | Minor cleanup. No functional change.
* MFC r291410:tuexen2016-01-171-4/+8
| | | | | Take also the send queue and sent queue into account when triggering the sending of outgoing stream reset requests.
* MFC r289570:tuexen2016-01-161-5/+5
| | | | | | | Use __func__ instead of __FUNCTION__. This allows to compile the userland stack without errors using gcc5. Thanks to saghul for makeing me aware and providing the patch.
* MFC r287669:tuexen2016-01-161-13/+31
| | | | | | | Ensure that ERROR chunks are always padded by implementing this in the routine, which queues an ERROR chunk, instead on relyinh on the callers to do so. Since one caller missed this, this actially fixes a bug.
* MFC r287457:tuexen2016-01-161-0/+5
| | | | Don't leak memory in an error case.
* MFC r285925:tuexen2016-01-161-8/+26
| | | | Provide consistent error causes whenever an ABORT chunk is sent.
* MFC r285837, r285838tuexen2016-01-161-4/+11
| | | | | | | Fix an issue with MAC OS locking and also optimize the case where we are sending back a stream-reset and a sack timer is running, in that case we should just send the SACK. Fix silly syntax error emacs chugged in for me.. gesh.
* MFC r285792:tuexen2016-01-161-29/+212
| | | | | | | | Fix several problems with Stream Reset. 1) We were not handling (or sending) the IN_PROGRESS case if the other side (or our side) was not able to reset (awaiting more data). 2) We would improperly send a stream-reset when we should not. Not waiting until the TSN had been assigned when data was inqueue.
* MFC r284515:tuexen2015-06-201-12/+13
| | | | | | | Add FIB support for SCTP. This fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200379 PR: 200379
* MFC r284331:tuexen2015-06-161-68/+45
| | | | Code cleanup.
* MFC r284326:tuexen2015-06-161-2/+11
| | | | | | | | | | | | | | | In case of an output error, continue with the next net, don't try to continue sending on the same net. This fixes a bug where an invalid mbuf chain was constructed, if a full size frame of control chunks should be sent and there is a output error. Based on a discussion with rrs@, change move to the next net. This fixes the bug and improves the behaviour. Thanks to Irene Ruengeler for spending a lot of time in narrowing this problem down.
* MFC r283691:tuexen2015-05-311-2/+0
| | | | Remove printf() noise...
* MFC r283665:tuexen2015-05-311-14/+18
| | | | | | | | Take source and destination address into account when determining the scope. This fixes a problem when a client with a global address connects to a server with a private address. Thanks to Irene Ruengeler in helping me to find the issue.
* MFC r283664:tuexen2015-05-311-8/+0
| | | | Retire SCTP_DONT_DO_PRIVADDR_SCOPE which was never defined.
* MFC r283662:tuexen2015-05-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a bug where messages would not be sent in SHUTDOWN_RECEIVED state. This problem was reported by Mark Bonnekessel and Markus Boese. Thanks to Irene Ruengeler for helping me to fix the cause of the problem. It can be tested with the following packetdrill script: +0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3 +0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) +0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 // Check the handshake with an empty(!) cookie +0.1 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) +0.0 > sctp: INIT[flgs=0, tag=1, a_rwnd=..., os=..., is=..., tsn=0, ...] +0.1 < sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=10000, os=1, is=1, tsn=0, STATE_COOKIE[len=4, val=...]] +0.0 > sctp: COOKIE_ECHO[flgs=0, len=4, val=...] +0.1 < sctp: COOKIE_ACK[flgs=0] +0.0 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 +0.0 write(3, ..., 1024) = 1024 +0.0 > sctp: DATA[flgs=BE, len=1040, tsn=0, sid=0, ssn=0, ppid=0] +0.0 write(3, ..., 1024) = 1024 // Pending due to Nagle +0.0 < sctp: SHUTDOWN[flgs=0, cum_tsn=0] +0.0 > sctp: DATA[flgs=BE, len=1040, tsn=1, sid=0, ssn=1, ppid=0] +0.0 < sctp: SACK[flgs=0, cum_tsn=1, a_rwnd=10000, gaps=[], dups=[]] // Do we need another SHUTDOWN here? +0.0 > sctp: SHUTDOWN_ACK[flgs=0] +0.0 < sctp: SHUTDOWN_COMPLETE[flgs=0] +0.0 close(3) = 0
* MFC r283658:tuexen2015-05-311-14/+17
| | | | | Use macros for overhead in a consistent way. No functional change. Thanks to Irene Ruengeler for suggesting the change.
* MFC r283650:tuexen2015-05-311-5/+9
| | | | | Fix and cleanup the debug information. This has no user-visible changes. Thanks to Irene Ruengeler for proving a patch.
* MFC r283648:tuexen2015-05-311-3/+0
| | | | Address some compiler warnings. No functional change.
* MFC r280714:tuexen2015-05-291-19/+4
| | | | | | | Improve the selection of the destination address of SACK chunks. This fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196755 and is joint work with rrs@.
* MFC r280371:tuexen2015-05-291-2/+0
| | | | Remove a useless assignment.
* MFC r277350:tuexen2015-05-291-1/+1
| | | | | | | | Fix a bug which only shows up when an mbuf allocation failed. Therefore chances are low that we hit this. Reported by: Coverity CID: 1018886
* MFC r277053:tuexen2015-05-291-8/+2
| | | | | | | Remove dead code. Reported by: Coverity CID: 748664
* MFC r276914:tuexen2015-05-291-56/+8
| | | | | Minimize the usage of SCTP_BUF_IS_EXTENDED. This should help Robert...
* MFC r273634:tuexen2015-05-291-2/+3
| | | | | | | | Fix a use of an uninitialized variable by makeing sure that sctp_med_chunk_output() always initialized the reason_code instead of relying on the caller. The variable is only used for debugging purpose. This issue was reported by Peter Bostroem from Google.
* MFC r275358 r275483 r276982 - Removing M_FLOWID by hps@hiren2015-04-241-36/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r275358: Start process of removing the use of the deprecated "M_FLOWID" flag from the FreeBSD network code. The flag is still kept around in the "sys/mbuf.h" header file, but does no longer have any users. Instead the "m_pkthdr.rsstype" field in the mbuf structure is now used to decide the meaning of the "m_pkthdr.flowid" field. To modify the "m_pkthdr.rsstype" field please use the existing "M_HASHTYPE_XXX" macros as defined in the "sys/mbuf.h" header file. This patch introduces new behaviour in the transmit direction. Previously network drivers checked if "M_FLOWID" was set in "m_flags" before using the "m_pkthdr.flowid" field. This check has now now been replaced by checking if "M_HASHTYPE_GET(m)" is different from "M_HASHTYPE_NONE". In the future more hashtypes will be added, for example hashtypes for hardware dedicated flows. "M_HASHTYPE_OPAQUE" indicates that the "m_pkthdr.flowid" value is valid and has no particular type. This change removes the need for an "if" statement in TCP transmit code checking for the presence of a valid flowid value. The "if" statement mentioned above is now a direct variable assignment which is then later checked by the respective network drivers like before. r275483: Remove M_FLOWID from SCTP code. r276982: Remove no longer used "M_FLOWID" flag from mbuf.h and update the netisr manpage. Note: The FreeBSD version has been bumped. Reviewed by: hps, tuexen Sponsored by: Limelight Networks
* MFC r272841:tuexen2014-10-121-24/+27
| | | | | Ensure that the flags field of sctp_tmit_chunks is initialized. Thanks to Peter Bostroem from Google for reporting the issue.
* MFC r272751:tuexen2014-10-121-1/+9
| | | | | | Ensure that the list of streams sent in a stream reset parameter fits in an mbuf-cluster. Thanks to Peter Bostroem for drawing my attention to this part of the code.
* MFC r272571:tuexen2014-10-121-7/+0
| | | | Remove unused MC_ALIGN macro as suggested by Robert.
* MFC r271643:tuexen2014-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chunk IDs are 8 bit entities, not 16 bit. Thanks to Peter Kasting from Google for drawing my attention to it. MFC r271665: The MTU is handled as a 32-bit entity within the SCTP stack. This was reported by Peter Kasting from Google. MFC r271670: Make a type conversion explicit. When compiling this code on Windows as part of the SCTP userland stack, this fixes a warning reported by Peter Kasting from Google. MFC r271672: Small cleanup which addresses a warning regaring the truncation of a 64-bit entity to a 32-bit entity. This issue was reported by Peter Kasting from Google. MFC r271673: Use a consistent type for the number of HMAC algorithms. This fixes a bug which resulted in a warning on the userland stack, when compiled on Windows. Thanks to Peter Kasting from Google for reporting the issue and provinding a potential fix. MFC r271674: Add a explict cast to silence a warning when building the userland stack on Windows. This issue was reported by Peter Kasting from Google. Approved by: re (kib)
* MFC r270673:tuexen2014-09-181-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Announce SCTP support in the kern.features sysctl variables. MFC r270859: Enable SCTP support. It runs perfectly fine on a Wandboard quad. MFC r271204 with manual intervention: Fix the handling of sysctl variables when used with VIMAGE. While there do some cleanup of the code. MFC r271209: Fix a leak of an address, if the address is scheduled for removal and the stack is torn down. Thanks to Peter Bostroem and Jiayang Liu from Google for reporting the issue. MFC r271219: Use SYSCTL_PROC instead of SYSCTL_VNET_PROC. Suggested by: glebius@ MFC r271221: Use union sctp_sockstore instead of struct sockaddr_storage. This eliminates some warnings when building in userland. Thanks to Patrick Laimbock for reporting this issue. Remove also some unnecessary casts. There should be no functional change. MFC r271228: Address another warnings reported by Patrick Laimbock when compiling in userspace. While there, improve consistency. MFC r271230: Address warnings generated by the clang analyzer. Approved by: re (kib)
* MFC r269945:tuexen2014-08-221-0/+28
| | | | | | | | Add support for the SCTP_PR_STREAM_STATUS and SCTP_PR_ASSOC_STATUS socket options. This includes managing the correspoing stat counters. Add the SCTP_DETAILED_STR_STATS kernel option to control per policy counters on every stream. The default is off and only an aggregated counter is available. This is sufficient for the RTCWeb usecase.
* MFC r269858:tuexen2014-08-221-45/+41
| | | | | Add support for the SCTP_AUTH_SUPPORTED and SCTP_ASCONF_SUPPORTED socket options. Add also a sysctl to control the support of ASCONF.
* MFC r269527:tuexen2014-08-221-2/+7
| | | | | Add support for the SCTP_RECONFIG_SUPPORTED and the corresponding sysctl controlling the negotiation of the RE-CONFIG extension.
* MFC r269481:tuexen2014-08-221-3/+8
| | | | | | Add support for the SCTP_PKTDROP_SUPPORTED socket option and the corresponding sysctl variable. The default is off, since the specification is not an RFC yet.
* MFC r269475:tuexen2014-08-221-4/+4
| | | | | | | Add SCTP socket option SCTP_NRSACK_SUPPORTED to control the NRSACK extension. The default will still be off, since it it not an RFC (yet). Changing the sysctl name will be in a separate commit.
* MFC r269448:tuexen2014-08-221-18/+26
| | | | | | Add support for the SCTP_PR_SUPPORTED socket option as specified in http://tools.ietf.org/html/draft-ietf-tsvwg-sctp-prpolicies Add also a sysctl controlling the default of the end-points.
* MFC r269436, r269445:tuexen2014-08-221-4/+4
| | | | | | | | Cleanup the ECN configuration handling and provide an SCTP socket option for controlling ECN on future associations and get the status on current associations. A simialar pattern will be used for controlling SCTP extensions in upcoming commits.
* MFC r269376:tuexen2014-08-221-225/+194
| | | | | Cleanup sctp_send_initiate() and sctp_send_initiate_ack() to be in sync as much as possible. This simplifies upcoming changes.
* MFC r268526:tuexen2014-08-221-2/+9
| | | | Integrate upstream changes.
* MFC r267674:tuexen2014-06-231-6/+152
| | | | | | | | | Honor jails for unbound SCTP sockets when selecting source addresses, reporting IP-addresses to the peer during the handshake, adding addresses to the host, reporting the addresses via the sysctl interface (used by netstat, for example) and reporting the addresses to the application via socket options. This issue was reported by Bernd Walter.
* MFC r267105:tuexen2014-06-221-4/+4
| | | | | Use ENOBUFS instead of ENOMEM in error situations related to m_uiotombuf(). This was suggested by kevlo@.
* MFC r264017:tuexen2014-06-221-1/+2
| | | | | Increment the SSN only after processing the last fragment of an ordered user message.
* MFC r263237:tuexen2014-06-221-1/+10
| | | | | | | | | | * Provide information in error causes in ASCII instead of proprietary binary format. * Add support for a diagnostic information error cause. The code is sysctlable and the default is 0, which means it is not sent. This is joint work with rrs@.
* MFC r263096:tuexen2014-06-221-4/+4
| | | | | | | | | | Put the offset of the CRC32C in csum_data instead of 0. The virtio driver needs the offset to be stored in csum_data, like in the case for UDP and TCP. The virtio problem was reported by Niu Zhixiong <kaiaixi@gmail.com>, who helped in debugging and testing the patch.
OpenPOWER on IntegriCloud