4922 Commits

Author SHA1 Message Date
tuexen
1dededab5d MFC r294057:
Fix a bug in INIT handling on accepted 1-to-1 style sockets when the
listener is closed.
This fix allows the following packetdrill test to pass:
// Setup a connected, blocking 1-to-1 style socket
+0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3
// Check the handshake with en empty(!) cookie
+0.0 bind(3, ..., ...) = 0
+0.0 listen(3, 1) = 0
+0.0 < sctp: INIT[flgs=0, tag=1, a_rwnd=1500, os=1, is=1, tsn=1]
+0.0 > sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=..., os=..., is=..., tsn=1, ...]
+0.0 < sctp: COOKIE_ECHO[flgs=0, len=..., val=...]
+0.0 > sctp: COOKIE_ACK[flgs=0]
+0.0 accept(3, ..., ...) = 4
+0.0 close(3) = 0
// Inject an INIT chunk and expect an INIT-ACK
+0.0 < sctp: INIT[flgs=0, tag=3, a_rwnd=1500, os=1, is=1, tsn=1]
+0.0 > sctp: INIT_ACK[flgs=0, tag=..., a_rwnd=..., os=..., is=..., tsn=..., ...]
2016-01-17 14:14:12 +00:00
tuexen
07abd2982e MFC r293913:
Fail the SCTP_GET_ASSOC_NUMBER and SCTP_GET_ASSOC_ID_LIST
socket options for 1-to-1 style sockets as specified in RFC 6458.
2016-01-17 14:10:37 +00:00
tuexen
a1b057e476 MFC r293828:
Store the timer type for logging, because the timer can be freed
during processing the timerout.
2016-01-17 14:00:24 +00:00
tuexen
51d567a324 MFC r292734:
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.
2016-01-17 12:41:46 +00:00
tuexen
a7d5fa045f MFC r292558:
Stop processing of a SACK when the association has been aborted.
2016-01-17 12:39:35 +00:00
tuexen
2c9e1a88dc MFC r292060:
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+.
2016-01-17 12:18:01 +00:00
tuexen
70ab0ed557 MFC r291904:
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.
2016-01-17 12:15:41 +00:00
tuexen
08b1ba6353 MFC r291752:
Fix a bug where a stream reset request wasn't retranmitted when the
peer indicated "In progress".
2016-01-17 12:13:21 +00:00
tuexen
7daacffc9c MFC r291700:
Ensure that outgoing streams get reset when they run dry.
2016-01-17 12:07:47 +00:00
tuexen
d541ac04b1 MFC r291659:
Minor cleanup. No functional change.
2016-01-17 12:05:44 +00:00
tuexen
5948dfd0db MFC r291651:
Adjust the MTU when accepting an SCTP association using
UDP encapsulation.
2016-01-17 12:03:59 +00:00
tuexen
606cd2bce6 MFC r291410:
Take also the send queue and sent queue into account when triggering
the sending of outgoing stream reset requests.
2016-01-17 12:02:04 +00:00
tuexen
6d8c03a8e7 MFC r291376:
When the sending of an SCTP outgoing stream reset request fails,
don't report it to the user since all stream have been marked
as pending.
2016-01-17 11:59:42 +00:00
tuexen
28f497d302 MFC r291364:
When receiving an SCTP/UDP packet and the interface performed
the UDP checksum computation and signals that it was OK,
clear this bit when passing the packet to SCTP. Since the
bits indicating a valid UDP checksum and a valid SCTP
checksum are the same, the SCTP stack would assume
that also an SCTP checksum check has been performed.
2016-01-16 18:59:10 +00:00
tuexen
9ca478ea2c MFC r291141:
Fix the handling of IPSec policies in the SCTP stack. At least
make sure they are not leaked...
2016-01-16 18:20:47 +00:00
tuexen
2c71b0cb5a MFC r291140:
Revert part of r291137 which seems correct, bit does not fix the
resource problem I'm currently hunting down.
2016-01-16 18:18:47 +00:00
tuexen
4c424eca56 MFC r291138:
Clear the so_pcb pointer in case of ipsec_init_policy() fails.
2016-01-16 18:15:41 +00:00
tuexen
0e3a8a377d MFC r291137:
Don't send SHUTDOWN chunk when the association is in a front state
and the applications calls shutdown(..., SHUT_WR) or
shutdown(..., SHUT_RDWR).
2016-01-16 18:13:33 +00:00
tuexen
899778209f MFC r291078:
Fix a bug where an SCTP association was moved back to SHUTDOWN_SENT
state when the user issued a shutdown() call.
2016-01-16 18:11:17 +00:00
tuexen
3f469327b2 MFC r290468:
Use the correct length. The wrong one was too large.
2016-01-16 18:08:05 +00:00
tuexen
77521945a3 MFC r290444:
The field sinfo_timetolive should have been sinfo_pr_value.
Thanks to Jens Hoelscher for making me aware of the bug.
2016-01-16 18:05:24 +00:00
tuexen
f5e0149b5f MFC r290442:
Fix typos in field names of struct sctp_extrcvinfo.
Provide defines to allow applications to compile.
Thanks to Jens Hoelscher for making me aware of the typos.
2016-01-16 18:03:12 +00:00
tuexen
0abbe1fcee MFC r290023:
When processing a cookie, any mismatch in port numbers or the vtag results
in failing the check.
This fixes https://github.com/nplab/ETSI-SCTP-Conformance-Testsuite/blob/master/sctp-imh-tests/sctp-imh-i-3-3.pkt
2016-01-16 18:00:47 +00:00
tuexen
22f077551b MFC r289570:
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.
2016-01-16 17:56:06 +00:00
tuexen
ee86c09c66 MFC r289240:
Fix the timeout for INIT retransmissions in the case where RTO_MIN is
smaller than RTO_INITIAL.
2016-01-16 17:53:04 +00:00
tuexen
2dd9413da1 MFC r287725:
Fix compilation issue introduced in r287717.
Thanks to bz@ for making me aware of it.
2016-01-16 17:50:43 +00:00
tuexen
1011450ebc MFC r287719:
Address a compile warning.
2016-01-16 16:52:50 +00:00
tuexen
573e8b2d9d MFC r287717:
Cleanup the handling of error causes for ERROR chunks. This fixes
an inconsistency of the padding handling. The final padding is
now considered to be a chunk padding.
2016-01-16 16:46:00 +00:00
tuexen
28a0b48157 MFC r287669:
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.
2016-01-16 16:42:40 +00:00
tuexen
52bf51b039 MFC r287535:
RFC 4960 requires that packets containing an INIT chunk bundled with
another chunk are silently discarded. Do so, instead of sending an
ABORT.
2016-01-16 14:54:43 +00:00
tuexen
fe5ee5dcb3 MFC r287457:
Don't leak memory in an error case.
2016-01-16 14:52:29 +00:00
tuexen
6ec65b594f MFC r287456:
Add a NULL pointer check to silence the clang code analyzer.
2016-01-16 14:50:43 +00:00
tuexen
f7eeeeafb4 MFC r287444:
Fix a bug where two SHUTDOWN_ACK chunks were sent if a SHUTDOWN chunk was
received acking all outstanding data.
2016-01-16 14:48:54 +00:00
tuexen
d143500d09 MFC r287294:
Use 5 times RTO.Max as the default for the shutdown guard timer
as required by RFC 4960. The sysctl variable can be used to
overwrite this.
2016-01-16 14:46:27 +00:00
tuexen
9b0e77811d MFC r287282:
Fix the exporting of SCTP association states to userland. Without this,
associations in SHUTDOWN-PENDING were never reported correctly.
2016-01-16 14:41:44 +00:00
tuexen
65380e690e MFC r286781:
Allow the path MTU to grow up to the outgoing interface MTU.
2016-01-16 12:50:00 +00:00
tuexen
e9656ef0ca MFC r286206:
Don't take the port numbers for packets containing ABORT chunks from
a freed mbuf. Just use them from the stcb.
2016-01-16 12:47:28 +00:00
tuexen
6820f265d4 MFC r285938:
Fix a typo reported by Erik Cederstrand.
2016-01-16 12:43:02 +00:00
tuexen
da5ed4b9f2 MFC r285925:
Provide consistent error causes whenever an ABORT chunk is sent.
2016-01-16 12:40:43 +00:00
tuexen
8f5ae92cf3 MFC r285887:
Improve locking on Mac OS X. This does not change the functionality
on FreeBSD.
2016-01-16 12:38:14 +00:00
tuexen
d3f762120a MFC r285886:
Fix and improve a debug message. The SID was reported as an SSN.
2016-01-16 12:36:09 +00:00
tuexen
a07b11560a MFC r285877:
Move including netinet/icmp6.h around to avoid a problem when including
netinet/icmp6.h and net/netmap.h. Both use ni_flags...
This allows to build multistack with SCTP support.
2016-01-16 12:33:45 +00:00
tuexen
b5c94b6d8f MFC r285837, r285838
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.
2016-01-16 12:20:47 +00:00
tuexen
8553fd6954 MFC r285792:
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.
2016-01-16 12:15:07 +00:00
tuexen
3dd58256b8 MFC r285237:
Export the ssthresh value per SCTP path via the sysctl interface.
2016-01-16 11:19:08 +00:00
glebius
924e9fd65e o Fix SCTP ICMPv6 error message vulnerability. [SA-16:01.sctp]
o Fix Linux compatibility layer incorrect futex handling. [SA-16:03.linux]
o Fix Linux compatibility layer setgroups(2) system call. [SA-16:04.linux]
o Fix TCP MD5 signature denial of service. [SA-16:05.tcp]
o Fix insecure default bsnmpd.conf permissions. [SA-16:06.bsnmpd]

