diff options
-rwxr-xr-x | netinet/sctp.h | 3 | ||||
-rwxr-xr-x | netinet/sctp_input.c | 6 | ||||
-rwxr-xr-x | netinet/sctp_output.c | 10 | ||||
-rwxr-xr-x | netinet/sctp_pcb.c | 9 | ||||
-rwxr-xr-x | netinet/sctp_pcb.h | 3 | ||||
-rwxr-xr-x | netinet/sctp_peeloff.c | 4 | ||||
-rwxr-xr-x | netinet/sctp_structs.h | 7 | ||||
-rwxr-xr-x | netinet/sctp_sysctl.c | 31 | ||||
-rwxr-xr-x | netinet/sctp_sysctl.h | 18 | ||||
-rwxr-xr-x | netinet/sctp_usrreq.c | 58 | ||||
-rwxr-xr-x | netinet/sctputil.c | 4 | ||||
-rwxr-xr-x | user_socket.c | 4 | ||||
-rw-r--r-- | usrsctp.h | 2 |
13 files changed, 111 insertions, 48 deletions
diff --git a/netinet/sctp.h b/netinet/sctp.h index 885cf89..cca3895 100755 --- a/netinet/sctp.h +++ b/netinet/sctp.h @@ -32,7 +32,7 @@ #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: head/sys/netinet/sctp.h 269448 2014-08-02 21:36:40Z tuexen $"); +__FBSDID("$FreeBSD: head/sys/netinet/sctp.h 269475 2014-08-03 14:10:10Z tuexen $"); #endif #ifndef _NETINET_SCTP_H_ @@ -133,6 +133,7 @@ struct sctp_paramhdr { #define SCTP_REMOTE_UDP_ENCAPS_PORT 0x00000024 #define SCTP_ECN_SUPPORTED 0x00000025 #define SCTP_PR_SUPPORTED 0x00000026 +#define SCTP_NRSACK_SUPPORTED 0x00000027 /* * read-only options diff --git a/netinet/sctp_input.c b/netinet/sctp_input.c index 53c4755..802c46c 100755 --- a/netinet/sctp_input.c +++ b/netinet/sctp_input.c @@ -32,7 +32,7 @@ #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 269448 2014-08-02 21:36:40Z tuexen $"); +__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 269475 2014-08-03 14:10:10Z tuexen $"); #endif #include <netinet/sctp_os.h> @@ -2928,6 +2928,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, inp->sctp_cmt_on_off = (*inp_p)->sctp_cmt_on_off; inp->ecn_supported = (*inp_p)->ecn_supported; inp->prsctp_supported = (*inp_p)->prsctp_supported; + inp->nrsack_supported = (*inp_p)->nrsack_supported; inp->partial_delivery_point = (*inp_p)->partial_delivery_point; inp->sctp_context = (*inp_p)->sctp_context; inp->local_strreset_support = (*inp_p)->local_strreset_support; @@ -5052,8 +5053,7 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, SCTPDBG(SCTP_DEBUG_INDATA1, "No stcb when processing NR-SACK chunk\n"); break; } - if ((stcb->asoc.sctp_nr_sack_on_off == 0) || - (stcb->asoc.peer_supports_nr_sack == 0)) { + if (stcb->asoc.nrsack_supported == 0) { goto unknown_chunk; } if (chk_length < sizeof(struct sctp_nr_sack_chunk)) { diff --git a/netinet/sctp_output.c b/netinet/sctp_output.c index cc73e61..a5d88af 100755 --- a/netinet/sctp_output.c +++ b/netinet/sctp_output.c @@ -32,7 +32,7 @@ #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: head/sys/netinet/sctp_output.c 269448 2014-08-02 21:36:40Z tuexen $"); +__FBSDID("$FreeBSD: head/sys/netinet/sctp_output.c 269475 2014-08-03 14:10:10Z tuexen $"); #endif #include <netinet/sctp_os.h> @@ -5175,7 +5175,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) { pr_supported->chunk_types[num_ext++] = SCTP_AUTHENTICATION; } - if (stcb->asoc.sctp_nr_sack_on_off == 1) { + if (stcb->asoc.nrsack_supported == 1) { pr_supported->chunk_types[num_ext++] = SCTP_NR_SELECTIVE_ACK; } parameter_len = (uint16_t)sizeof(struct sctp_supported_chunk_types_param) + num_ext; @@ -6345,7 +6345,8 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) { pr_supported->chunk_types[num_ext++] = SCTP_AUTHENTICATION; } - if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off)) { + if (((asoc != NULL) && (asoc->nrsack_supported == 1)) || + ((asoc == NULL) && (inp->nrsack_supported == 1))) { pr_supported->chunk_types[num_ext++] = SCTP_NR_SELECTIVE_ACK; } parameter_len = (uint16_t)sizeof(struct sctp_supported_chunk_types_param) + num_ext; @@ -10898,8 +10899,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked uint8_t type; uint8_t tsn_map; - if ((stcb->asoc.sctp_nr_sack_on_off == 1) && - (stcb->asoc.peer_supports_nr_sack == 1)) { + if (stcb->asoc.nrsack_supported == 1) { type = SCTP_NR_SELECTIVE_ACK; } else { type = SCTP_SELECTIVE_ACK; diff --git a/netinet/sctp_pcb.c b/netinet/sctp_pcb.c index a31c5fa..be278c6 100755 --- a/netinet/sctp_pcb.c +++ b/netinet/sctp_pcb.c @@ -32,7 +32,7 @@ #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 269448 2014-08-02 21:36:40Z tuexen $"); +__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 269475 2014-08-03 14:10:10Z tuexen $"); #endif #include <netinet/sctp_os.h> @@ -2843,6 +2843,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id) inp->sctp_cmt_on_off = SCTP_BASE_SYSCTL(sctp_cmt_on_off); inp->ecn_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_ecn_enable); inp->prsctp_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_pr_enable); + inp->nrsack_supported = (uint8_t)SCTP_BASE_SYSCTL(sctp_nrsack_enable); #if defined(__Userspace__) inp->ulp_info = NULL; inp->recv_callback = NULL; @@ -7109,6 +7110,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, int got_random = 0, got_hmacs = 0, got_chklist = 0; uint8_t ecn_supported; uint8_t prsctp_supported; + uint8_t nrsack_supported; #ifdef INET struct sockaddr_in sin; #endif @@ -7141,6 +7143,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, /* Turn off ECN until we get through all params */ ecn_supported = 0; prsctp_supported = 0; + nrsack_supported = 0; TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { /* mark all addresses that we have currently on the list */ net->dest_state |= SCTP_ADDR_NOT_IN_ASSOC; @@ -7478,7 +7481,6 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, stcb->asoc.peer_supports_asconf = 0; stcb->asoc.peer_supports_pktdrop = 0; stcb->asoc.peer_supports_strreset = 0; - stcb->asoc.peer_supports_nr_sack = 0; stcb->asoc.peer_supports_auth = 0; pr_supported = (struct sctp_supported_chunk_types_param *)phdr; num_ent = plen - sizeof(struct sctp_paramhdr); @@ -7495,7 +7497,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, stcb->asoc.peer_supports_pktdrop = 1; break; case SCTP_NR_SELECTIVE_ACK: - stcb->asoc.peer_supports_nr_sack = 1; + nrsack_supported = 1; break; case SCTP_STREAM_RESET: stcb->asoc.peer_supports_strreset = 1; @@ -7640,6 +7642,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, } stcb->asoc.ecn_supported &= ecn_supported; stcb->asoc.prsctp_supported &= prsctp_supported; + stcb->asoc.nrsack_supported &= nrsack_supported; /* validate authentication required parameters */ if (got_random && got_hmacs) { stcb->asoc.peer_supports_auth = 1; diff --git a/netinet/sctp_pcb.h b/netinet/sctp_pcb.h index 7ba6dec..061e7ad 100755 --- a/netinet/sctp_pcb.h +++ b/netinet/sctp_pcb.h @@ -32,7 +32,7 @@ #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.h 269448 2014-08-02 21:36:40Z tuexen $"); +__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.h 269475 2014-08-03 14:10:10Z tuexen $"); #endif #ifndef _NETINET_SCTP_PCB_H_ @@ -482,6 +482,7 @@ struct sctp_inpcb { uint32_t sctp_cmt_on_off; uint8_t ecn_supported; uint8_t prsctp_supported; + uint8_t nrsack_supported; struct sctp_nonpad_sndrcvinfo def_send; /*- * These three are here for the sosend_dgram diff --git a/netinet/sctp_peeloff.c b/netinet/sctp_peeloff.c index d184a25..54c3371 100755 --- a/netinet/sctp_peeloff.c +++ b/netinet/sctp_peeloff.c @@ -32,7 +32,7 @@ #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: head/sys/netinet/sctp_peeloff.c 269448 2014-08-02 21:36:40Z tuexen $"); +__FBSDID("$FreeBSD: head/sys/netinet/sctp_peeloff.c 269475 2014-08-03 14:10:10Z tuexen $"); #endif #include <netinet/sctp_os.h> @@ -127,6 +127,7 @@ sctp_do_peeloff(struct socket *head, struct socket *so, sctp_assoc_t assoc_id) n_inp->sctp_cmt_on_off = inp->sctp_cmt_on_off; n_inp->ecn_supported = inp->ecn_supported; n_inp->prsctp_supported = inp->prsctp_supported; + n_inp->nrsack_supported = inp->nrsack_supported; n_inp->partial_delivery_point = inp->partial_delivery_point; n_inp->sctp_context = inp->sctp_context; n_inp->local_strreset_support = inp->local_strreset_support; @@ -237,6 +238,7 @@ sctp_get_peeloff(struct socket *head, sctp_assoc_t assoc_id, int *error) n_inp->sctp_cmt_on_off = inp->sctp_cmt_on_off; n_inp->ecn_supported = inp->ecn_supported; n_inp->prsctp_supported = inp->prsctp_supported; + n_inp->nrsack_supported = inp->nrsack_supported; n_inp->partial_delivery_point = inp->partial_delivery_point; n_inp->sctp_context = inp->sctp_context; n_inp->local_strreset_support = inp->local_strreset_support; diff --git a/netinet/sctp_structs.h b/netinet/sctp_structs.h index 9ef1c2b..b0f34f7 100755 --- a/netinet/sctp_structs.h +++ b/netinet/sctp_structs.h @@ -32,7 +32,7 @@ #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: head/sys/netinet/sctp_structs.h 269448 2014-08-02 21:36:40Z tuexen $"); +__FBSDID("$FreeBSD: head/sys/netinet/sctp_structs.h 269475 2014-08-03 14:10:10Z tuexen $"); #endif #ifndef _NETINET_SCTP_STRUCTS_H_ @@ -1203,14 +1203,13 @@ struct sctp_association { /* Flags whether an extension is supported or not */ uint8_t ecn_supported; uint8_t prsctp_supported; + uint8_t nrsack_supported; /* Did the peer make the stream config (add out) request */ uint8_t peer_req_out; /* flag to indicate if peer can do asconf */ uint8_t peer_supports_asconf; - /* EY - flag to indicate if peer can do nr_sack*/ - uint8_t peer_supports_nr_sack; /* peer authentication support flag */ uint8_t peer_supports_auth; /* stream resets are supported by the peer */ @@ -1247,8 +1246,6 @@ struct sctp_association { uint8_t sctp_cmt_on_off; uint8_t iam_blocking; uint8_t cookie_how[8]; - /* EY 05/05/08 - NR_SACK variable*/ - uint8_t sctp_nr_sack_on_off; /* JRS 5/21/07 - CMT PF variable */ uint8_t sctp_cmt_pf; uint8_t use_precise_time; diff --git a/netinet/sctp_sysctl.c b/netinet/sctp_sysctl.c index b8114c5..a365f40 100755 --- a/netinet/sctp_sysctl.c +++ b/netinet/sctp_sysctl.c @@ -32,7 +32,7 @@ #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: head/sys/netinet/sctp_sysctl.c 269448 2014-08-02 21:36:40Z tuexen $"); +__FBSDID("$FreeBSD: head/sys/netinet/sctp_sysctl.c 269476 2014-08-03 15:09:13Z tuexen $"); #endif #include <netinet/sctp_os.h> @@ -62,6 +62,7 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_multiple_asconfs) = SCTPCTL_MULTIPLEASCONFS_DEFAULT; SCTP_BASE_SYSCTL(sctp_ecn_enable) = SCTPCTL_ECN_ENABLE_DEFAULT; SCTP_BASE_SYSCTL(sctp_pr_enable) = SCTPCTL_PR_ENABLE_DEFAULT; + SCTP_BASE_SYSCTL(sctp_nrsack_enable) = SCTPCTL_NRSACK_ENABLE_DEFAULT; SCTP_BASE_SYSCTL(sctp_strict_sacks) = SCTPCTL_STRICT_SACKS_DEFAULT; #if !(defined(__FreeBSD__) && __FreeBSD_version >= 800000) #if !defined(SCTP_WITH_NO_CSUM) @@ -97,8 +98,6 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_nr_incoming_streams_default) = SCTPCTL_INCOMING_STREAMS_DEFAULT; SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default) = SCTPCTL_OUTGOING_STREAMS_DEFAULT; SCTP_BASE_SYSCTL(sctp_cmt_on_off) = SCTPCTL_CMT_ON_OFF_DEFAULT; - /* EY */ - SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) = SCTPCTL_NR_SACK_ON_OFF_DEFAULT; SCTP_BASE_SYSCTL(sctp_cmt_use_dac) = SCTPCTL_CMT_USE_DAC_DEFAULT; SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst) = SCTPCTL_CWND_MAXBURST_DEFAULT; SCTP_BASE_SYSCTL(sctp_auth_disable) = SCTPCTL_AUTH_DISABLE_DEFAULT; @@ -774,6 +773,7 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) #endif RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_pr_enable), SCTPCTL_PR_ENABLE_MIN, SCTPCTL_PR_ENABLE_MAX); + RANGECHK(SCTP_BASE_SYSCTL(sctp_nrsack_enable), SCTPCTL_NRSACK_ENABLE_MIN, SCTPCTL_NRSACK_ENABLE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX); #if !(defined(__FreeBSD__) && __FreeBSD_version >= 800000) #if !defined(SCTP_WITH_NO_CSUM) @@ -809,8 +809,6 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_incoming_streams_default), SCTPCTL_INCOMING_STREAMS_MIN, SCTPCTL_INCOMING_STREAMS_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default), SCTPCTL_OUTGOING_STREAMS_MIN, SCTPCTL_OUTGOING_STREAMS_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_on_off), SCTPCTL_CMT_ON_OFF_MIN, SCTPCTL_CMT_ON_OFF_MAX); - /* EY */ - RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), SCTPCTL_NR_SACK_ON_OFF_MIN, SCTPCTL_NR_SACK_ON_OFF_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_use_dac), SCTPCTL_CMT_USE_DAC_MIN, SCTPCTL_CMT_USE_DAC_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst), SCTPCTL_CWND_MAXBURST_MIN, SCTPCTL_CWND_MAXBURST_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_auth_disable), SCTPCTL_AUTH_DISABLE_MIN, SCTPCTL_AUTH_DISABLE_MAX); @@ -1087,6 +1085,16 @@ SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, pr_enable, CTLTYPE_UINT|CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_pr_enable), 0, sysctl_sctp_check, "IU", SCTPCTL_PR_ENABLE_DESC); +#if defined(__FreeBSD__) && __FreeBSD_version < 1100000 +SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, nr_sack_on_off, CTLTYPE_UINT | CTLFLAG_RW, + &SCTP_BASE_SYSCTL(sctp_nrsack_enable), 0, sysctl_sctp_check, "IU", + SCTPCTL_NRSACK_ENABLE_DESC); +#else +SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, nrsack_enable, CTLTYPE_UINT | CTLFLAG_RW, + &SCTP_BASE_SYSCTL(sctp_nrsack_enable), 0, sysctl_sctp_check, "IU", + SCTPCTL_NRSACK_ENABLE_DESC); +#endif + SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, strict_sacks, CTLTYPE_UINT|CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU", SCTPCTL_STRICT_SACKS_DESC); @@ -1215,10 +1223,6 @@ SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, cmt_on_off, CTLTYPE_UINT|CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_cmt_on_off), 0, sysctl_sctp_check, "IU", SCTPCTL_CMT_ON_OFF_DESC); -SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, nr_sack_on_off, CTLTYPE_UINT | CTLFLAG_RW, - &SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), 0, sysctl_sctp_check, "IU", - SCTPCTL_NR_SACK_ON_OFF_DESC); - SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, cmt_use_dac, CTLTYPE_UINT|CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_cmt_use_dac), 0, sysctl_sctp_check, "IU", SCTPCTL_CMT_USE_DAC_DESC); @@ -1430,6 +1434,10 @@ void sysctl_setup_sctp(void) &SCTP_BASE_SYSCTL(sctp_pr_enable), 0, sysctl_sctp_check, SCTPCTL_PR_ENABLE_DESC); + sysctl_add_oid(&sysctl_oid_top, "nrsack_enable", CTLTYPE_INT|CTLFLAG_RW, + &SCTP_BASE_SYSCTL(sctp_nrsack_enable), 0, sysctl_sctp_check, + SCTPCTL_NRSACK_ENABLE_DESC); + sysctl_add_oid(&sysctl_oid_top, "strict_sacks", CTLTYPE_INT|CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, SCTPCTL_STRICT_SACKS_DESC); @@ -1558,11 +1566,6 @@ void sysctl_setup_sctp(void) &SCTP_BASE_SYSCTL(sctp_cmt_on_off), 0, sysctl_sctp_check, SCTPCTL_CMT_ON_OFF_DESC); - /* EY */ - sysctl_add_oid(&sysctl_oid_top, "nr_sack_on_off", CTLTYPE_INT|CTLFLAG_RW, - &SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), 0, sysctl_sctp_check, - SCTPCTL_NR_SACK_ON_OFF_DESC); - sysctl_add_oid(&sysctl_oid_top, "cmt_use_dac", CTLTYPE_INT|CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_cmt_use_dac), 0, sysctl_sctp_check, SCTPCTL_CMT_USE_DAC_DESC); diff --git a/netinet/sctp_sysctl.h b/netinet/sctp_sysctl.h index 21acb20..dcd193e 100755 --- a/netinet/sctp_sysctl.h +++ b/netinet/sctp_sysctl.h @@ -32,7 +32,7 @@ #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: head/sys/netinet/sctp_sysctl.h 269448 2014-08-02 21:36:40Z tuexen $"); +__FBSDID("$FreeBSD: head/sys/netinet/sctp_sysctl.h 269475 2014-08-03 14:10:10Z tuexen $"); #endif #ifndef _NETINET_SCTP_SYSCTL_H_ @@ -48,6 +48,7 @@ struct sctp_sysctl { uint32_t sctp_multiple_asconfs; uint32_t sctp_ecn_enable; uint32_t sctp_pr_enable; + uint32_t sctp_nrsack_enable; uint32_t sctp_fr_max_burst_default; uint32_t sctp_strict_sacks; #if !(defined(__FreeBSD__) && __FreeBSD_version >= 800000) @@ -84,8 +85,6 @@ struct sctp_sysctl { uint32_t sctp_nr_outgoing_streams_default; uint32_t sctp_cmt_on_off; uint32_t sctp_cmt_use_dac; - /* EY 5/5/08 - nr_sack flag variable */ - uint32_t sctp_nr_sack_on_off; uint32_t sctp_use_cwnd_based_maxburst; uint32_t sctp_auth_disable; uint32_t sctp_nat_friendly; @@ -178,6 +177,13 @@ struct sctp_sysctl { #define SCTPCTL_PR_ENABLE_MAX 1 #define SCTPCTL_PR_ENABLE_DEFAULT 1 +/* nrsack_enable: Enable NR_SACK */ +#define SCTPCTL_NRSACK_ENABLE_DESC "Enable NR_SACK" +#define SCTPCTL_NRSACK_ENABLE_MIN 0 +#define SCTPCTL_NRSACK_ENABLE_MAX 1 +#define SCTPCTL_NRSACK_ENABLE_DEFAULT 0 + + /* strict_sacks: Enable SCTP Strict SACK checking */ #define SCTPCTL_STRICT_SACKS_DESC "Enable SCTP Strict SACK checking" #define SCTPCTL_STRICT_SACKS_MIN 0 @@ -365,12 +371,6 @@ struct sctp_sysctl { #define SCTPCTL_CMT_ON_OFF_MAX SCTP_CMT_MAX #define SCTPCTL_CMT_ON_OFF_DEFAULT SCTP_CMT_OFF -/* EY - nr_sack_on_off: NR_SACK on/off flag */ -#define SCTPCTL_NR_SACK_ON_OFF_DESC "NR_SACK on/off flag" -#define SCTPCTL_NR_SACK_ON_OFF_MIN 0 -#define SCTPCTL_NR_SACK_ON_OFF_MAX 1 -#define SCTPCTL_NR_SACK_ON_OFF_DEFAULT 0 - /* cmt_use_dac: CMT DAC on/off flag */ #define SCTPCTL_CMT_USE_DAC_DESC "CMT DAC on/off flag" #define SCTPCTL_CMT_USE_DAC_MIN 0 diff --git a/netinet/sctp_usrreq.c b/netinet/sctp_usrreq.c index 63eb913..dd500f8 100755 --- a/netinet/sctp_usrreq.c +++ b/netinet/sctp_usrreq.c @@ -32,7 +32,7 @@ #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 269448 2014-08-02 21:36:40Z tuexen $"); +__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 269475 2014-08-03 14:10:10Z tuexen $"); #endif #include <netinet/sctp_os.h> @@ -4056,6 +4056,33 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize, } break; } + case SCTP_NRSACK_SUPPORTED: + { + struct sctp_assoc_value *av; + + SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, *optsize); + SCTP_FIND_STCB(inp, stcb, av->assoc_id); + + if (stcb) { + av->assoc_value = stcb->asoc.nrsack_supported; + SCTP_TCB_UNLOCK(stcb); + } else { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { + SCTP_INP_RLOCK(inp); + av->assoc_value = inp->nrsack_supported; + SCTP_INP_RUNLOCK(inp); + } else { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + } + } + if (error == 0) { + *optsize = sizeof(struct sctp_assoc_value); + } + break; + } case SCTP_ENABLE_STREAM_RESET: { struct sctp_assoc_value *av; @@ -6874,6 +6901,35 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, } break; } + case SCTP_NRSACK_SUPPORTED: + { + struct sctp_assoc_value *av; + + SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, optsize); + SCTP_FIND_STCB(inp, stcb, av->assoc_id); + + if (stcb) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + SCTP_TCB_UNLOCK(stcb); + } else { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { + SCTP_INP_WLOCK(inp); + if (av->assoc_value == 0) { + inp->nrsack_supported = 0; + } else { + inp->nrsack_supported = 1; + } + SCTP_INP_WUNLOCK(inp); + } else { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + } + } + break; + } default: SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT); error = ENOPROTOOPT; diff --git a/netinet/sctputil.c b/netinet/sctputil.c index 5e4887c..50c061c 100755 --- a/netinet/sctputil.c +++ b/netinet/sctputil.c @@ -32,7 +32,7 @@ #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 269448 2014-08-02 21:36:40Z tuexen $"); +__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 269475 2014-08-03 14:10:10Z tuexen $"); #endif #include <netinet/sctp_os.h> @@ -974,7 +974,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, asoc->sctp_cmt_on_off = inp->sctp_cmt_on_off; asoc->ecn_supported = inp->ecn_supported; asoc->prsctp_supported = inp->prsctp_supported; - asoc->sctp_nr_sack_on_off = (uint8_t)SCTP_BASE_SYSCTL(sctp_nr_sack_on_off); + asoc->nrsack_supported = inp->nrsack_supported; asoc->sctp_cmt_pf = (uint8_t)0; asoc->sctp_frag_point = inp->sctp_frag_point; asoc->sctp_features = inp->sctp_features; diff --git a/user_socket.c b/user_socket.c index 07ff67d..109cf99 100755 --- a/user_socket.c +++ b/user_socket.c @@ -3248,6 +3248,7 @@ USRSCTP_SYSCTL_SET_DEF(sctp_auto_asconf) USRSCTP_SYSCTL_SET_DEF(sctp_multiple_asconfs) USRSCTP_SYSCTL_SET_DEF(sctp_ecn_enable) USRSCTP_SYSCTL_SET_DEF(sctp_pr_enable) +USRSCTP_SYSCTL_SET_DEF(sctp_nrsack_enable) USRSCTP_SYSCTL_SET_DEF(sctp_strict_sacks) #if !defined(SCTP_WITH_NO_CSUM) USRSCTP_SYSCTL_SET_DEF(sctp_no_csum_on_loopback) @@ -3279,7 +3280,6 @@ USRSCTP_SYSCTL_SET_DEF(sctp_add_more_threshold) USRSCTP_SYSCTL_SET_DEF(sctp_nr_outgoing_streams_default) USRSCTP_SYSCTL_SET_DEF(sctp_cmt_on_off) USRSCTP_SYSCTL_SET_DEF(sctp_cmt_use_dac) -USRSCTP_SYSCTL_SET_DEF(sctp_nr_sack_on_off) USRSCTP_SYSCTL_SET_DEF(sctp_use_cwnd_based_maxburst) USRSCTP_SYSCTL_SET_DEF(sctp_auth_disable) USRSCTP_SYSCTL_SET_DEF(sctp_nat_friendly) @@ -3327,6 +3327,7 @@ USRSCTP_SYSCTL_GET_DEF(sctp_auto_asconf) USRSCTP_SYSCTL_GET_DEF(sctp_multiple_asconfs) USRSCTP_SYSCTL_GET_DEF(sctp_ecn_enable) USRSCTP_SYSCTL_GET_DEF(sctp_pr_enable) +USRSCTP_SYSCTL_GET_DEF(sctp_nrsack_enable) USRSCTP_SYSCTL_GET_DEF(sctp_strict_sacks) #if !defined(SCTP_WITH_NO_CSUM) USRSCTP_SYSCTL_GET_DEF(sctp_no_csum_on_loopback) @@ -3358,7 +3359,6 @@ USRSCTP_SYSCTL_GET_DEF(sctp_add_more_threshold) USRSCTP_SYSCTL_GET_DEF(sctp_nr_outgoing_streams_default) USRSCTP_SYSCTL_GET_DEF(sctp_cmt_on_off) USRSCTP_SYSCTL_GET_DEF(sctp_cmt_use_dac) -USRSCTP_SYSCTL_GET_DEF(sctp_nr_sack_on_off) USRSCTP_SYSCTL_GET_DEF(sctp_use_cwnd_based_maxburst) USRSCTP_SYSCTL_GET_DEF(sctp_auth_disable) USRSCTP_SYSCTL_GET_DEF(sctp_nat_friendly) @@ -993,6 +993,7 @@ USRSCTP_SYSCTL_DECL(sctp_auto_asconf) USRSCTP_SYSCTL_DECL(sctp_multiple_asconfs) USRSCTP_SYSCTL_DECL(sctp_ecn_enable) USRSCTP_SYSCTL_DECL(sctp_pr_enable) +USRSCTP_SYSCTL_DECL(sctp_nrsack_enable) USRSCTP_SYSCTL_DECL(sctp_strict_sacks) #if !defined(SCTP_WITH_NO_CSUM) USRSCTP_SYSCTL_DECL(sctp_no_csum_on_loopback) @@ -1025,7 +1026,6 @@ USRSCTP_SYSCTL_DECL(sctp_nr_incoming_streams_default) USRSCTP_SYSCTL_DECL(sctp_nr_outgoing_streams_default) USRSCTP_SYSCTL_DECL(sctp_cmt_on_off) USRSCTP_SYSCTL_DECL(sctp_cmt_use_dac) -USRSCTP_SYSCTL_DECL(sctp_nr_sack_on_off) USRSCTP_SYSCTL_DECL(sctp_use_cwnd_based_maxburst) USRSCTP_SYSCTL_DECL(sctp_auth_disable) USRSCTP_SYSCTL_DECL(sctp_nat_friendly) |