sctp: use constants from RFC 8260 to improve compliance

Keep the old constants for backwards compatibility.

MFC after:	1 week
This commit is contained in:
Michael Tuexen 2023-04-23 17:48:05 +02:00
parent 390c31c428
commit 66d6fd5322
3 changed files with 30 additions and 21 deletions

View File

@ -192,8 +192,11 @@ struct sctp_paramhdr {
/* JRS - Pluggable Congestion Control Socket option */
#define SCTP_PLUGGABLE_CC 0x00001202
/* RS - Pluggable Stream Scheduling Socket option */
#define SCTP_PLUGGABLE_SS 0x00001203
#define SCTP_SS_VALUE 0x00001204
#define SCTP_STREAM_SCHEDULER 0x00001203
#define SCTP_STREAM_SCHEDULER_VALUE 0x00001204
/* The next two are for backwards compatibility. */
#define SCTP_PLUGGABLE_SS SCTP_STREAM_SCHEDULER
#define SCTP_SS_VALUE SCTP_STREAM_SCHEDULER_VALUE
#define SCTP_CC_OPTION 0x00001205 /* Options for CC
* modules */
/* For I-DATA */
@ -309,15 +312,21 @@ struct sctp_paramhdr {
/* Default simple round-robin */
#define SCTP_SS_DEFAULT 0x00000000
/* Real round-robin */
#define SCTP_SS_ROUND_ROBIN 0x00000001
#define SCTP_SS_RR 0x00000001
/* Real round-robin per packet */
#define SCTP_SS_ROUND_ROBIN_PACKET 0x00000002
#define SCTP_SS_RR_PKT 0x00000002
/* Priority */
#define SCTP_SS_PRIORITY 0x00000003
#define SCTP_SS_PRIO 0x00000003
/* Fair Bandwidth */
#define SCTP_SS_FAIR_BANDWITH 0x00000004
#define SCTP_SS_FB 0x00000004
/* First-come, first-serve */
#define SCTP_SS_FIRST_COME 0x00000005
#define SCTP_SS_FCFS 0x00000005
/* The next five are for backwards compatibility. */
#define SCTP_SS_ROUND_ROBIN SCTP_SS_RR
#define SCTP_SS_ROUND_ROBIN_PACKET SCTP_SS_RR_PKT
#define SCTP_SS_PRIORITY SCTP_SS_PRIO
#define SCTP_SS_FAIR_BANDWITH SCTP_SS_FB
#define SCTP_SS_FIRST_COME SCTP_SS_FCFS
/* fragment interleave constants
* setting must be one of these or

View File

@ -952,7 +952,7 @@ const struct sctp_ss_functions sctp_ss_functions[] = {
.sctp_ss_set_value = sctp_ss_default_set_value,
.sctp_ss_is_user_msgs_incomplete = sctp_ss_default_is_user_msgs_incomplete
},
/* SCTP_SS_ROUND_ROBIN */
/* SCTP_SS_RR */
{
.sctp_ss_init = sctp_ss_default_init,
.sctp_ss_clear = sctp_ss_default_clear,
@ -967,7 +967,7 @@ const struct sctp_ss_functions sctp_ss_functions[] = {
.sctp_ss_set_value = sctp_ss_default_set_value,
.sctp_ss_is_user_msgs_incomplete = sctp_ss_default_is_user_msgs_incomplete
},
/* SCTP_SS_ROUND_ROBIN_PACKET */
/* SCTP_SS_RR_PKT */
{
.sctp_ss_init = sctp_ss_default_init,
.sctp_ss_clear = sctp_ss_default_clear,
@ -982,7 +982,7 @@ const struct sctp_ss_functions sctp_ss_functions[] = {
.sctp_ss_set_value = sctp_ss_default_set_value,
.sctp_ss_is_user_msgs_incomplete = sctp_ss_default_is_user_msgs_incomplete
},
/* SCTP_SS_PRIORITY */
/* SCTP_SS_PRIO */
{
.sctp_ss_init = sctp_ss_default_init,
.sctp_ss_clear = sctp_ss_prio_clear,
@ -997,7 +997,7 @@ const struct sctp_ss_functions sctp_ss_functions[] = {
.sctp_ss_set_value = sctp_ss_prio_set_value,
.sctp_ss_is_user_msgs_incomplete = sctp_ss_default_is_user_msgs_incomplete
},
/* SCTP_SS_FAIR_BANDWITH */
/* SCTP_SS_FB */
{
.sctp_ss_init = sctp_ss_default_init,
.sctp_ss_clear = sctp_ss_fb_clear,
@ -1012,7 +1012,7 @@ const struct sctp_ss_functions sctp_ss_functions[] = {
.sctp_ss_set_value = sctp_ss_default_set_value,
.sctp_ss_is_user_msgs_incomplete = sctp_ss_default_is_user_msgs_incomplete
},
/* SCTP_SS_FIRST_COME */
/* SCTP_SS_FCFS */
{
.sctp_ss_init = sctp_ss_fcfs_init,
.sctp_ss_clear = sctp_ss_fcfs_clear,

View File

@ -1738,7 +1738,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
}
break;
}
case SCTP_PLUGGABLE_SS:
case SCTP_STREAM_SCHEDULER:
{
struct sctp_assoc_value *av;
@ -1765,7 +1765,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
}
break;
}
case SCTP_SS_VALUE:
case SCTP_STREAM_SCHEDULER_VALUE:
{
struct sctp_stream_value *av;
@ -4033,17 +4033,17 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
}
break;
}
case SCTP_PLUGGABLE_SS:
case SCTP_STREAM_SCHEDULER:
{
struct sctp_assoc_value *av;
SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, optsize);
if ((av->assoc_value != SCTP_SS_DEFAULT) &&
(av->assoc_value != SCTP_SS_ROUND_ROBIN) &&
(av->assoc_value != SCTP_SS_ROUND_ROBIN_PACKET) &&
(av->assoc_value != SCTP_SS_PRIORITY) &&
(av->assoc_value != SCTP_SS_FAIR_BANDWITH) &&
(av->assoc_value != SCTP_SS_FIRST_COME)) {
(av->assoc_value != SCTP_SS_RR) &&
(av->assoc_value != SCTP_SS_RR_PKT) &&
(av->assoc_value != SCTP_SS_PRIO) &&
(av->assoc_value != SCTP_SS_FB) &&
(av->assoc_value != SCTP_SS_FCFS)) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
error = EINVAL;
break;
@ -4082,7 +4082,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
}
break;
}
case SCTP_SS_VALUE:
case SCTP_STREAM_SCHEDULER_VALUE:
{
struct sctp_stream_value *av;