Commit Graph

202 Commits

Author SHA1 Message Date
Michael Tuexen
6ba22f19ca 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 after: 3 days
2014-06-20 13:26:49 +00:00
Michael Tuexen
4aa74d8b65 Remove unused code. This is triggered by the bugreport of Sylvestre Ledru
which deal with useless code in the user land stack:
https://bugzilla.mozilla.org/show_bug.cgi?id=1003929

MFC after: 3 days
2014-05-06 16:51:07 +00:00
Michael Tuexen
9ba5b6b730 Handle an edge case of address management similar to TCP.
This needs to be reconsidered when the address handling
will be reimplemented.
The patch is from rrs@.

MFC after: 3 days
2014-03-29 21:26:45 +00:00
Michael Tuexen
ff1ffd7499 * 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 after: 1 week
2014-03-16 12:32:16 +00:00
Michael Tuexen
c302aeb123 In
http://svnweb.freebsd.org/changeset/base/258221
I introduced a bug which initialized global locks
whenever the SCTP stack initialized. This was fixed in
http://svnweb.freebsd.org/changeset/base/258574
by rodrigc@. He just initialized the locks for
the default vnet. This fix reverts to the old
behaviour before r258221, which explicitly makes
sure it is only called once, because this works also on
other platforms.
MFC after: 3 days
X-MFC with: r258574.
2013-11-30 12:51:19 +00:00
Craig Rodrigues
c0c61281b4 Only initialize some mutexes for the default VNET.
In r208160, sctp_it_ctl was made a global variable, across all VNETs.
However, sctp_init() is called for every VNET that is created.  This results
in the same global mutexes which are part of sctp_it_ctl being initialized.  This can result
in crashes if many jails are created.

