trociny [Sun, 12 Feb 2012 07:56:07 +0000 (07:56 +0000)]
MFC r230874:
Try to avoid ambiguity when sysctl returns ENOMEM additionally
checking the returned oldlen: when ENOMEM is due to the supplied
buffer being too short the return oldlen is equal to buffer size.
Without this additional check sockstat gets stuck in loop leaking the
memory if the returned ENOMEM was due the exceeded memorylocked
limit. This is easily can be observed running `limits -l 1k sockstat'.
trociny [Sun, 12 Feb 2012 07:53:02 +0000 (07:53 +0000)]
MFC r230873:
Try to avoid ambiguity when sysctl returns ENOMEM additionally
checking the returned oldlen: when ENOMEM is due to the supplied
buffer being too short the return oldlen is equal to buffer size.
Without this additional check kvm_getprocs() gets stuck in loop if the
returned ENOMEM was due the exceeded memorylocked limit. This is
easily can be observed running `limits -l 1k top'.
rmacklem [Sun, 12 Feb 2012 06:41:29 +0000 (06:41 +0000)]
MFC: r231133
r228827 fixed a problem where copying of NFSv4 open credentials into
a credential structure would corrupt it. This happened when the
p argument was != NULL. However, I now realize that the copying of
open credentials should only happen for p == NULL, since that indicates
that it is a read-ahead or write-behind. This patch fixes this.
After this commit, r228827 could be reverted, but I think the code is
clearer and safer with the patch, so I am going to leave it in.
Without this patch, it was possible that a NFSv4 VOP_SETATTR() could have
changed the credentials of the caller. This would have happened if
the process doing the VOP_SETATTR() did not have the file open, but
some other process running as a different uid had the file open for writing
at the same time.
tuexen [Sat, 11 Feb 2012 01:15:02 +0000 (01:15 +0000)]
MFC r230555:
Don't print a warning when using netstat to print
SCTP statistics when there is not SCTP in the kernel.
This problem was reported by Sean Mahood.
tuexen [Sat, 11 Feb 2012 01:07:51 +0000 (01:07 +0000)]
MFC r230104:
Fix two bugs, which result in a panic when calling getsockopt()
using SCTP_RECVINFO or SCTP_NXTINFO.
Reported by Clement Lecigne and forwarded to us by zi@.
tuexen [Sat, 11 Feb 2012 01:05:41 +0000 (01:05 +0000)]
MFC r229805:
Add an SCTP sysctl "blackhole", similar to the one for TCP.
If set to 1, no ABORT is sent back in response to an incoming
INIT. If set to 2, no ABORT is sent back in response to
an out of the blue packet. If set to 0 (the default), ABORTs
are sent.
Discussed with rrs@.
tuexen [Sat, 11 Feb 2012 01:03:17 +0000 (01:03 +0000)]
MFC r229775:
Retire the SCTP sysctl "strict_init". We always perform the validation
and there is no reason to make is configuarable.
Discussed with rrs@.
tuexen [Sat, 11 Feb 2012 01:01:07 +0000 (01:01 +0000)]
MFC r229774:
Improve the handling of received INITs. Send an ABORT when
not accepting the connection. Also fix a crash, which
could happen when the user closed the socket.
tuexen [Sat, 11 Feb 2012 00:48:22 +0000 (00:48 +0000)]
MFC r228391:
Fix a bug reported by Irene Ruengeler which resulted in not sending
out HEARTBEATs when requested by the user. The HEARTBEATs were only
queued, but not actually sent out.
tuexen [Fri, 10 Feb 2012 23:55:40 +0000 (23:55 +0000)]
MFC r228031:
Fix a warning reported by arundel@.
Fix a bug where the parameter length of a supported address types
parameter is set to a wrong value if the kernel is built with
with either INET or INET6, but not both.
tuexen [Fri, 10 Feb 2012 23:49:04 +0000 (23:49 +0000)]
MFC r227755:
Add support for the SCTP_REMOTE_UDP_ENCAPS_PORT socket option.
Retire the the now unused sctp_udp_tunneling_for_client_enable
sysctl variable.
tuexen [Fri, 10 Feb 2012 23:24:34 +0000 (23:24 +0000)]
MFC r226252:
Use the most significant 6 bits of the dscp instead of the least
significant ones.
This has changed in the latest version of the socket API ID and
provides backwards compatibility and gets it in syn with the
usage of the IP_TOS socket option.
tuexen [Fri, 10 Feb 2012 23:19:33 +0000 (23:19 +0000)]
MFC r226203:
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.
tuexen [Fri, 10 Feb 2012 23:17:33 +0000 (23:17 +0000)]
MFC r226168:
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.
tuexen [Fri, 10 Feb 2012 22:57:50 +0000 (22:57 +0000)]
MFC r225559:
Ensure that 1-to-1 style SCTP sockets can only be connected once.
Allow implicit setup also for 1-to-1 style sockets as described
in the latest version of the socket API ID.
tuexen [Fri, 10 Feb 2012 22:54:58 +0000 (22:54 +0000)]
MFC r225549:
Fix the handling of the flowlabel and DSCP value in the SCTP_PEER_ADDR_PARAMS
socket option.
Honor the net.inet6.ip6.auto_flowlabel sysctl setting.
tuexen [Fri, 10 Feb 2012 22:49:09 +0000 (22:49 +0000)]
MFC r224918:
Fix the handling of [gs]etsockopt() unconnected 1-to-1 style sockets.
While there:
* Fix a locking issue in setsockopt() of SCTP_CMT_ON_OFF.
* Fix a bug in setsockopt() of SCTP_DEFAULT_PRINFO, where the pr_value
was ignored.
tuexen [Fri, 10 Feb 2012 22:44:36 +0000 (22:44 +0000)]
MFC r224870:
Add support for the spp_dscp field in the SCTP_PEER_ADDR_PARAMS
socket option. Backwards compatibility is provided by still
supporting the spp_ipv4_tos field.
tuexen [Fri, 10 Feb 2012 22:42:03 +0000 (22:42 +0000)]
MFC r224641:
The result of a joint work between rrs@ and myself at the IETF:
* Decouple the path supervision using a separate HB timer per path.
* Add support for potentially failed state.
* Bring back RTO.min to 1 second.
* Accept packets on IP-addresses already announced via an ASCONF
* While there: do some cleanups.
tuexen [Fri, 10 Feb 2012 22:31:47 +0000 (22:31 +0000)]
MFC r224271:
Fix the following bugs related to the SCTP support of netstat:
* Correctly handle -a.
* -A isn't supported.
* Show all closed 1-to-1 and 1-to-many style sockets.
* Show all listening 1-to-many style sockets.
* Use consistent formatting for -W.
tuexen [Fri, 10 Feb 2012 22:26:33 +0000 (22:26 +0000)]
MFC r223963:
The socket API only specifies SCTP for SOCK_SEQPACKET and
SOCK_STREAM, but not SOCK_DGRAM. So don't register it for
SOCK_DGRAM.
While there, fix some indentation.
tuexen [Fri, 10 Feb 2012 22:14:34 +0000 (22:14 +0000)]
MFC r223225:
Document the latest changes to sctp_opt_info() in the code.
This makes sctp_opt_info() compiliant with the latest version
of the socket API ID.
tuexen [Fri, 10 Feb 2012 22:06:08 +0000 (22:06 +0000)]
MFC r223152:
* Fix the handling of addresses in sctp_sendv().
* Add support for SCTP_SENDV_NOINFO.
* Improve the error handling of sctp_sendv() and sctp_recv().
tuexen [Fri, 10 Feb 2012 21:28:38 +0000 (21:28 +0000)]
MFC r223132:
Add support for the newly added SCTP API.
In particular add support for:
* SCTP_SNDINFO, SCTP_PRINFO, SCTP_AUTHINFO, SCTP_DSTADDRV4, and
SCTP_DSTADDRV6 cmsgs.
* SCTP_NXTINFO and SCTP_RCVINFO cmgs.
* SCTP_EVENT, SCTP_RECVRCVINFO, SCTP_RECVNXTINFO and SCTP_DEFAULT_SNDINFO
socket option.
* Special association ids (SCTP_FUTURE_ASSOC, ...)
* sctp_recvv() and sctp_sendv() functions.
Modified because SCTP_MAXBURST was not backported.
tuexen [Fri, 10 Feb 2012 20:57:46 +0000 (20:57 +0000)]
MFC r221904:
Fix the source address selection for boundall sockets
when sending INITs to a global IPv4 address having
only private IPv4 address.
Allow the usage of a private address and make sure
that no other private address will be used by the
association.
Initial work was done by rrs@.
tuexen [Fri, 10 Feb 2012 20:45:17 +0000 (20:45 +0000)]
MFC r221512:
* Update copyright notice.
* Cleanup usage of iov's.
* Add support for SCTP_TIMEOUTS socketoption.
* Fix a bug in sctp_recvmsg(): return the msg_flags in case of an error.
* Fix a bug in the error handling of sctp_peeloff(): return the -1.
tuexen [Fri, 10 Feb 2012 20:27:58 +0000 (20:27 +0000)]
MFC r221249:
Improve compilation of SCTP code without INET support.
Some bugs where fixed while doing this:
* ASCONF-ACK messages might use wrong port number when using
IPv6.
* Checking for additional addresses takes the correct address
into account and also does not do more comparisons than
necessary.
This patch is based on one received from bz@ who was
sponsored by The FreeBSD Foundation and iXsystems.
tuexen [Fri, 10 Feb 2012 20:22:45 +0000 (20:22 +0000)]
MFC r219397:
Tunes and fixes the new DC-CC to seem to hit the
right mix. Still may need some tweaks but it
appears to almost not give away too much to an
RFC2581 flow, but can really minimize the amount of
buffers used in the net.
From rrs@.
tuexen [Fri, 10 Feb 2012 20:19:38 +0000 (20:19 +0000)]
MFC r219120:
Adds a new Congestion Control that helps reduce
the RTT that a flow will build up in buffers in
transit. It is a slight modification to RFC2581
but is more friendly i.e. less aggressive.
From rrs@.
tuexen [Fri, 10 Feb 2012 20:17:28 +0000 (20:17 +0000)]
MFC r219057:
Improvements to CC modules:
1) Add four new points that allow you to get more information
to cc algo's
2) Fix the case where user changes module on a existing TCB, in
such a case, the initialization module needs to be called on all nets.
3) Move htcp_cc structure to a union that other modules can use.
4) Add 5th point for get/set socket options for cc_module specific options
From rrs@.
tuexen [Fri, 10 Feb 2012 20:09:23 +0000 (20:09 +0000)]
MFC r219014:
* Fix several bugs where the scaled versions of srtt and rttvar
where used incorrectly.
* Use appropriate variable names for RTO instead of RTT.
tuexen [Fri, 10 Feb 2012 19:57:58 +0000 (19:57 +0000)]
MFC r218641:
Fix a bug reported by Jonathan Leighton in his web-sctp testing
at the Univ-of-Del. Basically when a 1-to-1 socket did a
socket/bind/send(data)/close. If the timing was right
we would dereference a socket that is NULL.
From rrs@.
tuexen [Fri, 10 Feb 2012 19:52:18 +0000 (19:52 +0000)]
MFC r218400:
Fix bugs related to M_FLOWID:
* Store the flowid when receiving an SCTP/IPv6 packet.
* Store the flowid when receiving an SCTP packet with wrong CRC.
* Initilize flowid correctly.
* Put test code under INVARIANTS.
tuexen [Fri, 10 Feb 2012 19:40:19 +0000 (19:40 +0000)]
MFC r218371:
1) Use same scheme Michael and I discussed for a selected for a flowid
2) If flowid is not set, arrange so it is stored.
3) If flowid is set by lower layer, use it.
From rrs@.
tuexen [Fri, 10 Feb 2012 19:15:05 +0000 (19:15 +0000)]
MFC r218232:
1) Move per John Baldwin to mp_maxid
2) Some signed/unsigned errors found by Mac OS compiler (from Michael)
3) a couple of copyright updates on the effected files.
From rrs@.
tuexen [Fri, 10 Feb 2012 19:12:23 +0000 (19:12 +0000)]
MFC r218219:
Fix the per CPU stats so that:
1) They don't use the giant "MAX_CPU" define and instead
are allocated dynamically based on mp_ncpus
2) Will zero with the netstat -z -s -p sctp
3) Will be properly handled by both the sctp_init and finish
(the multi-net stuff was incorrectly bzero'ing in sctp_init
the wrong size.. the bzero is now moved to the right places).
And of course the free is put in at the very end.
From rrs@.
tuexen [Fri, 10 Feb 2012 19:10:09 +0000 (19:10 +0000)]
MFC r218211:
Adds an experimental option to create a pool of
threads. These serve as input threads and are queued
packets based on the V-tag number. This is similar to
what a modern card can do with queue's for TCP... but
alas modern cards know nothing about SCTP.
From rrs@.
tuexen [Fri, 10 Feb 2012 19:07:32 +0000 (19:07 +0000)]
MFC r218186:
1) Allow a chunk to track the cwnd it was at when sent.
2) Add separate max-bursts for retransmit and hb. These
are set to sysctlable values but not settable via the
socket api. This makes sure we don't blast out HB's or
fast-retransmits.
3) Determine on the first data transmission on a net if
its local-lan (by being under or over a RTT). This
can later be used to think about different algorithms
based on locallan vs big-i (experimental)
4) The cwnd should NOT be allowed to grow when an ECNEcho
is seen (TCP has this same bug). We fix this in SCTP
so an ECNe being seen prevents an advance of cwnd.
5) CWR's should not be sent multiple times to the
same network, instead just updating the TSN being
transmitted if needed.
From rrs@.
tuexen [Fri, 10 Feb 2012 19:04:26 +0000 (19:04 +0000)]
MFC r218129:
More ECN fixes:
1) We now remove ECN-Nonce since it will no longer continue as a I-D
2) Eliminate last_tsn_echo, this tied us to an assoc not the net
and thus we were not doing m-homing on the ECN-Echo senders side right.
3) Increment the count going out even if the TSN in lower in the pending
ECN-Echo, this way the receiver knows exactly how many packets were
marked even with network re-ordering
4) Fix so we DO NOT stop doing delayed sack if a ECN Echo is in queue
tuexen [Fri, 10 Feb 2012 19:02:07 +0000 (19:02 +0000)]
MFC r218072:
Fixes to ECN in SCTP.
1) ECN was on an association basis, this is incorrect and
will not work with CMT or for that matter if the user
is sending to multiple addresses. This commit makes
ECN on a per path basis.
2) Adopt the new format for the ECN internet draft. This also
maintains compatability with old format chunks as well.
3) Keep track of the real time of a RTT down to micro seconds.
For some future conditional features (for like a data center
this is good information to have).
From rrs@.
tuexen [Fri, 10 Feb 2012 18:58:36 +0000 (18:58 +0000)]
MFC r218039:
Keep track of the real last RTT on each net.
This will be used for Data Center congestion
control, we won't want to engage it in the
ECN code unless we KNOW that the RTT is less
than 500us.
From rrs@