Security:	FreeBSD-SA-16:01.sctp, CVE-2016-1879
Security:	FreeBSD-SA-16:03.linux, CVE-2016-1880
Security:	FreeBSD-SA-16:04.linux, CVE-2016-1881
Security:	FreeBSD-SA-16:05.tcp, CVE-2016-1882
Security:	FreeBSD-SA-16:06.bsnmpd, CVE-2015-5677
2016-01-14 09:11:42 +00:00
hiren
8a453508e4 MFC: r292011
MFC: r292012

Add an option to use rfc6675 based pipe/inflight bytes calculation in cubic and
newreno.
2016-01-11 23:37:31 +00:00
hiren
d2c2a54e08 MFC: r292003
Improve tcp duplicate ack processing when SACK is present.
2016-01-11 23:34:29 +00:00
hiren
4c421d2677 MFC: r290122
Calculate the correct amount of bytes that are in-flight for a connection as
suggested by RFC 6675.

MFC: r292046
r290122 added 4 bytes and removed 8 in struct sackhint. Add a pad entry of 4
bytes to restore the size.
2016-01-11 23:31:13 +00:00
stas
e4679b3dbb MFC r277938 (by hiren): make syncookie_mac() use 'tcp_seq irs' in computing hash. 2016-01-08 00:46:28 +00:00