To reproduce the problem:
  (1)  Take a GENERIC kernel config, and add options for: VIMAGE, WITNESS,
       INVARIANTS.
  (2)  Run this command in a loop:
       jail -l -u root -c path=/ name=foo persist vnet && jexec foo ifconfig lo0 127.0.0.1/8 && jail -r foo

       (see http://lists.freebsd.org/pipermail/freebsd-current/2010-November/021280.html )

Witness will warn about the same mutex being initialized.

Fix the problem by only initializing these mutexes in the default VNET.
2013-11-25 18:49:37 +00:00
Michael Tuexen
dcb3fc4cd6 When determining if an address belongs to an stcb, take the address family
into account for wildcard bound endpoints.

MFC after: 3 days
2013-11-16 15:34:14 +00:00
Michael Tuexen
f4f34bde23 Cleanups which result in fixes which have been made upstream
and where partially suggested by Andrew Galante.
There is no functional change in FreeBSD.

MFC after: 3 days
2013-11-16 15:04:49 +00:00
Michael Tuexen
3b3d05d769 Unlock the lock before destroying it.
This issue was reported by Andrew Galante.

MFC after: 3 days
2013-11-03 14:00:17 +00:00
Michael Tuexen
b54ddf225f Changes from upstream to improve compilation when INET or INET6
or none of them is defined.

MFC after: 3 days
2013-11-02 20:12:19 +00:00
Michael Tuexen
daac3e7db6 Fix compilation if SCTP_DONT_DO_PRIVADDR_SCOPE is defined.
The issue was reported by Andrew Galante.

MFC after: 3 days
2013-10-28 20:32:37 +00:00
Michael Tuexen
ee1ccd9258 Fix a bug were only 2048 streams where usable even though more than
2048 streams were negotiated on the wire. While there, remove the
hard coded limit of 2048 streams.

MFC after: 3 days
2013-07-05 10:08:49 +00:00
Michael Tuexen
56f778aadf Code cleanups.
MFC after: 3 days
2013-07-03 18:48:43 +00:00
Michael Tuexen
3457ccdaea Honor the net.inet6.ip6.v6only sysctl variable and the IPV6_V6ONLY
socket option for SCTP sockets in the same way as for UDP or TCP
sockets.

MFC after: 2 weeks
2013-05-10 18:09:38 +00:00
Michael Tuexen
2416af26a0 Send the adaptation layer indication only if set by the user.
MFC after: 3 days
Discussed with: rrs
2013-02-11 21:02:49 +00:00
Michael Tuexen
c53f854a17 Don't send kernel provided information in the User Initiated
ABORT cause, since the user can also provide this kind of
information. So the receiver doesn't know who provided the
information.
While there: Fix a bug where the stack would send a malformed
ABORT chunk when using a send() call with SCTP_ABORT|SCT_SENDALL
flags.

MFC after: 3 days
2013-02-11 13:57:03 +00:00
Michael Tuexen
f0d44a49a0 Make sure that received packets for removed addresses are handled
consistently. While there, make variable names consistent.

MFC after: 3 days
2013-02-10 19:57:19 +00:00
Michael Tuexen
a1cb341b5d Cleanup the handling of address scopes. Announce in the INIT/INIT-ACK
only the supported address types. While there, do some whitespace
cleanups.

MFC after: 1 week
2013-02-09 17:26:14 +00:00
Michael Tuexen
c39cfa1f7e Fix a bug where HEARTBEATs were still sent in SHUTDOWN_SENT or
SHUTDOWN_ACK_SENT state. While there, make the corresponding
code consistent.

MFC after: 1 week
2013-02-09 08:27:08 +00:00
Michael Tuexen
72c123a8b4 Minor cleanups of debug messages.
MFC after: 3 days
2012-12-27 08:06:58 +00:00
Gleb Smirnoff
eb1b1807af Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags within sys.

Exceptions:

- sys/contrib not touched
- sys/mbuf.h edited manually
2012-12-05 08:04:20 +00:00
Michael Tuexen
e3976bb8d7 Find the endpoint for an incoming packet also if the endpoint
comes from sctp_peeloff().

MFC after: 3 days
2012-11-26 16:43:32 +00:00
Michael Tuexen
325c8c46b1 Get the accounting working. We now have counters how many
chunks for each SCTP outgoing stream are in the send and
sent queue.
While there, improve the naming of NR-SACK related constants
recently introduced.

MFC after: 1 week
2012-11-16 19:39:10 +00:00
Michael Tuexen
a7ad6026e0 Add per outgoing stream accounting for chunks in the send
and sent queue. This provides no functional change, but is
a preparation for an upcoming stream reset improvement.
Done with rrs@.

MFC after: 1 week
2012-11-07 22:11:38 +00:00
Michael Tuexen
e06f3469e0 Whitespace change.
MFC after:	3 days
2012-09-23 07:43:10 +00:00
Michael Tuexen
8225a9bc85 Whitespace changes.
MFC after: 10 days
2012-09-09 08:14:04 +00:00
Michael Tuexen
dd294dcec6 Using %p in a format string requires a void *.
MFC after: 10 days
2012-09-05 18:52:01 +00:00
Michael Tuexen
63c6726e05 Fix a refcount issue. The called only decrements is stcb is NULL.
MFC after:	3 days
Discussed with:	rrs
2012-08-05 10:47:18 +00:00
Michael Tuexen
832208514f Fix a bug reported by Simon L. B. Nielsen:
If an SCTP endpoint receives an ASCONF with a wildcard
lookup address and incorrect verification tag, the system
crashes.

MFC after:	3 days.
2012-08-04 20:40:36 +00:00
Michael Tuexen
d07b2ac6c6 Fix a refcount bug when freeing an association.
While there: Change code to be consistent.
Discussed with rrs@.
MFC after: 3 days
2012-07-17 13:03:47 +00:00
Michael Tuexen
e0e00a4d0f #ifdef INET and INET6 consistently. This also fixes a bug, where
it was done wrong.

MFC after: 3 days
2012-07-15 11:04:49 +00:00
Michael Tuexen
b5e0cd79c2 Use case for selecting the address family (as in other places).
MFC after: 3 days
2012-07-14 20:08:03 +00:00
Michael Tuexen
b1754ad17b Pass the src and dst address of a received packet explicitly around.
MFC after: 3 days
2012-06-28 16:01:08 +00:00
Michael Tuexen
2faa5be555 Remove code which is not needed.
MFC after: 3 days
2012-06-03 18:14:57 +00:00
Michael Tuexen
807aad636f Use consistent text at the begining of the files.
MFC after: 3 days
2012-05-23 11:26:28 +00:00
Michael Tuexen
1edc9dbae5 Provide in the SCTP_SEND_FAILED and SCTP_SEND_FAILED_EVENT notifications
the correct ssf_error or ssfe_error as required by RFC 6458.

MFC after: 3 days
2012-05-13 19:32:49 +00:00
Michael Tuexen
a2b42326b5 Provide in the association change notification the received ABORT chunk
if case of SCTP_COMM_LOST or SCTP_CANT_STR_ASSOC as required by RFC 6458.

MFC after: 3 days
2012-05-12 20:11:35 +00:00
Michael Tuexen
3f826ed2f3 Remove debug code.
MFC after: 3 days
2012-05-06 11:37:41 +00:00
Michael Tuexen
cd3fd53188 Use SCTP_PRINTF() instead of printf() in all SCTP sources.
MFC after: 3 days
2012-05-04 09:27:00 +00:00
Michael Tuexen
60990c0c06 Address issues found by clang. While there, fix also some style
issues.

MFC after: 3 months.
2011-12-27 10:16:24 +00:00
Michael Tuexen
7215cc1b74 Fix unused parameter warnings.
While there, fix some whitespace issues.

MFC after: 3 months.
2011-12-17 19:21:40 +00:00
Michael Tuexen
a56569ba55 Remove debug code.
MFC after: 1 month.
2011-11-28 20:48:35 +00:00
Michael Tuexen
c9c5805975 Add support for the SCTP_REMOTE_UDP_ENCAPS_PORT socket option.
Retire the the now unused sctp_udp_tunneling_for_client_enable
sysctl variable.

MFC after: 3 months.
2011-11-20 15:00:45 +00:00
Michael Tuexen
363114118b Cleanup comparison of interface names.
MFC after: 1 month.
2011-11-18 09:01:08 +00:00
Michael Tuexen
a62e467ac3 Set the MTU of an path to an approriate value if the interface MTU
can't be determined.

MFC after: 3 days.
2011-11-15 20:41:50 +00:00
Michael Tuexen
eb20220e9b Don't copy uninitialized memory. Also simplify the comparison
of interface names.

MFC after: 3 days.
2011-11-13 11:53:18 +00:00
Michael Tuexen
dc81ec897e When loading addresses from INITs, always use the correct
local address.

MFC after: 3 days.
2011-11-07 22:30:19 +00:00
Michael Tuexen
7ffa229018 When add a new remote address using sctp_add_remote_addr(),
return the correct net if requested.

MFC after: 3 days.
2011-10-27 22:38:48 +00:00
Michael Tuexen
3d2443cc84 When moving an stcb to a new inp and we copy over the list of
bound addresses, update the last used address pointer.
If not, it might result in a crash if the old inp goes away.

MFC after: 3 days.
2011-10-10 12:28:47 +00:00
Michael Tuexen
629749b60c Update the inp stored in a HB-timer when moving an stcb to a new inp.
Use only this stored inp when processing a HB timeout.
This fixes a bug which results in a crash.

MFC after: 3 days.
2011-10-09 14:12:17 +00:00