Module Name: src Committed By: rjs Date: Sun Dec 10 11:52:14 UTC 2017
Modified Files: src/sys/netinet: sctp_indata.c sctp_output.c sctp_uio.h sctp_usrreq.c Log Message: Improve compliance to RFC 6458. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/netinet/sctp_indata.c cvs rdiff -u -r1.11 -r1.12 src/sys/netinet/sctp_output.c cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/sctp_uio.h cvs rdiff -u -r1.8 -r1.9 src/sys/netinet/sctp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet/sctp_indata.c diff -u src/sys/netinet/sctp_indata.c:1.4 src/sys/netinet/sctp_indata.c:1.5 --- src/sys/netinet/sctp_indata.c:1.4 Mon Apr 25 21:21:02 2016 +++ src/sys/netinet/sctp_indata.c Sun Dec 10 11:52:14 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: sctp_indata.c,v 1.4 2016/04/25 21:21:02 rjs Exp $ */ +/* $NetBSD: sctp_indata.c,v 1.5 2017/12/10 11:52:14 rjs Exp $ */ /* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sctp_indata.c,v 1.4 2016/04/25 21:21:02 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_indata.c,v 1.5 2017/12/10 11:52:14 rjs Exp $"); #ifdef _KERNEL_OPT #include "opt_ipsec.h" @@ -205,7 +205,7 @@ sctp_build_ctl_nchunk(struct sctp_tcb *s outinfo->sinfo_stream = stream_no; outinfo->sinfo_ssn = stream_seq; if (flags & SCTP_DATA_UNORDERED) { - outinfo->sinfo_flags = MSG_UNORDERED; + outinfo->sinfo_flags = SCTP_UNORDERED; } else { outinfo->sinfo_flags = 0; } @@ -256,7 +256,7 @@ sctp_build_ctl(struct sctp_tcb *stcb, st outinfo->sinfo_stream = chk->rec.data.stream_number; outinfo->sinfo_ssn = chk->rec.data.stream_seq; if (chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) { - outinfo->sinfo_flags = MSG_UNORDERED; + outinfo->sinfo_flags = SCTP_UNORDERED; } else { outinfo->sinfo_flags = 0; } Index: src/sys/netinet/sctp_output.c diff -u src/sys/netinet/sctp_output.c:1.11 src/sys/netinet/sctp_output.c:1.12 --- src/sys/netinet/sctp_output.c:1.11 Tue Jun 27 13:54:56 2017 +++ src/sys/netinet/sctp_output.c Sun Dec 10 11:52:14 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: sctp_output.c,v 1.11 2017/06/27 13:54:56 rjs Exp $ */ +/* $NetBSD: sctp_output.c,v 1.12 2017/12/10 11:52:14 rjs Exp $ */ /* $KAME: sctp_output.c,v 1.48 2005/06/16 18:29:24 jinmei Exp $ */ /* @@ -30,7 +30,7 @@ * SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.11 2017/06/27 13:54:56 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.12 2017/12/10 11:52:14 rjs Exp $"); #ifdef _KERNEL_OPT #include "opt_ipsec.h" @@ -4006,7 +4006,7 @@ sctp_prepare_chunk(struct sctp_tmit_chun memset(template, 0, sizeof(struct sctp_tmit_chunk)); template->sent = SCTP_DATAGRAM_UNSENT; if ((stcb->asoc.peer_supports_prsctp) && - (srcv->sinfo_flags & (MSG_PR_SCTP_TTL|MSG_PR_SCTP_BUF)) && + (srcv->sinfo_flags & (SCTP_PR_SCTP_TTL|SCTP_PR_SCTP_BUF)) && (srcv->sinfo_timetolive > 0) ) { /* If: @@ -4016,7 +4016,7 @@ sctp_prepare_chunk(struct sctp_tmit_chun * to mean a reliable send for both buffer/time * related one. */ - if (srcv->sinfo_flags & MSG_PR_SCTP_BUF) { + if (srcv->sinfo_flags & SCTP_PR_SCTP_BUF) { /* * Time to live is a priority stored in tv_sec * when doing the buffer drop thing. @@ -4036,7 +4036,7 @@ sctp_prepare_chunk(struct sctp_tmit_chun #endif } } - if ((srcv->sinfo_flags & MSG_UNORDERED) == 0) { + if ((srcv->sinfo_flags & SCTP_UNORDERED) == 0) { template->rec.data.stream_seq = strq->next_sequence_sent; } else { template->rec.data.stream_seq = 0; @@ -4049,7 +4049,7 @@ sctp_prepare_chunk(struct sctp_tmit_chun template->rec.data.doing_fast_retransmit = 0; template->rec.data.ect_nonce = 0; /* ECN Nonce */ - if (srcv->sinfo_flags & MSG_ADDR_OVER) { + if (srcv->sinfo_flags & SCTP_ADDR_OVER) { template->whoTo = net; } else { if (stcb->asoc.primary_destination) @@ -4060,7 +4060,7 @@ sctp_prepare_chunk(struct sctp_tmit_chun } } /* the actual chunk flags */ - if (srcv->sinfo_flags & MSG_UNORDERED) { + if (srcv->sinfo_flags & SCTP_UNORDERED) { template->rec.data.rcv_flags = SCTP_DATA_UNORDERED; } else { template->rec.data.rcv_flags = 0; @@ -4076,10 +4076,10 @@ sctp_prepare_chunk(struct sctp_tmit_chun * Zero is reserved specifically to be * EXCLUDED and sent reliable. */ - if (srcv->sinfo_flags & MSG_PR_SCTP_TTL) { + if (srcv->sinfo_flags & SCTP_PR_SCTP_TTL) { template->flags |= SCTP_PR_SCTP_ENABLED; } - if (srcv->sinfo_flags & MSG_PR_SCTP_BUF) { + if (srcv->sinfo_flags & SCTP_PR_SCTP_BUF) { template->flags |= SCTP_PR_SCTP_BUFFER; } } @@ -4160,7 +4160,7 @@ sctp_msg_append(struct sctp_tcb *stcb, } so = stcb->sctp_socket; asoc = &stcb->asoc; - if (srcv->sinfo_flags & MSG_ABORT) { + if (srcv->sinfo_flags & SCTP_ABORT) { if ((SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_WAIT) && (SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_ECHOED)) { /* It has to be up before we abort */ @@ -4242,7 +4242,7 @@ sctp_msg_append(struct sctp_tcb *stcb, error = EMSGSIZE; goto release; } - if ((srcv->sinfo_flags & MSG_EOF) && + if ((srcv->sinfo_flags & SCTP_EOF) && (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) && (dataout == 0) ) { @@ -4365,7 +4365,7 @@ sctp_msg_append(struct sctp_tcb *stcb, chk->book_size = chk->send_size; chk->mbcnt = mbcnt; /* ok, we are commited */ - if ((srcv->sinfo_flags & MSG_UNORDERED) == 0) { + if ((srcv->sinfo_flags & SCTP_UNORDERED) == 0) { /* bump the ssn if we are unordered. */ strq->next_sequence_sent++; } @@ -4480,7 +4480,7 @@ sctp_msg_append(struct sctp_tcb *stcb, * and breaking the pointers. */ /* ok, we are commited */ - if ((srcv->sinfo_flags & MSG_UNORDERED) == 0) { + if ((srcv->sinfo_flags & SCTP_UNORDERED) == 0) { /* bump the ssn if we are unordered. */ strq->next_sequence_sent++; } @@ -4514,7 +4514,7 @@ sctp_msg_append(struct sctp_tcb *stcb, /* has a SHUTDOWN been (also) requested by the user on this asoc? */ zap_by_it_all: - if ((srcv->sinfo_flags & MSG_EOF) && + if ((srcv->sinfo_flags & SCTP_EOF) && (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE)) { int some_on_streamwheel = 0; @@ -4557,11 +4557,6 @@ zap_by_it_all: * we still got (or just got) data to send, so set * SHUTDOWN_PENDING */ - /* - * XXX sockets draft says that MSG_EOF should be sent - * with no data. currently, we will allow user data - * to be sent first and move to SHUTDOWN-PENDING - */ asoc->state |= SCTP_STATE_SHUTDOWN_PENDING; } } @@ -4800,7 +4795,7 @@ sctp_sendall (struct sctp_inpcb *inp, st /* take off the sendall flag, it would * be bad if we failed to do this :-0 */ - ca->sndrcv.sinfo_flags &= ~MSG_SENDALL; + ca->sndrcv.sinfo_flags &= ~SCTP_SENDALL; /* get length and mbuf chain */ if (uio) { @@ -7171,7 +7166,7 @@ sctp_output(struct sctp_inpcb *inp, stru sctppcbinfo.mbuf_track++; if (sctp_find_cmsg(SCTP_SNDRCV, (void *)&srcv, control, sizeof(srcv))) { - if (srcv.sinfo_flags & MSG_SENDALL) { + if (srcv.sinfo_flags & SCTP_SENDALL) { /* its a sendall */ sctppcbinfo.mbuf_track--; sctp_m_freem(control); @@ -7293,7 +7288,7 @@ sctp_output(struct sctp_inpcb *inp, stru return (ENOENT); } else if (stcb == NULL) { /* UDP mode, we must go ahead and start the INIT process */ - if ((use_rcvinfo) && (srcv.sinfo_flags & MSG_ABORT)) { + if ((use_rcvinfo) && (srcv.sinfo_flags & SCTP_ABORT)) { /* Strange user to do this */ if (control) { sctppcbinfo.mbuf_track--; @@ -7409,7 +7404,7 @@ sctp_output(struct sctp_inpcb *inp, stru control = NULL; } if ((use_rcvinfo) && - (srcv.sinfo_flags & MSG_ABORT)) { + (srcv.sinfo_flags & SCTP_ABORT)) { sctp_msg_append(stcb, net, m, &srcv, flags); error = 0; } else { @@ -7448,7 +7443,7 @@ sctp_output(struct sctp_inpcb *inp, stru sctp_m_freem(control); control = NULL; } - if (net && ((srcv.sinfo_flags & MSG_ADDR_OVER))) { + if (net && ((srcv.sinfo_flags & SCTP_ADDR_OVER))) { /* we take the override or the unconfirmed */ ; } else { @@ -9455,7 +9450,7 @@ sctp_copy_it_in(struct sctp_inpcb *inp, } /* Are we aborting? */ - if (srcv->sinfo_flags & MSG_ABORT) { + if (srcv->sinfo_flags & SCTP_ABORT) { if ((SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_WAIT) && (SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_ECHOED)) { /* It has to be up before we abort */ @@ -9536,7 +9531,7 @@ sctp_copy_it_in(struct sctp_inpcb *inp, error = EFAULT; goto release; } - if ((srcv->sinfo_flags & MSG_EOF) && + if ((srcv->sinfo_flags & SCTP_EOF) && (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) && (tot_out == 0)) { sounlock(so); @@ -9591,7 +9586,7 @@ sctp_copy_it_in(struct sctp_inpcb *inp, chk->send_size = tot_out; chk->book_size = chk->send_size; /* ok, we are commited */ - if ((srcv->sinfo_flags & MSG_UNORDERED) == 0) { + if ((srcv->sinfo_flags & SCTP_UNORDERED) == 0) { /* bump the ssn if we are unordered. */ strq->next_sequence_sent++; } @@ -9680,7 +9675,7 @@ clean_up: tot_out -= tot_demand; } /* Now the tmp list holds all chunks and data */ - if ((srcv->sinfo_flags & MSG_UNORDERED) == 0) { + if ((srcv->sinfo_flags & SCTP_UNORDERED) == 0) { /* bump the ssn if we are unordered. */ strq->next_sequence_sent++; } @@ -9759,7 +9754,7 @@ zap_by_it_now: so->so_snd.sb_cc += dataout; so->so_snd.sb_mbcnt += mbcnt; } - if ((srcv->sinfo_flags & MSG_EOF) && + if ((srcv->sinfo_flags & SCTP_EOF) && (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) ) { int some_on_streamwheel = 0; @@ -9802,7 +9797,7 @@ zap_by_it_now: * SHUTDOWN_PENDING */ /* - * XXX sockets draft says that MSG_EOF should be sent + * XXX sockets draft says that SCTP_EOF should be sent * with no data. currently, we will allow user data * to be sent first and move to SHUTDOWN-PENDING */ @@ -9900,7 +9895,7 @@ sctp_sosend(struct socket *so, struct so if (sctp_find_cmsg(SCTP_SNDRCV, (void *)&srcv, control, sizeof(srcv))) { /* got one */ - if (srcv.sinfo_flags & MSG_SENDALL) { + if (srcv.sinfo_flags & SCTP_SENDALL) { /* its a sendall */ sctppcbinfo.mbuf_track--; sctp_m_freem(control); @@ -9961,7 +9956,7 @@ sctp_sosend(struct socket *so, struct so } else if (stcb == NULL) { /* UDP style, we must go ahead and start the INIT process */ if ((use_rcvinfo) && - (srcv.sinfo_flags & MSG_ABORT)) { + (srcv.sinfo_flags & SCTP_ABORT)) { /* User asks to abort a non-existant asoc */ error = ENOENT; sounlock(so); @@ -10075,7 +10070,7 @@ sctp_sosend(struct socket *so, struct so (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) || (asoc->state & SCTP_STATE_SHUTDOWN_PENDING)) { if ((use_rcvinfo) && - (srcv.sinfo_flags & MSG_ABORT)) { + (srcv.sinfo_flags & SCTP_ABORT)) { ; } else { error = ECONNRESET; @@ -10090,7 +10085,7 @@ sctp_sosend(struct socket *so, struct so #endif if (stcb) { - if (net && ((srcv.sinfo_flags & MSG_ADDR_OVER))) { + if (net && ((srcv.sinfo_flags & SCTP_ADDR_OVER))) { /* we take the override or the unconfirmed */ ; } else { Index: src/sys/netinet/sctp_uio.h diff -u src/sys/netinet/sctp_uio.h:1.2 src/sys/netinet/sctp_uio.h:1.3 --- src/sys/netinet/sctp_uio.h:1.2 Wed Jun 28 14:39:33 2017 +++ src/sys/netinet/sctp_uio.h Sun Dec 10 11:52:14 2017 @@ -1,5 +1,5 @@ /* $KAME: sctp_uio.h,v 1.11 2005/03/06 16:04:18 itojun Exp $ */ -/* $NetBSD: sctp_uio.h,v 1.2 2017/06/28 14:39:33 rjs Exp $ */ +/* $NetBSD: sctp_uio.h,v 1.3 2017/12/10 11:52:14 rjs Exp $ */ #ifndef __SCTP_UIO_H__ #define __SCTP_UIO_H__ @@ -41,6 +41,10 @@ typedef u_int32_t sctp_assoc_t; +#define SCTP_FUTURE_ASSOC 0 +#define SCTP_CURRENT_ASSOC 1 +#define SCTP_ALL_ASSOC 2 + /* On/Off setup for subscription to events */ struct sctp_event_subscribe { u_int8_t sctp_data_io_event; @@ -57,6 +61,20 @@ struct sctp_event_subscribe { /* ancillary data types */ #define SCTP_INIT 0x0001 #define SCTP_SNDRCV 0x0002 +#define SCTP_EXTRCV 0x0003 +#define SCTP_SNDINFO 0x0004 +#define SCTP_RCVINFO 0x0005 +#define SCTP_NXTINFO 0x0006 +#define SCTP_PRINFO 0x0007 +#define SCTP_AUTHINFO 0x0008 +#define SCTP_DSTADDRV4 0x0009 +#define SCTP_DSTADDRV6 0x000a + +struct sctp_event { + sctp_assoc_t se_assoc_id; + u_int16_t se_type; + u_int8_t se_on; +} __packed; /* * ancillary data structures @@ -80,6 +98,42 @@ struct sctp_sndrcvinfo { sctp_assoc_t sinfo_assoc_id; } __packed; +struct sctp_sndinfo { + u_int16_t snd_sid; + u_int16_t snd_flags; + u_int32_t snd_ppid; + u_int32_t snd_context; + sctp_assoc_t snd_assoc_id; +} __packed; + +struct sctp_rcvinfo { + u_int16_t rcv_sid; + u_int16_t rcv_ssn; + u_int16_t rcv_flags; + u_int32_t rcv_ppid; + u_int32_t rcv_tsn; + u_int32_t rcv_cumtsn; + u_int32_t rcv_context; + sctp_assoc_t rcv_assoc_id; +}; + +struct sctp_nxtinfo { + u_int16_t nxt_sid; + u_int16_t nxt_flags; + u_int32_t nxt_ppid; + u_int32_t nxt_length; + sctp_assoc_t nxt_assoc_id; +} __packed; + +struct sctp_prinfo { + u_int16_t pr_policy; + u_int32_t pr_value; +}; + +struct sctp_authinfo { + u_int16_t auth_keynumber; +} __packed; + struct sctp_snd_all_completes { u_int16_t sall_stream; u_int16_t sall_flags; @@ -90,16 +144,13 @@ struct sctp_snd_all_completes { } __packed; /* send/recv flags */ -/* MSG_EOF (0x0100) is reused from sys/socket.h */ -#define MSG_SENDALL 0x0200 -#define MSG_PR_SCTP_TTL 0x0400 /* Partial Reliable on this msg */ -#define MSG_PR_SCTP_BUF 0x0800 /* Buffer based PR-SCTP */ -#ifndef MSG_EOF -#define MSG_EOF 0x1000 /* Start shutdown procedures */ -#endif -#define MSG_UNORDERED 0x2000 /* Message is un-ordered */ -#define MSG_ADDR_OVER 0x4000 /* Override the primary-address */ -#define MSG_ABORT 0x8000 /* Send an ABORT to peer */ +#define SCTP_SENDALL 0x0200 +#define SCTP_PR_SCTP_TTL 0x0400 /* Partial Reliable on this msg */ +#define SCTP_PR_SCTP_BUF 0x0800 /* Buffer based PR-SCTP */ +#define SCTP_EOF 0x1000 /* Start shutdown procedures */ +#define SCTP_UNORDERED 0x2000 /* Message is un-ordered */ +#define SCTP_ADDR_OVER 0x4000 /* Override the primary-address */ +#define SCTP_ABORT 0x8000 /* Send an ABORT to peer */ /* Stat's */ struct sctp_pcbinfo { @@ -135,6 +186,7 @@ struct sctp_assoc_change { u_int16_t sac_outbound_streams; u_int16_t sac_inbound_streams; sctp_assoc_t sac_assoc_id; + u_int8_t sac_info[0]; } __packed; /* sac_state values */ @@ -144,6 +196,11 @@ struct sctp_assoc_change { #define SCTP_SHUTDOWN_COMP 0x0004 #define SCTP_CANT_STR_ASSOC 0x0005 +/* sac_info values */ +#define SCTP_ASSOC_SUPPORTS_PR 0x0001 +#define SCTP_ASSOC_SUPPORTS_AUTH 0x0002 +#define SCTP_ASSOC_SUPPORTS_ASCONF 0x0003 +#define SCTP_ASSOC_SUPPORTS_MULTIBUF 0x0004 /* Address events */ struct sctp_paddr_change { @@ -161,7 +218,7 @@ struct sctp_paddr_change { #define SCTP_ADDR_REMOVED 0x0003 #define SCTP_ADDR_ADDED 0x0004 #define SCTP_ADDR_MADE_PRIM 0x0005 -#define SCTP_ADDR_CONFIRMED 0x0006 +#define SCTP_ADDR_CONFIRMED 0x0006 /* XXX */ /* * CAUTION: these are user exposed SCTP addr reachability states @@ -189,8 +246,6 @@ struct sctp_paddr_change { #define SCTP_NOHEARTBEAT 0x0040 /* SCTP_ADDR_NOHB */ - - /* remote error events */ struct sctp_remote_error { u_int16_t sre_type; @@ -243,12 +298,22 @@ struct sctp_pdapi_event { u_int16_t pdapi_flags; u_int32_t pdapi_length; u_int32_t pdapi_indication; + u_int32_t pdapi_stream; + u_int32_t pdapi_seq; sctp_assoc_t pdapi_assoc_id; } __packed; #define SCTP_PARTIAL_DELIVERY_ABORTED 0x0001 +/* sender dry indications */ +struct sctp_sender_dry_event { + u_int16_t sender_dry_type; + u_int16_t sender_dry_flags; + u_int32_t sender_dry_length; + sctp_assoc_t sender_dry_assoc_id; +} __packed; + /* stream reset stuff */ struct sctp_stream_reset_event { @@ -282,9 +347,9 @@ struct sctp_assoc_ids { #define SCTP_SHUTDOWN_EVENT 0x0005 #define SCTP_ADAPTION_INDICATION 0x0006 #define SCTP_PARTIAL_DELIVERY_EVENT 0x0007 -#define SCTP_STREAM_RESET_EVENT 0x0008 - - +#define SCTP_STREAM_RESET_EVENT 0x0008 /* XXX */ +#define SCTP_AUTHENTICATION_EVENT 0x0009 +#define SCT_SENDER_DRY_EVENT 0x000a struct sctp_tlv { u_int16_t sn_type; @@ -317,8 +382,21 @@ struct sctp_paddrparams { struct sockaddr_storage spp_address; u_int32_t spp_hbinterval; u_int16_t spp_pathmaxrxt; + u_int32_t spp_pathmtu; + u_int32_t spp_flags; + u_int32_t spp_ipv6_flowlabel; + u_int8_t spp_dscp; } __packed; +#define SPP_HB_ENABLE 0x0001 +#define SPP_HB_DISABLE 0x0002 +#define SPP_HB_DEMAND 0x0004 +#define SPP_HB_TIME_IS_ZERO 0x0008 +#define SPP_PMTUD_ENABLE 0x0010 +#define SPP_PMTUD_DISABLE 0x0020 +#define SPP_IPV6_FLOWLABEL 0x0040 +#define SPP_DSCP 0x0080 + struct sctp_paddrinfo { sctp_assoc_t spinfo_assoc_id; struct sockaddr_storage spinfo_address; @@ -456,7 +534,7 @@ struct sctp_mbcnt_log { u_int32_t mbcnt_change; } __packed; -struct sctp_cwnd_log{ +struct sctp_cwnd_log { union { struct sctp_blk_args blk; struct sctp_cwnd_args cwnd; @@ -471,7 +549,7 @@ struct sctp_cwnd_log{ } __packed; -struct sctp_cwnd_log_req{ +struct sctp_cwnd_log_req { int num_in_log; /* Number in log */ int num_ret; /* Number returned */ int start_at; /* start at this one */ @@ -479,6 +557,32 @@ struct sctp_cwnd_log_req{ struct sctp_cwnd_log log[0]; } __packed; +struct sctp_sendv_spa { + u_int32_t sendv_flags; + struct sctp_sndinfo sendv_sndinfo; + struct sctp_prinfo sendv_prinfo; + struct sctp_authinfo sendv_authinfo; +} __packed; + +#define SCTP_SEND_SNDINFO_VALID 0x00000001 +#define SCTP_SEND_PRINFO_VALID 0x00000002 +#define SCTP_SEND_AUTHINFO_VALID 0x00000004 + +#define SCTP_SENDV_NOINFO 0x0000 +#define SCTP_SENDV_SNDINFO 0x0001 +#define SCTP_SENDV_PRINFO 0x0002 +#define SCTP_SENDV_AUTHINFO 0x0003 +#define SCTP_SENDV_SPA 0x0004 + +struct sctp_recvv_rn { + struct sctp_rcvinfo recvv_rcvinfo; + struct sctp_nxtinfo recvv_nxtinfo; +} __packed; + +#define SCTP_RECVV_NOINFO 0x0000 +#define SCTP_RECVV_RCVINFO 0x0001 +#define SCTP_RECVV_NXTINFO 0x0002 +#define SCTP_RECVV_RN 0x0003 /* @@ -489,7 +593,7 @@ struct sctp_cwnd_log_req{ __BEGIN_DECLS int sctp_peeloff(int, sctp_assoc_t); int sctp_bindx(int, struct sockaddr *, int, int); -int sctp_connectx(int, struct sockaddr *, int); +int sctp_connectx(int, struct sockaddr *, int, sctp_assoc_t *); int sctp_getpaddrs(int, sctp_assoc_t, struct sockaddr **); void sctp_freepaddrs(struct sockaddr *); int sctp_getladdrs(int, sctp_assoc_t, struct sockaddr **); @@ -500,23 +604,27 @@ ssize_t sctp_sendmsg(int, const void *, const struct sockaddr *, socklen_t, u_int32_t, u_int32_t, u_int16_t, u_int32_t, u_int32_t); -ssize_t sctp_send(int sd, const void *msg, size_t len, - const struct sctp_sndrcvinfo *sinfo,int flags); +ssize_t sctp_send(int, const void *, size_t, + const struct sctp_sndrcvinfo *, int); ssize_t -sctp_sendx(int sd, const void *msg, size_t len, - struct sockaddr *addrs, int addrcnt, - struct sctp_sndrcvinfo *sinfo, int flags); +sctp_sendx(int, const void *, size_t, struct sockaddr *, int, + struct sctp_sndrcvinfo *, int); ssize_t sctp_sendmsgx(int sd, const void *, size_t, - struct sockaddr *, int, - u_int32_t, u_int32_t, u_int16_t, u_int32_t, u_int32_t); + struct sockaddr *, int, + u_int32_t, u_int32_t, u_int16_t, u_int32_t, u_int32_t); +ssize_t sctp_sendv(int, const struct iovec *, int, struct sockaddr *, int, + void *, socklen_t, unsigned int, int); sctp_assoc_t sctp_getassocid(int sd, struct sockaddr *sa); ssize_t sctp_recvmsg(int, void *, size_t, struct sockaddr *, socklen_t *, struct sctp_sndrcvinfo *, int *); +ssize_t sctp_recvv(int, const struct iovec *, int, struct sockaddr *, + socklen_t *, void *, socklen_t *, unsigned int *, + int *); __END_DECLS Index: src/sys/netinet/sctp_usrreq.c diff -u src/sys/netinet/sctp_usrreq.c:1.8 src/sys/netinet/sctp_usrreq.c:1.9 --- src/sys/netinet/sctp_usrreq.c:1.8 Tue Oct 17 19:23:42 2017 +++ src/sys/netinet/sctp_usrreq.c Sun Dec 10 11:52:14 2017 @@ -1,5 +1,5 @@ /* $KAME: sctp_usrreq.c,v 1.50 2005/06/16 20:45:29 jinmei Exp $ */ -/* $NetBSD: sctp_usrreq.c,v 1.8 2017/10/17 19:23:42 rjs Exp $ */ +/* $NetBSD: sctp_usrreq.c,v 1.9 2017/12/10 11:52:14 rjs Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.8 2017/10/17 19:23:42 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.9 2017/12/10 11:52:14 rjs Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -784,12 +784,6 @@ sctp_disconnect(struct socket *so) * we still got (or just got) data to send, * so set SHUTDOWN_PENDING */ - /* - * XXX sockets draft says that MSG_EOF should - * be sent with no data. - * currently, we will allow user data to be - * sent first and move to SHUTDOWN-PENDING - */ asoc->state |= SCTP_STATE_SHUTDOWN_PENDING; } SCTP_TCB_UNLOCK(stcb); @@ -2785,8 +2779,8 @@ sctp_optsset(struct socket *so, struct s } /* Mask off the flags that are allowed */ s_info->sinfo_flags = (s_info->sinfo_flags & - (MSG_UNORDERED | MSG_ADDR_OVER | - MSG_PR_SCTP_TTL | MSG_PR_SCTP_BUF)); + (SCTP_UNORDERED | SCTP_ADDR_OVER | + SCTP_PR_SCTP_TTL | SCTP_PR_SCTP_BUF)); /* Copy it in */ stcb->asoc.def_send = *s_info; SCTP_TCB_UNLOCK(stcb);