aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFrank Filz <ffilzlnx@us.ibm.com>2005-06-20 16:14:57 -0400
committerDavid S. Miller <davem@davemloft.net>2005-06-20 16:14:57 -0400
commit3f7a87d2fa9b42f7aade43914f060df68cc89cc7 (patch)
tree15162d2dd770428f98a0d39f8dc6063aba0ad1e6 /include
parent8b22c249e7de453961e4d253b19fc2a0bdd65d53 (diff)
[SCTP] sctp_connectx() API support
Implements sctp_connectx() as defined in the SCTP sockets API draft by tunneling the request through a setsockopt(). Signed-off-by: Frank Filz <ffilzlnx@us.ibm.com> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/sctp/command.h8
-rw-r--r--include/net/sctp/constants.h7
-rw-r--r--include/net/sctp/sctp.h17
-rw-r--r--include/net/sctp/sm.h8
-rw-r--r--include/net/sctp/structs.h41
-rw-r--r--include/net/sctp/user.h3
6 files changed, 62 insertions, 22 deletions
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index ebc5282e6d58..dc107ffad483 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -65,9 +65,11 @@ typedef enum {
65 SCTP_CMD_TIMER_START, /* Start a timer. */ 65 SCTP_CMD_TIMER_START, /* Start a timer. */
66 SCTP_CMD_TIMER_RESTART, /* Restart a timer. */ 66 SCTP_CMD_TIMER_RESTART, /* Restart a timer. */
67 SCTP_CMD_TIMER_STOP, /* Stop a timer. */ 67 SCTP_CMD_TIMER_STOP, /* Stop a timer. */
68 SCTP_CMD_COUNTER_RESET, /* Reset a counter. */ 68 SCTP_CMD_INIT_CHOOSE_TRANSPORT, /* Choose transport for an INIT. */
69 SCTP_CMD_COUNTER_INC, /* Increment a counter. */ 69 SCTP_CMD_INIT_COUNTER_RESET, /* Reset init counter. */
70 SCTP_CMD_INIT_COUNTER_INC, /* Increment init counter. */
70 SCTP_CMD_INIT_RESTART, /* High level, do init timer work. */ 71 SCTP_CMD_INIT_RESTART, /* High level, do init timer work. */
72 SCTP_CMD_COOKIEECHO_RESTART, /* High level, do cookie-echo timer work. */
71 SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */ 73 SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */
72 SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */ 74 SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */
73 SCTP_CMD_STRIKE, /* Mark a strike against a transport. */ 75 SCTP_CMD_STRIKE, /* Mark a strike against a transport. */
@@ -118,7 +120,6 @@ typedef union {
118 int error; 120 int error;
119 sctp_state_t state; 121 sctp_state_t state;
120 sctp_event_timeout_t to; 122 sctp_event_timeout_t to;
121 sctp_counter_t counter;
122 void *ptr; 123 void *ptr;
123 struct sctp_chunk *chunk; 124 struct sctp_chunk *chunk;
124 struct sctp_association *asoc; 125 struct sctp_association *asoc;
@@ -165,7 +166,6 @@ SCTP_ARG_CONSTRUCTOR(U16, __u16, u16)
165SCTP_ARG_CONSTRUCTOR(U8, __u8, u8) 166SCTP_ARG_CONSTRUCTOR(U8, __u8, u8)
166SCTP_ARG_CONSTRUCTOR(ERROR, int, error) 167SCTP_ARG_CONSTRUCTOR(ERROR, int, error)
167SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state) 168SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state)
168SCTP_ARG_CONSTRUCTOR(COUNTER, sctp_counter_t, counter)
169SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) 169SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to)
170SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr) 170SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr)
171SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk) 171SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk)
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 2b76c0f4babc..4868c7f7749d 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -263,13 +263,6 @@ enum { SCTP_MIN_PMTU = 576 };
263enum { SCTP_MAX_DUP_TSNS = 16 }; 263enum { SCTP_MAX_DUP_TSNS = 16 };
264enum { SCTP_MAX_GABS = 16 }; 264enum { SCTP_MAX_GABS = 16 };
265 265
266typedef enum {
267 SCTP_COUNTER_INIT_ERROR,
268} sctp_counter_t;
269
270/* How many counters does an association need? */
271#define SCTP_NUMBER_COUNTERS 5
272
273/* Here we define the default timers. */ 266/* Here we define the default timers. */
274 267
275/* cookie timer def = ? seconds */ 268/* cookie timer def = ? seconds */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 960abfa48d68..ef2738159ab3 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -223,6 +223,22 @@ DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics);
223extern int sctp_debug_flag; 223extern int sctp_debug_flag;
224#define SCTP_DEBUG_PRINTK(whatever...) \ 224#define SCTP_DEBUG_PRINTK(whatever...) \
225 ((void) (sctp_debug_flag && printk(KERN_DEBUG whatever))) 225 ((void) (sctp_debug_flag && printk(KERN_DEBUG whatever)))
226#define SCTP_DEBUG_PRINTK_IPADDR(lead, trail, leadparm, saddr, otherparms...) \
227 if (sctp_debug_flag) { \
228 if (saddr->sa.sa_family == AF_INET6) { \
229 printk(KERN_DEBUG \
230 lead "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x" trail, \
231 leadparm, \
232 NIP6(saddr->v6.sin6_addr), \
233 otherparms); \
234 } else { \
235 printk(KERN_DEBUG \
236 lead "%u.%u.%u.%u" trail, \
237 leadparm, \
238 NIPQUAD(saddr->v4.sin_addr.s_addr), \
239 otherparms); \
240 } \
241 }
226#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } 242#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; }
227#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } 243#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; }
228 244
@@ -236,6 +252,7 @@ extern int sctp_debug_flag;
236#else /* SCTP_DEBUG */ 252#else /* SCTP_DEBUG */
237 253
238#define SCTP_DEBUG_PRINTK(whatever...) 254#define SCTP_DEBUG_PRINTK(whatever...)
255#define SCTP_DEBUG_PRINTK_IPADDR(whatever...)
239#define SCTP_ENABLE_DEBUG 256#define SCTP_ENABLE_DEBUG
240#define SCTP_DISABLE_DEBUG 257#define SCTP_DISABLE_DEBUG
241#define SCTP_ASSERT(expr, str, func) 258#define SCTP_ASSERT(expr, str, func)
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index f4fcee104707..a53e08a45e32 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -116,7 +116,8 @@ sctp_state_fn_t sctp_sf_eat_data_fast_4_4;
116sctp_state_fn_t sctp_sf_eat_sack_6_2; 116sctp_state_fn_t sctp_sf_eat_sack_6_2;
117sctp_state_fn_t sctp_sf_tabort_8_4_8; 117sctp_state_fn_t sctp_sf_tabort_8_4_8;
118sctp_state_fn_t sctp_sf_operr_notify; 118sctp_state_fn_t sctp_sf_operr_notify;
119sctp_state_fn_t sctp_sf_t1_timer_expire; 119sctp_state_fn_t sctp_sf_t1_init_timer_expire;
120sctp_state_fn_t sctp_sf_t1_cookie_timer_expire;
120sctp_state_fn_t sctp_sf_t2_timer_expire; 121sctp_state_fn_t sctp_sf_t2_timer_expire;
121sctp_state_fn_t sctp_sf_t4_timer_expire; 122sctp_state_fn_t sctp_sf_t4_timer_expire;
122sctp_state_fn_t sctp_sf_t5_timer_expire; 123sctp_state_fn_t sctp_sf_t5_timer_expire;
@@ -258,7 +259,10 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc,
258void sctp_chunk_assign_tsn(struct sctp_chunk *); 259void sctp_chunk_assign_tsn(struct sctp_chunk *);
259void sctp_chunk_assign_ssn(struct sctp_chunk *); 260void sctp_chunk_assign_ssn(struct sctp_chunk *);
260 261
261void sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands, __u16 error); 262sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands,
263 __u16 error,
264 const struct sctp_association *asoc,
265 struct sctp_transport *transport);
262 266
263/* Prototypes for statetable processing. */ 267/* Prototypes for statetable processing. */
264 268
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 6c24d9cd3d66..dfad4d3c581c 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -867,10 +867,13 @@ struct sctp_transport {
867 */ 867 */
868 unsigned long last_time_ecne_reduced; 868 unsigned long last_time_ecne_reduced;
869 869
870 /* active : The current active state of this destination, 870 /* The number of times INIT has been sent on this transport. */
871 * : i.e. DOWN, UP, etc. 871 int init_sent_count;
872
873 /* state : The current state of this destination,
874 * : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKOWN.
872 */ 875 */
873 int active; 876 int state;
874 877
875 /* hb_allowed : The current heartbeat state of this destination, 878 /* hb_allowed : The current heartbeat state of this destination,
876 * : i.e. ALLOW-HB, NO-HEARTBEAT, etc. 879 * : i.e. ALLOW-HB, NO-HEARTBEAT, etc.
@@ -1222,9 +1225,6 @@ struct sctp_endpoint {
1222 1225
1223 /* sendbuf acct. policy. */ 1226 /* sendbuf acct. policy. */
1224 __u32 sndbuf_policy; 1227 __u32 sndbuf_policy;
1225
1226 /* Name for debugging output... */
1227 char *debug_name;
1228}; 1228};
1229 1229
1230/* Recover the outter endpoint structure. */ 1230/* Recover the outter endpoint structure. */
@@ -1314,11 +1314,23 @@ struct sctp_association {
1314 * : association. Normally this information is 1314 * : association. Normally this information is
1315 * : hashed or keyed for quick lookup and access 1315 * : hashed or keyed for quick lookup and access
1316 * : of the TCB. 1316 * : of the TCB.
1317 * : The list is also initialized with the list
1318 * : of addresses passed with the sctp_connectx()
1319 * : call.
1317 * 1320 *
1318 * It is a list of SCTP_transport's. 1321 * It is a list of SCTP_transport's.
1319 */ 1322 */
1320 struct list_head transport_addr_list; 1323 struct list_head transport_addr_list;
1321 1324
1325 /* transport_count
1326 *
1327 * Peer : A count of the number of peer addresses
1328 * Transport : in the Peer Transport Address List.
1329 * Address :
1330 * Count :
1331 */
1332 __u16 transport_count;
1333
1322 /* port 1334 /* port
1323 * The transport layer port number. 1335 * The transport layer port number.
1324 */ 1336 */
@@ -1486,6 +1498,9 @@ struct sctp_association {
1486 /* Transport to which SHUTDOWN chunk was last sent. */ 1498 /* Transport to which SHUTDOWN chunk was last sent. */
1487 struct sctp_transport *shutdown_last_sent_to; 1499 struct sctp_transport *shutdown_last_sent_to;
1488 1500
1501 /* Transport to which INIT chunk was last sent. */
1502 struct sctp_transport *init_last_sent_to;
1503
1489 /* Next TSN : The next TSN number to be assigned to a new 1504 /* Next TSN : The next TSN number to be assigned to a new
1490 * : DATA chunk. This is sent in the INIT or INIT 1505 * : DATA chunk. This is sent in the INIT or INIT
1491 * : ACK chunk to the peer and incremented each 1506 * : ACK chunk to the peer and incremented each
@@ -1549,8 +1564,11 @@ struct sctp_association {
1549 /* The message size at which SCTP fragmentation will occur. */ 1564 /* The message size at which SCTP fragmentation will occur. */
1550 __u32 frag_point; 1565 __u32 frag_point;
1551 1566
1552 /* Currently only one counter is used to count INIT errors. */ 1567 /* Counter used to count INIT errors. */
1553 int counters[SCTP_NUMBER_COUNTERS]; 1568 int init_err_counter;
1569
1570 /* Count the number of INIT cycles (for doubling timeout). */
1571 int init_cycle;
1554 1572
1555 /* Default send parameters. */ 1573 /* Default send parameters. */
1556 __u16 default_stream; 1574 __u16 default_stream;
@@ -1708,6 +1726,8 @@ void sctp_association_free(struct sctp_association *);
1708void sctp_association_put(struct sctp_association *); 1726void sctp_association_put(struct sctp_association *);
1709void sctp_association_hold(struct sctp_association *); 1727void sctp_association_hold(struct sctp_association *);
1710 1728
1729struct sctp_transport *sctp_assoc_choose_init_transport(
1730 struct sctp_association *);
1711struct sctp_transport *sctp_assoc_choose_shutdown_transport( 1731struct sctp_transport *sctp_assoc_choose_shutdown_transport(
1712 struct sctp_association *); 1732 struct sctp_association *);
1713void sctp_assoc_update_retran_path(struct sctp_association *); 1733void sctp_assoc_update_retran_path(struct sctp_association *);
@@ -1717,9 +1737,12 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
1717 const union sctp_addr *laddr); 1737 const union sctp_addr *laddr);
1718struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *, 1738struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *,
1719 const union sctp_addr *address, 1739 const union sctp_addr *address,
1720 const int gfp); 1740 const int gfp,
1741 const int peer_state);
1721void sctp_assoc_del_peer(struct sctp_association *asoc, 1742void sctp_assoc_del_peer(struct sctp_association *asoc,
1722 const union sctp_addr *addr); 1743 const union sctp_addr *addr);
1744void sctp_assoc_rm_peer(struct sctp_association *asoc,
1745 struct sctp_transport *peer);
1723void sctp_assoc_control_transport(struct sctp_association *, 1746void sctp_assoc_control_transport(struct sctp_association *,
1724 struct sctp_transport *, 1747 struct sctp_transport *,
1725 sctp_transport_cmd_t, sctp_sn_error_t); 1748 sctp_transport_cmd_t, sctp_sn_error_t);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 2758e8ce4f25..f6328aeddcce 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -111,6 +111,8 @@ enum sctp_optname {
111#define SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS_NUM 111#define SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS_NUM
112 SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ 112 SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */
113#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS 113#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS
114 SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */
115#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX
114}; 116};
115 117
116/* 118/*
@@ -527,6 +529,7 @@ struct sctp_paddrinfo {
527enum sctp_spinfo_state { 529enum sctp_spinfo_state {
528 SCTP_INACTIVE, 530 SCTP_INACTIVE,
529 SCTP_ACTIVE, 531 SCTP_ACTIVE,
532 SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */
530}; 533};
531 534
532/* 535/*