aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sctp
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/net/sctp
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'include/net/sctp')
-rw-r--r--include/net/sctp/command.h6
-rw-r--r--include/net/sctp/constants.h32
-rw-r--r--include/net/sctp/sctp.h63
-rw-r--r--include/net/sctp/sm.h15
-rw-r--r--include/net/sctp/structs.h29
-rw-r--r--include/net/sctp/tsnmap.h2
-rw-r--r--include/net/sctp/ulpevent.h5
-rw-r--r--include/net/sctp/user.h38
8 files changed, 105 insertions, 85 deletions
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 2c55a7ea20af..6506458ccd33 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -63,6 +63,7 @@ typedef enum {
63 SCTP_CMD_ECN_ECNE, /* Do delayed ECNE processing. */ 63 SCTP_CMD_ECN_ECNE, /* Do delayed ECNE processing. */
64 SCTP_CMD_ECN_CWR, /* Do delayed CWR processing. */ 64 SCTP_CMD_ECN_CWR, /* Do delayed CWR processing. */
65 SCTP_CMD_TIMER_START, /* Start a timer. */ 65 SCTP_CMD_TIMER_START, /* Start a timer. */
66 SCTP_CMD_TIMER_START_ONCE, /* Start a timer once */
66 SCTP_CMD_TIMER_RESTART, /* Restart a timer. */ 67 SCTP_CMD_TIMER_RESTART, /* Restart a timer. */
67 SCTP_CMD_TIMER_STOP, /* Stop a timer. */ 68 SCTP_CMD_TIMER_STOP, /* Stop a timer. */
68 SCTP_CMD_INIT_CHOOSE_TRANSPORT, /* Choose transport for an INIT. */ 69 SCTP_CMD_INIT_CHOOSE_TRANSPORT, /* Choose transport for an INIT. */
@@ -73,7 +74,6 @@ typedef enum {
73 SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */ 74 SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */
74 SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */ 75 SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */
75 SCTP_CMD_STRIKE, /* Mark a strike against a transport. */ 76 SCTP_CMD_STRIKE, /* Mark a strike against a transport. */
76 SCTP_CMD_TRANSMIT, /* Transmit the outqueue. */
77 SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */ 77 SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */
78 SCTP_CMD_HB_TIMER_UPDATE, /* Update a heartbeat timers. */ 78 SCTP_CMD_HB_TIMER_UPDATE, /* Update a heartbeat timers. */
79 SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */ 79 SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */
@@ -108,12 +108,10 @@ typedef enum {
108 SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */ 108 SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */
109 SCTP_CMD_SEND_MSG, /* Send the whole use message */ 109 SCTP_CMD_SEND_MSG, /* Send the whole use message */
110 SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */ 110 SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */
111 SCTP_CMD_PURGE_ASCONF_QUEUE, /* Purge all asconf queues.*/
111 SCTP_CMD_LAST 112 SCTP_CMD_LAST
112} sctp_verb_t; 113} sctp_verb_t;
113 114
114#define SCTP_CMD_MAX (SCTP_CMD_LAST - 1)
115#define SCTP_CMD_NUM_VERBS (SCTP_CMD_MAX + 1)
116
117/* How many commands can you put in an sctp_cmd_seq_t? 115/* How many commands can you put in an sctp_cmd_seq_t?
118 * This is a rather arbitrary number, ideally derived from a careful 116 * This is a rather arbitrary number, ideally derived from a careful
119 * analysis of the state functions, but in reality just taken from 117 * analysis of the state functions, but in reality just taken from
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 63908840eef0..942b864f6135 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -61,7 +61,6 @@ enum { SCTP_DEFAULT_INSTREAMS = SCTP_MAX_STREAM };
61 * symbols. CIDs are dense through SCTP_CID_BASE_MAX. 61 * symbols. CIDs are dense through SCTP_CID_BASE_MAX.
62 */ 62 */
63#define SCTP_CID_BASE_MAX SCTP_CID_SHUTDOWN_COMPLETE 63#define SCTP_CID_BASE_MAX SCTP_CID_SHUTDOWN_COMPLETE
64#define SCTP_CID_MAX SCTP_CID_ASCONF_ACK
65 64
66#define SCTP_NUM_BASE_CHUNK_TYPES (SCTP_CID_BASE_MAX + 1) 65#define SCTP_NUM_BASE_CHUNK_TYPES (SCTP_CID_BASE_MAX + 1)
67 66
@@ -86,9 +85,6 @@ typedef enum {
86 85
87} sctp_event_t; 86} sctp_event_t;
88 87
89#define SCTP_EVENT_T_MAX SCTP_EVENT_T_PRIMITIVE
90#define SCTP_EVENT_T_NUM (SCTP_EVENT_T_MAX + 1)
91
92/* As a convenience for the state machine, we append SCTP_EVENT_* and 88/* As a convenience for the state machine, we append SCTP_EVENT_* and
93 * SCTP_ULP_* to the list of possible chunks. 89 * SCTP_ULP_* to the list of possible chunks.
94 */ 90 */
@@ -154,7 +150,6 @@ SCTP_SUBTYPE_CONSTRUCTOR(OTHER, sctp_event_other_t, other)
154SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive) 150SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive)
155 151
156 152
157#define sctp_chunk_is_control(a) (a->chunk_hdr->type != SCTP_CID_DATA)
158#define sctp_chunk_is_data(a) (a->chunk_hdr->type == SCTP_CID_DATA) 153#define sctp_chunk_is_data(a) (a->chunk_hdr->type == SCTP_CID_DATA)
159 154
160/* Calculate the actual data size in a data chunk */ 155/* Calculate the actual data size in a data chunk */
@@ -162,9 +157,6 @@ SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive)
162 - (unsigned long)(c->chunk_hdr)\ 157 - (unsigned long)(c->chunk_hdr)\
163 - sizeof(sctp_data_chunk_t))) 158 - sizeof(sctp_data_chunk_t)))
164 159
165#define SCTP_MAX_ERROR_CAUSE SCTP_ERROR_NONEXIST_IP
166#define SCTP_NUM_ERROR_CAUSE 10
167
168/* Internal error codes */ 160/* Internal error codes */
169typedef enum { 161typedef enum {
170 162
@@ -195,15 +187,14 @@ typedef enum {
195/* SCTP state defines for internal state machine */ 187/* SCTP state defines for internal state machine */
196typedef enum { 188typedef enum {
197 189
198 SCTP_STATE_EMPTY = 0, 190 SCTP_STATE_CLOSED = 0,
199 SCTP_STATE_CLOSED = 1, 191 SCTP_STATE_COOKIE_WAIT = 1,
200 SCTP_STATE_COOKIE_WAIT = 2, 192 SCTP_STATE_COOKIE_ECHOED = 2,
201 SCTP_STATE_COOKIE_ECHOED = 3, 193 SCTP_STATE_ESTABLISHED = 3,
202 SCTP_STATE_ESTABLISHED = 4, 194 SCTP_STATE_SHUTDOWN_PENDING = 4,
203 SCTP_STATE_SHUTDOWN_PENDING = 5, 195 SCTP_STATE_SHUTDOWN_SENT = 5,
204 SCTP_STATE_SHUTDOWN_SENT = 6, 196 SCTP_STATE_SHUTDOWN_RECEIVED = 6,
205 SCTP_STATE_SHUTDOWN_RECEIVED = 7, 197 SCTP_STATE_SHUTDOWN_ACK_SENT = 7,
206 SCTP_STATE_SHUTDOWN_ACK_SENT = 8,
207 198
208} sctp_state_t; 199} sctp_state_t;
209 200
@@ -266,7 +257,6 @@ enum { SCTP_ARBITRARY_COOKIE_ECHO_LEN = 200 };
266#define SCTP_TSN_MAP_INITIAL BITS_PER_LONG 257#define SCTP_TSN_MAP_INITIAL BITS_PER_LONG
267#define SCTP_TSN_MAP_INCREMENT SCTP_TSN_MAP_INITIAL 258#define SCTP_TSN_MAP_INCREMENT SCTP_TSN_MAP_INITIAL
268#define SCTP_TSN_MAP_SIZE 4096 259#define SCTP_TSN_MAP_SIZE 4096
269#define SCTP_TSN_MAX_GAP 65535
270 260
271/* We will not record more than this many duplicate TSNs between two 261/* We will not record more than this many duplicate TSNs between two
272 * SACKs. The minimum PMTU is 576. Remove all the headers and there 262 * SACKs. The minimum PMTU is 576. Remove all the headers and there
@@ -301,9 +291,6 @@ enum { SCTP_MAX_GABS = 16 };
301 291
302#define SCTP_CLOCK_GRANULARITY 1 /* 1 jiffy */ 292#define SCTP_CLOCK_GRANULARITY 1 /* 1 jiffy */
303 293
304#define SCTP_DEF_MAX_INIT 6
305#define SCTP_DEF_MAX_SEND 10
306
307#define SCTP_DEFAULT_COOKIE_LIFE (60 * 1000) /* 60 seconds */ 294#define SCTP_DEFAULT_COOKIE_LIFE (60 * 1000) /* 60 seconds */
308 295
309#define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */ 296#define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */
@@ -317,9 +304,6 @@ enum { SCTP_MAX_GABS = 16 };
317 */ 304 */
318#define SCTP_DEFAULT_MINSEGMENT 512 /* MTU size ... if no mtu disc */ 305#define SCTP_DEFAULT_MINSEGMENT 512 /* MTU size ... if no mtu disc */
319#define SCTP_HOW_MANY_SECRETS 2 /* How many secrets I keep */ 306#define SCTP_HOW_MANY_SECRETS 2 /* How many secrets I keep */
320#define SCTP_HOW_LONG_COOKIE_LIVE 3600 /* How many seconds the current
321 * secret will live?
322 */
323#define SCTP_SECRET_SIZE 32 /* Number of octets in a 256 bits. */ 307#define SCTP_SECRET_SIZE 32 /* Number of octets in a 256 bits. */
324 308
325#define SCTP_SIGNATURE_SIZE 20 /* size of a SLA-1 signature */ 309#define SCTP_SIGNATURE_SIZE 20 /* size of a SLA-1 signature */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 65946bc43d00..b2c2366676a7 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -115,7 +115,6 @@
115 * sctp/protocol.c 115 * sctp/protocol.c
116 */ 116 */
117extern struct sock *sctp_get_ctl_sock(void); 117extern struct sock *sctp_get_ctl_sock(void);
118extern void sctp_local_addr_free(struct rcu_head *head);
119extern int sctp_copy_local_addr_list(struct sctp_bind_addr *, 118extern int sctp_copy_local_addr_list(struct sctp_bind_addr *,
120 sctp_scope_t, gfp_t gfp, 119 sctp_scope_t, gfp_t gfp,
121 int flags); 120 int flags);
@@ -275,24 +274,35 @@ struct sctp_mib {
275/* Print debugging messages. */ 274/* Print debugging messages. */
276#if SCTP_DEBUG 275#if SCTP_DEBUG
277extern int sctp_debug_flag; 276extern int sctp_debug_flag;
278#define SCTP_DEBUG_PRINTK(whatever...) \ 277#define SCTP_DEBUG_PRINTK(fmt, args...) \
279 ((void) (sctp_debug_flag && printk(KERN_DEBUG whatever))) 278do { \
280#define SCTP_DEBUG_PRINTK_IPADDR(lead, trail, leadparm, saddr, otherparms...) \ 279 if (sctp_debug_flag) \
281 if (sctp_debug_flag) { \ 280 printk(KERN_DEBUG pr_fmt(fmt), ##args); \
282 if (saddr->sa.sa_family == AF_INET6) { \ 281} while (0)
283 printk(KERN_DEBUG \ 282#define SCTP_DEBUG_PRINTK_CONT(fmt, args...) \
284 lead "%pI6" trail, \ 283do { \
285 leadparm, \ 284 if (sctp_debug_flag) \
286 &saddr->v6.sin6_addr, \ 285 pr_cont(fmt, ##args); \
287 otherparms); \ 286} while (0)
288 } else { \ 287#define SCTP_DEBUG_PRINTK_IPADDR(fmt_lead, fmt_trail, \
289 printk(KERN_DEBUG \ 288 args_lead, saddr, args_trail...) \
290 lead "%pI4" trail, \ 289do { \
291 leadparm, \ 290 if (sctp_debug_flag) { \
292 &saddr->v4.sin_addr.s_addr, \ 291 if (saddr->sa.sa_family == AF_INET6) { \
293 otherparms); \ 292 printk(KERN_DEBUG \
294 } \ 293 pr_fmt(fmt_lead "%pI6" fmt_trail), \
295 } 294 args_lead, \
295 &saddr->v6.sin6_addr, \
296 args_trail); \
297 } else { \
298 printk(KERN_DEBUG \
299 pr_fmt(fmt_lead "%pI4" fmt_trail), \
300 args_lead, \
301 &saddr->v4.sin_addr.s_addr, \
302 args_trail); \
303 } \
304 } \
305} while (0)
296#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } 306#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; }
297#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } 307#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; }
298 308
@@ -306,6 +316,7 @@ extern int sctp_debug_flag;
306#else /* SCTP_DEBUG */ 316#else /* SCTP_DEBUG */
307 317
308#define SCTP_DEBUG_PRINTK(whatever...) 318#define SCTP_DEBUG_PRINTK(whatever...)
319#define SCTP_DEBUG_PRINTK_CONT(fmt, args...)
309#define SCTP_DEBUG_PRINTK_IPADDR(whatever...) 320#define SCTP_DEBUG_PRINTK_IPADDR(whatever...)
310#define SCTP_ENABLE_DEBUG 321#define SCTP_ENABLE_DEBUG
311#define SCTP_DISABLE_DEBUG 322#define SCTP_DISABLE_DEBUG
@@ -393,7 +404,7 @@ static inline void sctp_v6_del_protocol(void) { return; }
393/* Map an association to an assoc_id. */ 404/* Map an association to an assoc_id. */
394static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) 405static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc)
395{ 406{
396 return (asoc?asoc->assoc_id:0); 407 return asoc ? asoc->assoc_id : 0;
397} 408}
398 409
399/* Look up the association by its id. */ 410/* Look up the association by its id. */
@@ -461,7 +472,7 @@ static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
461/* Tests if the list has one and only one entry. */ 472/* Tests if the list has one and only one entry. */
462static inline int sctp_list_single_entry(struct list_head *head) 473static inline int sctp_list_single_entry(struct list_head *head)
463{ 474{
464 return ((head->next != head) && (head->next == head->prev)); 475 return (head->next != head) && (head->next == head->prev);
465} 476}
466 477
467/* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ 478/* Generate a random jitter in the range of -50% ~ +50% of input RTO. */
@@ -519,7 +530,6 @@ _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member)
519 530
520#define _sctp_walk_params(pos, chunk, end, member)\ 531#define _sctp_walk_params(pos, chunk, end, member)\
521for (pos.v = chunk->member;\ 532for (pos.v = chunk->member;\
522 pos.v <= (void *)chunk + end - sizeof(sctp_paramhdr_t) &&\
523 pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ 533 pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\
524 ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ 534 ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\
525 pos.v += WORD_ROUND(ntohs(pos.p->length))) 535 pos.v += WORD_ROUND(ntohs(pos.p->length)))
@@ -530,7 +540,6 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))
530#define _sctp_walk_errors(err, chunk_hdr, end)\ 540#define _sctp_walk_errors(err, chunk_hdr, end)\
531for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ 541for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \
532 sizeof(sctp_chunkhdr_t));\ 542 sizeof(sctp_chunkhdr_t));\
533 (void *)err <= (void *)chunk_hdr + end - sizeof(sctp_errhdr_t) &&\
534 (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ 543 (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\
535 ntohs(err->length) >= sizeof(sctp_errhdr_t); \ 544 ntohs(err->length) >= sizeof(sctp_errhdr_t); \
536 err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length)))) 545 err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length))))
@@ -619,13 +628,13 @@ static inline int sctp_sanity_check(void)
619/* This is the hash function for the SCTP port hash table. */ 628/* This is the hash function for the SCTP port hash table. */
620static inline int sctp_phashfn(__u16 lport) 629static inline int sctp_phashfn(__u16 lport)
621{ 630{
622 return (lport & (sctp_port_hashsize - 1)); 631 return lport & (sctp_port_hashsize - 1);
623} 632}
624 633
625/* This is the hash function for the endpoint hash table. */ 634/* This is the hash function for the endpoint hash table. */
626static inline int sctp_ep_hashfn(__u16 lport) 635static inline int sctp_ep_hashfn(__u16 lport)
627{ 636{
628 return (lport & (sctp_ep_hashsize - 1)); 637 return lport & (sctp_ep_hashsize - 1);
629} 638}
630 639
631/* This is the hash function for the association hash table. */ 640/* This is the hash function for the association hash table. */
@@ -633,7 +642,7 @@ static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport)
633{ 642{
634 int h = (lport << 16) + rport; 643 int h = (lport << 16) + rport;
635 h ^= h>>8; 644 h ^= h>>8;
636 return (h & (sctp_assoc_hashsize - 1)); 645 return h & (sctp_assoc_hashsize - 1);
637} 646}
638 647
639/* This is the hash function for the association hash table. This is 648/* This is the hash function for the association hash table. This is
@@ -644,7 +653,7 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag)
644{ 653{
645 int h = (lport << 16) + rport; 654 int h = (lport << 16) + rport;
646 h ^= vtag; 655 h ^= vtag;
647 return (h & (sctp_assoc_hashsize-1)); 656 return h & (sctp_assoc_hashsize - 1);
648} 657}
649 658
650#define sctp_for_each_hentry(epb, node, head) \ 659#define sctp_for_each_hentry(epb, node, head) \
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 4088c89a9055..9148632b8204 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -165,6 +165,7 @@ sctp_state_fn_t sctp_sf_do_prm_requestheartbeat;
165sctp_state_fn_t sctp_sf_do_prm_asconf; 165sctp_state_fn_t sctp_sf_do_prm_asconf;
166 166
167/* Prototypes for other event state functions. */ 167/* Prototypes for other event state functions. */
168sctp_state_fn_t sctp_sf_do_no_pending_tsn;
168sctp_state_fn_t sctp_sf_do_9_2_start_shutdown; 169sctp_state_fn_t sctp_sf_do_9_2_start_shutdown;
169sctp_state_fn_t sctp_sf_do_9_2_shutdown_ack; 170sctp_state_fn_t sctp_sf_do_9_2_shutdown_ack;
170sctp_state_fn_t sctp_sf_ignore_other; 171sctp_state_fn_t sctp_sf_ignore_other;
@@ -232,9 +233,7 @@ struct sctp_chunk *sctp_make_violation_paramlen(const struct sctp_association *,
232 const struct sctp_chunk *, 233 const struct sctp_chunk *,
233 struct sctp_paramhdr *); 234 struct sctp_paramhdr *);
234struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *, 235struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *,
235 const struct sctp_transport *, 236 const struct sctp_transport *);
236 const void *payload,
237 const size_t paylen);
238struct sctp_chunk *sctp_make_heartbeat_ack(const struct sctp_association *, 237struct sctp_chunk *sctp_make_heartbeat_ack(const struct sctp_association *,
239 const struct sctp_chunk *, 238 const struct sctp_chunk *,
240 const void *payload, 239 const void *payload,
@@ -345,12 +344,12 @@ enum {
345 344
346static inline int TSN_lt(__u32 s, __u32 t) 345static inline int TSN_lt(__u32 s, __u32 t)
347{ 346{
348 return (((s) - (t)) & TSN_SIGN_BIT); 347 return ((s) - (t)) & TSN_SIGN_BIT;
349} 348}
350 349
351static inline int TSN_lte(__u32 s, __u32 t) 350static inline int TSN_lte(__u32 s, __u32 t)
352{ 351{
353 return (((s) == (t)) || (((s) - (t)) & TSN_SIGN_BIT)); 352 return ((s) == (t)) || (((s) - (t)) & TSN_SIGN_BIT);
354} 353}
355 354
356/* Compare two SSNs */ 355/* Compare two SSNs */
@@ -369,12 +368,12 @@ enum {
369 368
370static inline int SSN_lt(__u16 s, __u16 t) 369static inline int SSN_lt(__u16 s, __u16 t)
371{ 370{
372 return (((s) - (t)) & SSN_SIGN_BIT); 371 return ((s) - (t)) & SSN_SIGN_BIT;
373} 372}
374 373
375static inline int SSN_lte(__u16 s, __u16 t) 374static inline int SSN_lte(__u16 s, __u16 t)
376{ 375{
377 return (((s) == (t)) || (((s) - (t)) & SSN_SIGN_BIT)); 376 return ((s) == (t)) || (((s) - (t)) & SSN_SIGN_BIT);
378} 377}
379 378
380/* 379/*
@@ -388,7 +387,7 @@ enum {
388 387
389static inline int ADDIP_SERIAL_gte(__u16 s, __u16 t) 388static inline int ADDIP_SERIAL_gte(__u16 s, __u16 t)
390{ 389{
391 return (((s) == (t)) || (((t) - (s)) & ADDIP_SERIAL_SIGN_BIT)); 390 return ((s) == (t)) || (((t) - (s)) & ADDIP_SERIAL_SIGN_BIT);
392} 391}
393 392
394/* Check VTAG of the packet matches the sender's own tag. */ 393/* Check VTAG of the packet matches the sender's own tag. */
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index f9e7473613bd..7df327a6d564 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -261,8 +261,6 @@ extern struct sctp_globals {
261#define sctp_assoc_hashsize (sctp_globals.assoc_hashsize) 261#define sctp_assoc_hashsize (sctp_globals.assoc_hashsize)
262#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable) 262#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable)
263#define sctp_port_hashsize (sctp_globals.port_hashsize) 263#define sctp_port_hashsize (sctp_globals.port_hashsize)
264#define sctp_port_rover (sctp_globals.port_rover)
265#define sctp_port_alloc_lock (sctp_globals.port_alloc_lock)
266#define sctp_port_hashtable (sctp_globals.port_hashtable) 264#define sctp_port_hashtable (sctp_globals.port_hashtable)
267#define sctp_local_addr_list (sctp_globals.local_addr_list) 265#define sctp_local_addr_list (sctp_globals.local_addr_list)
268#define sctp_local_addr_lock (sctp_globals.addr_list_lock) 266#define sctp_local_addr_lock (sctp_globals.addr_list_lock)
@@ -424,7 +422,7 @@ struct sctp_cookie {
424 __u32 adaptation_ind; 422 __u32 adaptation_ind;
425 423
426 __u8 auth_random[sizeof(sctp_paramhdr_t) + SCTP_AUTH_RANDOM_LENGTH]; 424 __u8 auth_random[sizeof(sctp_paramhdr_t) + SCTP_AUTH_RANDOM_LENGTH];
427 __u8 auth_hmacs[SCTP_AUTH_NUM_HMACS + 2]; 425 __u8 auth_hmacs[SCTP_AUTH_NUM_HMACS * sizeof(__u16) + 2];
428 __u8 auth_chunks[sizeof(sctp_paramhdr_t) + SCTP_AUTH_MAX_CHUNKS]; 426 __u8 auth_chunks[sizeof(sctp_paramhdr_t) + SCTP_AUTH_MAX_CHUNKS];
429 427
430 /* This is a shim for my peer's INIT packet, followed by 428 /* This is a shim for my peer's INIT packet, followed by
@@ -566,19 +564,15 @@ struct sctp_af {
566 int optname, 564 int optname,
567 char __user *optval, 565 char __user *optval,
568 int __user *optlen); 566 int __user *optlen);
569 struct dst_entry *(*get_dst) (struct sctp_association *asoc, 567 void (*get_dst) (struct sctp_transport *t,
570 union sctp_addr *daddr, 568 union sctp_addr *saddr,
571 union sctp_addr *saddr); 569 struct flowi *fl,
570 struct sock *sk);
572 void (*get_saddr) (struct sctp_sock *sk, 571 void (*get_saddr) (struct sctp_sock *sk,
573 struct sctp_association *asoc, 572 struct sctp_transport *t,
574 struct dst_entry *dst, 573 struct flowi *fl);
575 union sctp_addr *daddr,
576 union sctp_addr *saddr);
577 void (*copy_addrlist) (struct list_head *, 574 void (*copy_addrlist) (struct list_head *,
578 struct net_device *); 575 struct net_device *);
579 void (*dst_saddr) (union sctp_addr *saddr,
580 struct dst_entry *dst,
581 __be16 port);
582 int (*cmp_addr) (const union sctp_addr *addr1, 576 int (*cmp_addr) (const union sctp_addr *addr1,
583 const union sctp_addr *addr2); 577 const union sctp_addr *addr2);
584 void (*addr_copy) (union sctp_addr *dst, 578 void (*addr_copy) (union sctp_addr *dst,
@@ -847,7 +841,7 @@ void sctp_packet_free(struct sctp_packet *);
847 841
848static inline int sctp_packet_empty(struct sctp_packet *packet) 842static inline int sctp_packet_empty(struct sctp_packet *packet)
849{ 843{
850 return (packet->size == packet->overhead); 844 return packet->size == packet->overhead;
851} 845}
852 846
853/* This represents a remote transport address. 847/* This represents a remote transport address.
@@ -900,6 +894,7 @@ struct sctp_transport {
900 /* Is this structure kfree()able? */ 894 /* Is this structure kfree()able? */
901 malloced:1; 895 malloced:1;
902 896
897 struct flowi fl;
903 898
904 /* This is the peer's IP address and port. */ 899 /* This is the peer's IP address and port. */
905 union sctp_addr ipaddr; 900 union sctp_addr ipaddr;
@@ -1063,7 +1058,7 @@ void sctp_transport_set_owner(struct sctp_transport *,
1063 struct sctp_association *); 1058 struct sctp_association *);
1064void sctp_transport_route(struct sctp_transport *, union sctp_addr *, 1059void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
1065 struct sctp_sock *); 1060 struct sctp_sock *);
1066void sctp_transport_pmtu(struct sctp_transport *); 1061void sctp_transport_pmtu(struct sctp_transport *, struct sock *sk);
1067void sctp_transport_free(struct sctp_transport *); 1062void sctp_transport_free(struct sctp_transport *);
1068void sctp_transport_reset_timers(struct sctp_transport *); 1063void sctp_transport_reset_timers(struct sctp_transport *);
1069void sctp_transport_hold(struct sctp_transport *); 1064void sctp_transport_hold(struct sctp_transport *);
@@ -1402,7 +1397,7 @@ int sctp_has_association(const union sctp_addr *laddr,
1402int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t, 1397int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t,
1403 sctp_init_chunk_t *peer_init, struct sctp_chunk *chunk, 1398 sctp_init_chunk_t *peer_init, struct sctp_chunk *chunk,
1404 struct sctp_chunk **err_chunk); 1399 struct sctp_chunk **err_chunk);
1405int sctp_process_init(struct sctp_association *, sctp_cid_t cid, 1400int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk,
1406 const union sctp_addr *peer, 1401 const union sctp_addr *peer,
1407 sctp_init_chunk_t *init, gfp_t gfp); 1402 sctp_init_chunk_t *init, gfp_t gfp);
1408__u32 sctp_generate_tag(const struct sctp_endpoint *); 1403__u32 sctp_generate_tag(const struct sctp_endpoint *);
@@ -1998,7 +1993,7 @@ void sctp_assoc_clean_asconf_ack_cache(const struct sctp_association *asoc);
1998struct sctp_chunk *sctp_assoc_lookup_asconf_ack( 1993struct sctp_chunk *sctp_assoc_lookup_asconf_ack(
1999 const struct sctp_association *asoc, 1994 const struct sctp_association *asoc,
2000 __be32 serial); 1995 __be32 serial);
2001 1996void sctp_asconf_queue_teardown(struct sctp_association *asoc);
2002 1997
2003int sctp_cmp_addr_exact(const union sctp_addr *ss1, 1998int sctp_cmp_addr_exact(const union sctp_addr *ss1,
2004 const union sctp_addr *ss2); 1999 const union sctp_addr *ss2);
diff --git a/include/net/sctp/tsnmap.h b/include/net/sctp/tsnmap.h
index 4aabc5a96cf6..e7728bc14ccf 100644
--- a/include/net/sctp/tsnmap.h
+++ b/include/net/sctp/tsnmap.h
@@ -157,7 +157,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map);
157/* Is there a gap in the TSN map? */ 157/* Is there a gap in the TSN map? */
158static inline int sctp_tsnmap_has_gap(const struct sctp_tsnmap *map) 158static inline int sctp_tsnmap_has_gap(const struct sctp_tsnmap *map)
159{ 159{
160 return (map->cumulative_tsn_ack_point != map->max_tsn_seen); 160 return map->cumulative_tsn_ack_point != map->max_tsn_seen;
161} 161}
162 162
163/* Mark a duplicate TSN. Note: limit the storage of duplicate TSN 163/* Mark a duplicate TSN. Note: limit the storage of duplicate TSN
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 7ea12e8e6676..ca4693b4e09e 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -80,7 +80,7 @@ static inline struct sctp_ulpevent *sctp_skb2event(struct sk_buff *skb)
80 80
81void sctp_ulpevent_free(struct sctp_ulpevent *); 81void sctp_ulpevent_free(struct sctp_ulpevent *);
82int sctp_ulpevent_is_notification(const struct sctp_ulpevent *); 82int sctp_ulpevent_is_notification(const struct sctp_ulpevent *);
83void sctp_queue_purge_ulpevents(struct sk_buff_head *list); 83unsigned int sctp_queue_purge_ulpevents(struct sk_buff_head *list);
84 84
85struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( 85struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
86 const struct sctp_association *asoc, 86 const struct sctp_association *asoc,
@@ -132,6 +132,9 @@ struct sctp_ulpevent *sctp_ulpevent_make_authkey(
132 const struct sctp_association *asoc, __u16 key_id, 132 const struct sctp_association *asoc, __u16 key_id,
133 __u32 indication, gfp_t gfp); 133 __u32 indication, gfp_t gfp);
134 134
135struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event(
136 const struct sctp_association *asoc, gfp_t gfp);
137
135void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, 138void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
136 struct msghdr *); 139 struct msghdr *);
137__u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event); 140__u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 2b2769c5ca9f..32fd51274037 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -78,6 +78,7 @@ typedef __s32 sctp_assoc_t;
78#define SCTP_GET_PEER_ADDR_INFO 15 78#define SCTP_GET_PEER_ADDR_INFO 15
79#define SCTP_DELAYED_ACK_TIME 16 79#define SCTP_DELAYED_ACK_TIME 16
80#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME 80#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
81#define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME
81#define SCTP_CONTEXT 17 82#define SCTP_CONTEXT 17
82#define SCTP_FRAGMENT_INTERLEAVE 18 83#define SCTP_FRAGMENT_INTERLEAVE 18
83#define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */ 84#define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */
@@ -90,6 +91,7 @@ typedef __s32 sctp_assoc_t;
90#define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */ 91#define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */
91#define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ 92#define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */
92#define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ 93#define SCTP_GET_ASSOC_NUMBER 28 /* Read only */
94#define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */
93 95
94/* Internal Socket Options. Some of the sctp library functions are 96/* Internal Socket Options. Some of the sctp library functions are
95 * implemented using these socket options. 97 * implemented using these socket options.
@@ -99,8 +101,8 @@ typedef __s32 sctp_assoc_t;
99#define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */ 101#define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */
100/* Options 104-106 are deprecated and removed. Do not use this space */ 102/* Options 104-106 are deprecated and removed. Do not use this space */
101#define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */ 103#define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */
102#define SCTP_GET_PEER_ADDRS 108 /* Get all peer addresss. */ 104#define SCTP_GET_PEER_ADDRS 108 /* Get all peer address. */
103#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local addresss. */ 105#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */
104#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */ 106#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */
105#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ 107#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */
106 108
@@ -352,6 +354,20 @@ struct sctp_authkey_event {
352 354
353enum { SCTP_AUTH_NEWKEY = 0, }; 355enum { SCTP_AUTH_NEWKEY = 0, };
354 356
357/*
358 * 6.1.9. SCTP_SENDER_DRY_EVENT
359 *
360 * When the SCTP stack has no more user data to send or retransmit, this
361 * notification is given to the user. Also, at the time when a user app
362 * subscribes to this event, if there is no data to be sent or
363 * retransmit, the stack will immediately send up this notification.
364 */
365struct sctp_sender_dry_event {
366 __u16 sender_dry_type;
367 __u16 sender_dry_flags;
368 __u32 sender_dry_length;
369 sctp_assoc_t sender_dry_assoc_id;
370};
355 371
356/* 372/*
357 * Described in Section 7.3 373 * Described in Section 7.3
@@ -367,6 +383,7 @@ struct sctp_event_subscribe {
367 __u8 sctp_partial_delivery_event; 383 __u8 sctp_partial_delivery_event;
368 __u8 sctp_adaptation_layer_event; 384 __u8 sctp_adaptation_layer_event;
369 __u8 sctp_authentication_event; 385 __u8 sctp_authentication_event;
386 __u8 sctp_sender_dry_event;
370}; 387};
371 388
372/* 389/*
@@ -390,6 +407,7 @@ union sctp_notification {
390 struct sctp_adaptation_event sn_adaptation_event; 407 struct sctp_adaptation_event sn_adaptation_event;
391 struct sctp_pdapi_event sn_pdapi_event; 408 struct sctp_pdapi_event sn_pdapi_event;
392 struct sctp_authkey_event sn_authkey_event; 409 struct sctp_authkey_event sn_authkey_event;
410 struct sctp_sender_dry_event sn_sender_dry_event;
393}; 411};
394 412
395/* Section 5.3.1 413/* Section 5.3.1
@@ -406,7 +424,9 @@ enum sctp_sn_type {
406 SCTP_SHUTDOWN_EVENT, 424 SCTP_SHUTDOWN_EVENT,
407 SCTP_PARTIAL_DELIVERY_EVENT, 425 SCTP_PARTIAL_DELIVERY_EVENT,
408 SCTP_ADAPTATION_INDICATION, 426 SCTP_ADAPTATION_INDICATION,
409 SCTP_AUTHENTICATION_INDICATION, 427 SCTP_AUTHENTICATION_EVENT,
428#define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT
429 SCTP_SENDER_DRY_EVENT,
410}; 430};
411 431
412/* Notification error codes used to fill up the error fields in some 432/* Notification error codes used to fill up the error fields in some
@@ -668,6 +688,18 @@ struct sctp_authchunks {
668}; 688};
669 689
670/* 690/*
691 * 8.2.6. Get the Current Identifiers of Associations
692 * (SCTP_GET_ASSOC_ID_LIST)
693 *
694 * This option gets the current list of SCTP association identifiers of
695 * the SCTP associations handled by a one-to-many style socket.
696 */
697struct sctp_assoc_ids {
698 __u32 gaids_number_of_ids;
699 sctp_assoc_t gaids_assoc_id[];
700};
701
702/*
671 * 8.3, 8.5 get all peer/local addresses in an association. 703 * 8.3, 8.5 get all peer/local addresses in an association.
672 * This parameter struct is used by SCTP_GET_PEER_ADDRS and 704 * This parameter struct is used by SCTP_GET_PEER_ADDRS and
673 * SCTP_GET_LOCAL_ADDRS socket options used internally to implement 705 * SCTP_GET_LOCAL_ADDRS socket options used internally to implement