summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2007-07-14 09:36:28 +0000
committerrrs <rrs@FreeBSD.org>2007-07-14 09:36:28 +0000
commit1e9af2c480a638933876e637c1f3b9f1b7bad3e9 (patch)
tree008308315d74a9df2eec618692844a82f1ace245 /lib
parent0948603d9eefb8b7f5898f99c8703b2e5b7f9647 (diff)
downloadFreeBSD-src-1e9af2c480a638933876e637c1f3b9f1b7bad3e9.zip
FreeBSD-src-1e9af2c480a638933876e637c1f3b9f1b7bad3e9.tar.gz
- Modular congestion control, with RFC2581 being the default.
- CMT_PF states added (w/sysctl to turn the PF version on) - sctp_input.c had a missing incr of cookie case when the auth was bad. This meant a free was called without an increment to refcnt, added increment like rest of code. - There was a case, unlikely, when the scope of the destination changed (this is a TSNH case). In that case, it would not free the alloc'ed asoc (in sctp_input.c). - When listed addresses found a colliding cookie/Init, then the collided upon tcb was not unlocked in sctp_pcb.c - Add error checking on arguments of sctp_sendx(3) to prevent it from referencing a NULL pointer. - Fix an error return of sctp_sendx(3), it was returing ENOMEM not -1. - Get assoc id was changed to use the sanctified socket api method for getting a assoc id (PEER_ADDR_INFO instead of PEER_ADDR_PARAMS). - Fix it so a peeled off socket will get a proper error return if it trys to send to a different address then it is connected to. - Fix so that select_a_stream can avoid an endless loop that could hang a caller. - time_entered (state set time) was not being set in all cases to the time we went established. Approved by: re(ken smith)
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/sctp_sys_calls.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/libc/net/sctp_sys_calls.c b/lib/libc/net/sctp_sys_calls.c
index 153f531..922e034 100644
--- a/lib/libc/net/sctp_sys_calls.c
+++ b/lib/libc/net/sctp_sys_calls.c
@@ -549,20 +549,20 @@ sctp_sendmsg(int s,
sctp_assoc_t
sctp_getassocid(int sd, struct sockaddr *sa)
{
- struct sctp_paddrparams sp;
+ struct sctp_paddrinfo sp;
socklen_t siz;
/* First get the assoc id */
- siz = sizeof(struct sctp_paddrparams);
+ siz = sizeof(sp);
memset(&sp, 0, sizeof(sp));
- memcpy((caddr_t)&sp.spp_address, sa, sa->sa_len);
+ memcpy((caddr_t)&sp.spinfo_address, sa, sa->sa_len);
errno = 0;
if (getsockopt(sd, IPPROTO_SCTP,
- SCTP_PEER_ADDR_PARAMS, &sp, &siz) != 0) {
+ SCTP_GET_PEER_ADDR_INFO, &sp, &siz) != 0) {
return ((sctp_assoc_t) 0);
}
/* We depend on the fact that 0 can never be returned */
- return (sp.spp_assoc_id);
+ return (sp.spinfo_assoc_id);
}
ssize_t
@@ -585,7 +585,8 @@ sctp_send(int sd, const void *data, size_t len,
struct cmsghdr *cmsg;
if (sinfo == NULL) {
- return (EINVAL);
+ errno = EINVAL;
+ return (-1);
}
iov[0].iov_base = (char *)data;
iov[0].iov_len = len;
@@ -641,6 +642,11 @@ sctp_sendx(int sd, const void *msg, size_t msg_len,
msg, msg_len, addrs, l, sinfo, flags));
}
#endif
+
+ if (addrs == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
len = sizeof(int);
at = addrs;
cnt = 0;
@@ -665,7 +671,7 @@ sctp_sendx(int sd, const void *msg, size_t msg_len,
}
buf = malloc(len);
if (buf == NULL) {
- return (ENOMEM);
+ return (-1);
}
aa = (int *)buf;
*aa = cnt;
OpenPOWER on IntegriCloud