summaryrefslogtreecommitdiffstats
path: root/include/net/sctp
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/sctp')
-rw-r--r--include/net/sctp/command.h7
-rw-r--r--include/net/sctp/sctp.h6
-rw-r--r--include/net/sctp/structs.h146
-rw-r--r--include/net/sctp/user.h30
4 files changed, 142 insertions, 47 deletions
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index dc107ffad48..34a1a09e5ae 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -120,6 +120,7 @@ typedef union {
int error;
sctp_state_t state;
sctp_event_timeout_t to;
+ unsigned long zero;
void *ptr;
struct sctp_chunk *chunk;
struct sctp_association *asoc;
@@ -148,17 +149,17 @@ static inline sctp_arg_t SCTP_NULL(void)
}
static inline sctp_arg_t SCTP_NOFORCE(void)
{
- sctp_arg_t retval; retval.i32 = 0; return retval;
+ sctp_arg_t retval = {.zero = 0UL}; retval.i32 = 0; return retval;
}
static inline sctp_arg_t SCTP_FORCE(void)
{
- sctp_arg_t retval; retval.i32 = 1; return retval;
+ sctp_arg_t retval = {.zero = 0UL}; retval.i32 = 1; return retval;
}
#define SCTP_ARG_CONSTRUCTOR(name, type, elt) \
static inline sctp_arg_t \
SCTP_## name (type arg) \
-{ sctp_arg_t retval; retval.elt = arg; return retval; }
+{ sctp_arg_t retval = {.zero = 0UL}; retval.elt = arg; return retval; }
SCTP_ARG_CONSTRUCTOR(I32, __s32, i32)
SCTP_ARG_CONSTRUCTOR(U32, __u32, u32)
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 8f241216f46..e673b2c984e 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -175,6 +175,8 @@ void sctp_icmp_frag_needed(struct sock *, struct sctp_association *,
void sctp_icmp_proto_unreachable(struct sock *sk,
struct sctp_association *asoc,
struct sctp_transport *t);
+void sctp_backlog_migrate(struct sctp_association *assoc,
+ struct sock *oldsk, struct sock *newsk);
/*
* Section: Macros, externs, and inlines
@@ -225,13 +227,13 @@ extern int sctp_debug_flag;
if (sctp_debug_flag) { \
if (saddr->sa.sa_family == AF_INET6) { \
printk(KERN_DEBUG \
- lead "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x" trail, \
+ lead NIP6_FMT trail, \
leadparm, \
NIP6(saddr->v6.sin6_addr), \
otherparms); \
} else { \
printk(KERN_DEBUG \
- lead "%u.%u.%u.%u" trail, \
+ lead NIPQUAD_FMT trail, \
leadparm, \
NIPQUAD(saddr->v4.sin_addr.s_addr), \
otherparms); \
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 9c385b6417c..8c522ae031b 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -127,9 +127,9 @@ extern struct sctp_globals {
* RTO.Alpha - 1/8 (3 when converted to right shifts.)
* RTO.Beta - 1/4 (2 when converted to right shifts.)
*/
- __u32 rto_initial;
- __u32 rto_min;
- __u32 rto_max;
+ unsigned long rto_initial;
+ unsigned long rto_min;
+ unsigned long rto_max;
/* Note: rto_alpha and rto_beta are really defined as inverse
* powers of two to facilitate integer operations.
@@ -140,12 +140,18 @@ extern struct sctp_globals {
/* Max.Burst - 4 */
int max_burst;
- /* Valid.Cookie.Life - 60 seconds */
- int valid_cookie_life;
-
/* Whether Cookie Preservative is enabled(1) or not(0) */
int cookie_preserve_enable;
+ /* Valid.Cookie.Life - 60 seconds */
+ unsigned long valid_cookie_life;
+
+ /* Delayed SACK timeout 200ms default*/
+ unsigned long sack_timeout;
+
+ /* HB.interval - 30 seconds */
+ unsigned long hb_interval;
+
/* Association.Max.Retrans - 10 attempts
* Path.Max.Retrans - 5 attempts (per destination address)
* Max.Init.Retransmits - 8 attempts
@@ -161,11 +167,12 @@ extern struct sctp_globals {
*/
int sndbuf_policy;
- /* Delayed SACK timeout 200ms default*/
- int sack_timeout;
-
- /* HB.interval - 30 seconds */
- int hb_interval;
+ /*
+ * Policy for preforming sctp/socket accounting
+ * 0 - do socket level accounting, all assocs share sk_rcvbuf
+ * 1 - do sctp accounting, each asoc may use sk_rcvbuf bytes
+ */
+ int rcvbuf_policy;
/* The following variables are implementation specific. */
@@ -218,6 +225,7 @@ extern struct sctp_globals {
#define sctp_cookie_preserve_enable (sctp_globals.cookie_preserve_enable)
#define sctp_max_retrans_association (sctp_globals.max_retrans_association)
#define sctp_sndbuf_policy (sctp_globals.sndbuf_policy)
+#define sctp_rcvbuf_policy (sctp_globals.rcvbuf_policy)
#define sctp_max_retrans_path (sctp_globals.max_retrans_path)
#define sctp_max_retrans_init (sctp_globals.max_retrans_init)
#define sctp_sack_timeout (sctp_globals.sack_timeout)
@@ -269,6 +277,24 @@ struct sctp_sock {
__u32 default_context;
__u32 default_timetolive;
+ /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
+ * the destination address every heartbeat interval. This value
+ * will be inherited by all new associations.
+ */
+ __u32 hbinterval;
+
+ /* This is the max_retrans value for new associations. */
+ __u16 pathmaxrxt;
+
+ /* The initial Path MTU to use for new associations. */
+ __u32 pathmtu;
+
+ /* The default SACK delay timeout for new associations. */
+ __u32 sackdelay;
+
+ /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+ __u32 param_flags;
+
struct sctp_initmsg initmsg;
struct sctp_rtoinfo rtoinfo;
struct sctp_paddrparams paddrparam;
@@ -379,8 +405,9 @@ struct sctp_cookie {
/* The format of our cookie that we send to our peer. */
struct sctp_signed_cookie {
__u8 signature[SCTP_SECRET_SIZE];
+ __u32 __pad; /* force sctp_cookie alignment to 64 bits */
struct sctp_cookie c;
-};
+} __attribute__((packed));
/* This is another convenience type to allocate memory for address
* params for the maximum size and pass such structures around
@@ -801,7 +828,7 @@ struct sctp_transport {
__u32 rtt; /* This is the most recent RTT. */
/* RTO : The current retransmission timeout value. */
- __u32 rto;
+ unsigned long rto;
/* RTTVAR : The current RTT variation. */
__u32 rttvar;
@@ -837,9 +864,6 @@ struct sctp_transport {
/* Data that has been sent, but not acknowledged. */
__u32 flight_size;
- /* PMTU : The current known path MTU. */
- __u32 pmtu;
-
/* Destination */
struct dst_entry *dst;
/* Source address. */
@@ -854,7 +878,10 @@ struct sctp_transport {
/* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
* the destination address every heartbeat interval.
*/
- int hb_interval;
+ unsigned long hbinterval;
+
+ /* SACK delay timeout */
+ unsigned long sackdelay;
/* When was the last time (in jiffies) that we heard from this
* transport? We use this to pick new active and retran paths.
@@ -866,6 +893,18 @@ struct sctp_transport {
*/
unsigned long last_time_ecne_reduced;
+ /* This is the max_retrans value for the transport and will
+ * be initialized from the assocs value. This can be changed
+ * using SCTP_SET_PEER_ADDR_PARAMS socket option.
+ */
+ __u16 pathmaxrxt;
+
+ /* PMTU : The current known path MTU. */
+ __u32 pathmtu;
+
+ /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+ __u32 param_flags;
+
/* The number of times INIT has been sent on this transport. */
int init_sent_count;
@@ -874,22 +913,11 @@ struct sctp_transport {
*/
int state;
- /* hb_allowed : The current heartbeat state of this destination,
- * : i.e. ALLOW-HB, NO-HEARTBEAT, etc.
- */
- int hb_allowed;
-
/* These are the error stats for this destination. */
/* Error count : The current error count for this destination. */
unsigned short error_count;
- /* This is the max_retrans value for the transport and will
- * be initialized to proto.max_retrans.path. This can be changed
- * using SCTP_SET_PEER_ADDR_PARAMS socket option.
- */
- int max_retrans;
-
/* Per : A timer used by each destination.
* Destination :
* Timer :
@@ -1222,11 +1250,19 @@ struct sctp_endpoint {
int last_key;
int key_changed_at;
- /* Default timeouts. */
- int timeouts[SCTP_NUM_TIMEOUT_TYPES];
-
+ /* digest: This is a digest of the sctp cookie. This field is
+ * only used on the receive path when we try to validate
+ * that the cookie has not been tampered with. We put
+ * this here so we pre-allocate this once and can re-use
+ * on every receive.
+ */
+ __u8 digest[SCTP_SIGNATURE_SIZE];
+
/* sendbuf acct. policy. */
__u32 sndbuf_policy;
+
+ /* rcvbuf acct. policy. */
+ __u32 rcvbuf_policy;
};
/* Recover the outter endpoint structure. */
@@ -1472,9 +1508,9 @@ struct sctp_association {
* These values will be initialized by system defaults, but can
* be modified via the SCTP_RTOINFO socket option.
*/
- __u32 rto_initial;
- __u32 rto_max;
- __u32 rto_min;
+ unsigned long rto_initial;
+ unsigned long rto_max;
+ unsigned long rto_min;
/* Maximum number of new data packets that can be sent in a burst. */
int max_burst;
@@ -1492,9 +1528,32 @@ struct sctp_association {
__u16 init_retries;
/* The largest timeout or RTO value to use in attempting an INIT */
- __u16 max_init_timeo;
+ unsigned long max_init_timeo;
+
+ /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
+ * the destination address every heartbeat interval. This value
+ * will be inherited by all new transports.
+ */
+ unsigned long hbinterval;
+
+ /* This is the max_retrans value for new transports in the
+ * association.
+ */
+ __u16 pathmaxrxt;
+
+ /* Association : The smallest PMTU discovered for all of the
+ * PMTU : peer's transport addresses.
+ */
+ __u32 pathmtu;
+
+ /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+ __u32 param_flags;
+
+ /* SACK delay timeout */
+ unsigned long sackdelay;
+
- int timeouts[SCTP_NUM_TIMEOUT_TYPES];
+ unsigned long timeouts[SCTP_NUM_TIMEOUT_TYPES];
struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES];
/* Transport to which SHUTDOWN chunk was last sent. */
@@ -1553,16 +1612,16 @@ struct sctp_association {
*/
int sndbuf_used;
+ /* This is the amount of memory that this association has allocated
+ * in the receive path at any given time.
+ */
+ atomic_t rmem_alloc;
+
/* This is the wait queue head for send requests waiting on
* the association sndbuf space.
*/
wait_queue_head_t wait;
- /* Association : The smallest PMTU discovered for all of the
- * PMTU : peer's transport addresses.
- */
- __u32 pmtu;
-
/* The message size at which SCTP fragmentation will occur. */
__u32 frag_point;
@@ -1599,7 +1658,10 @@ struct sctp_association {
/* How many duplicated TSNs have we seen? */
int numduptsns;
- /* Number of seconds of idle time before an association is closed. */
+ /* Number of seconds of idle time before an association is closed.
+ * In the association context, this is really used as a boolean
+ * since the real timeout is stored in the timeouts array
+ */
__u32 autoclose;
/* These are to support
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index f1c3bc54526..8a6bef6f91e 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -93,6 +93,8 @@ enum sctp_optname {
#define SCTP_STATUS SCTP_STATUS
SCTP_GET_PEER_ADDR_INFO,
#define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO
+ SCTP_DELAYED_ACK_TIME,
+#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME
/* Internal Socket Options. Some of the sctp library functions are
* implemented using these socket options.
@@ -503,13 +505,41 @@ struct sctp_setadaption {
* unreachable. The following structure is used to access and modify an
* address's parameters:
*/
+enum sctp_spp_flags {
+ SPP_HB_ENABLE = 1, /*Enable heartbeats*/
+ SPP_HB_DISABLE = 2, /*Disable heartbeats*/
+ SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
+ SPP_HB_DEMAND = 4, /*Send heartbeat immediately*/
+ SPP_PMTUD_ENABLE = 8, /*Enable PMTU discovery*/
+ SPP_PMTUD_DISABLE = 16, /*Disable PMTU discovery*/
+ SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
+ SPP_SACKDELAY_ENABLE = 32, /*Enable SACK*/
+ SPP_SACKDELAY_DISABLE = 64, /*Disable SACK*/
+ SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
+};
+
struct sctp_paddrparams {
sctp_assoc_t spp_assoc_id;
struct sockaddr_storage spp_address;
__u32 spp_hbinterval;
__u16 spp_pathmaxrxt;
+ __u32 spp_pathmtu;
+ __u32 spp_sackdelay;
+ __u32 spp_flags;
} __attribute__((packed, aligned(4)));
+/* 7.1.24. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME)
+ *
+ * This options will get or set the delayed ack timer. The time is set
+ * in milliseconds. If the assoc_id is 0, then this sets or gets the
+ * endpoints default delayed ack timer value. If the assoc_id field is
+ * non-zero, then the set or get effects the specified association.
+ */
+struct sctp_assoc_value {
+ sctp_assoc_t assoc_id;
+ uint32_t assoc_value;
+};
+
/*
* 7.2.2 Peer Address Information
*