1 /* SCTP kernel implementation
2 * (C) Copyright IBM Corp. 2001, 2004
3 * Copyright (c) 1999-2000 Cisco, Inc.
4 * Copyright (c) 1999-2001 Motorola, Inc.
5 * Copyright (c) 2001 Intel Corp.
6 * Copyright (c) 2001 Nokia, Inc.
8 * This file is part of the SCTP kernel implementation
10 * These are the state tables for the SCTP state machine.
12 * This SCTP implementation is free software;
13 * you can redistribute it and/or modify it under the terms of
14 * the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
18 * This SCTP implementation is distributed in the hope that it
19 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
20 * ************************
21 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 * See the GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with GNU CC; see the file COPYING. If not, write to
26 * the Free Software Foundation, 59 Temple Place - Suite 330,
27 * Boston, MA 02111-1307, USA.
29 * Please send any bug reports or fixes you make to the
31 * lksctp developers <lksctp-developers@lists.sourceforge.net>
33 * Or submit a bug report through the following website:
34 * http://www.sf.net/projects/lksctp
36 * Written or modified by:
37 * La Monte H.P. Yarroll <piggy@acm.org>
38 * Karl Knutson <karl@athena.chicago.il.us>
39 * Jon Grimm <jgrimm@us.ibm.com>
40 * Hui Huang <hui.huang@nokia.com>
41 * Daisy Chang <daisyc@us.ibm.com>
42 * Ardelle Fan <ardelle.fan@intel.com>
43 * Sridhar Samudrala <sri@us.ibm.com>
45 * Any bugs reported given to us we will try to fix... any fixes shared will
46 * be incorporated into the next SCTP release.
49 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
51 #include <linux/skbuff.h>
52 #include <net/sctp/sctp.h>
53 #include <net/sctp/sm.h>
55 static const sctp_sm_table_entry_t
56 primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES];
57 static const sctp_sm_table_entry_t
58 other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES];
59 static const sctp_sm_table_entry_t
60 timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES];
62 static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
67 static const sctp_sm_table_entry_t bug = {
72 #define DO_LOOKUP(_max, _type, _table) \
74 const sctp_sm_table_entry_t *rtn; \
76 if ((event_subtype._type > (_max))) { \
77 pr_warn("table %p possible attack: event %d exceeds max %d\n", \
78 _table, event_subtype._type, _max); \
81 rtn = &_table[event_subtype._type][(int)state]; \
86 const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *net,
87 sctp_event_t event_type,
89 sctp_subtype_t event_subtype)
92 case SCTP_EVENT_T_CHUNK:
93 return sctp_chunk_event_lookup(net, event_subtype.chunk, state);
94 case SCTP_EVENT_T_TIMEOUT:
95 return DO_LOOKUP(SCTP_EVENT_TIMEOUT_MAX, timeout,
97 case SCTP_EVENT_T_OTHER:
98 return DO_LOOKUP(SCTP_EVENT_OTHER_MAX, other,
100 case SCTP_EVENT_T_PRIMITIVE:
101 return DO_LOOKUP(SCTP_EVENT_PRIMITIVE_MAX, primitive,
102 primitive_event_table);
104 /* Yikes! We got an illegal event type. */
109 #define TYPE_SCTP_FUNC(func) {.fn = func, .name = #func}
111 #define TYPE_SCTP_DATA { \
112 /* SCTP_STATE_CLOSED */ \
113 TYPE_SCTP_FUNC(sctp_sf_ootb), \
114 /* SCTP_STATE_COOKIE_WAIT */ \
115 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
116 /* SCTP_STATE_COOKIE_ECHOED */ \
117 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
118 /* SCTP_STATE_ESTABLISHED */ \
119 TYPE_SCTP_FUNC(sctp_sf_eat_data_6_2), \
120 /* SCTP_STATE_SHUTDOWN_PENDING */ \
121 TYPE_SCTP_FUNC(sctp_sf_eat_data_6_2), \
122 /* SCTP_STATE_SHUTDOWN_SENT */ \
123 TYPE_SCTP_FUNC(sctp_sf_eat_data_fast_4_4), \
124 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
125 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
126 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
127 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
128 } /* TYPE_SCTP_DATA */
130 #define TYPE_SCTP_INIT { \
131 /* SCTP_STATE_CLOSED */ \
132 TYPE_SCTP_FUNC(sctp_sf_do_5_1B_init), \
133 /* SCTP_STATE_COOKIE_WAIT */ \
134 TYPE_SCTP_FUNC(sctp_sf_do_5_2_1_siminit), \
135 /* SCTP_STATE_COOKIE_ECHOED */ \
136 TYPE_SCTP_FUNC(sctp_sf_do_5_2_1_siminit), \
137 /* SCTP_STATE_ESTABLISHED */ \
138 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
139 /* SCTP_STATE_SHUTDOWN_PENDING */ \
140 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
141 /* SCTP_STATE_SHUTDOWN_SENT */ \
142 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
143 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
144 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
145 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
146 TYPE_SCTP_FUNC(sctp_sf_do_9_2_reshutack), \
147 } /* TYPE_SCTP_INIT */
149 #define TYPE_SCTP_INIT_ACK { \
150 /* SCTP_STATE_CLOSED */ \
151 TYPE_SCTP_FUNC(sctp_sf_do_5_2_3_initack), \
152 /* SCTP_STATE_COOKIE_WAIT */ \
153 TYPE_SCTP_FUNC(sctp_sf_do_5_1C_ack), \
154 /* SCTP_STATE_COOKIE_ECHOED */ \
155 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
156 /* SCTP_STATE_ESTABLISHED */ \
157 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
158 /* SCTP_STATE_SHUTDOWN_PENDING */ \
159 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
160 /* SCTP_STATE_SHUTDOWN_SENT */ \
161 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
162 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
163 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
164 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
165 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
166 } /* TYPE_SCTP_INIT_ACK */
168 #define TYPE_SCTP_SACK { \
169 /* SCTP_STATE_CLOSED */ \
170 TYPE_SCTP_FUNC(sctp_sf_ootb), \
171 /* SCTP_STATE_COOKIE_WAIT */ \
172 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
173 /* SCTP_STATE_COOKIE_ECHOED */ \
174 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
175 /* SCTP_STATE_ESTABLISHED */ \
176 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
177 /* SCTP_STATE_SHUTDOWN_PENDING */ \
178 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
179 /* SCTP_STATE_SHUTDOWN_SENT */ \
180 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
181 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
182 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
183 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
184 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
185 } /* TYPE_SCTP_SACK */
187 #define TYPE_SCTP_HEARTBEAT { \
188 /* SCTP_STATE_CLOSED */ \
189 TYPE_SCTP_FUNC(sctp_sf_ootb), \
190 /* SCTP_STATE_COOKIE_WAIT */ \
191 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
192 /* SCTP_STATE_COOKIE_ECHOED */ \
193 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
194 /* SCTP_STATE_ESTABLISHED */ \
195 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
196 /* SCTP_STATE_SHUTDOWN_PENDING */ \
197 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
198 /* SCTP_STATE_SHUTDOWN_SENT */ \
199 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
200 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
201 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
202 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
203 /* This should not happen, but we are nice. */ \
204 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
205 } /* TYPE_SCTP_HEARTBEAT */
207 #define TYPE_SCTP_HEARTBEAT_ACK { \
208 /* SCTP_STATE_CLOSED */ \
209 TYPE_SCTP_FUNC(sctp_sf_ootb), \
210 /* SCTP_STATE_COOKIE_WAIT */ \
211 TYPE_SCTP_FUNC(sctp_sf_violation), \
212 /* SCTP_STATE_COOKIE_ECHOED */ \
213 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
214 /* SCTP_STATE_ESTABLISHED */ \
215 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
216 /* SCTP_STATE_SHUTDOWN_PENDING */ \
217 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
218 /* SCTP_STATE_SHUTDOWN_SENT */ \
219 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
220 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
221 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
222 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
223 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
224 } /* TYPE_SCTP_HEARTBEAT_ACK */
226 #define TYPE_SCTP_ABORT { \
227 /* SCTP_STATE_CLOSED */ \
228 TYPE_SCTP_FUNC(sctp_sf_pdiscard), \
229 /* SCTP_STATE_COOKIE_WAIT */ \
230 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_abort), \
231 /* SCTP_STATE_COOKIE_ECHOED */ \
232 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_abort), \
233 /* SCTP_STATE_ESTABLISHED */ \
234 TYPE_SCTP_FUNC(sctp_sf_do_9_1_abort), \
235 /* SCTP_STATE_SHUTDOWN_PENDING */ \
236 TYPE_SCTP_FUNC(sctp_sf_shutdown_pending_abort), \
237 /* SCTP_STATE_SHUTDOWN_SENT */ \
238 TYPE_SCTP_FUNC(sctp_sf_shutdown_sent_abort), \
239 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
240 TYPE_SCTP_FUNC(sctp_sf_do_9_1_abort), \
241 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
242 TYPE_SCTP_FUNC(sctp_sf_shutdown_ack_sent_abort), \
243 } /* TYPE_SCTP_ABORT */
245 #define TYPE_SCTP_SHUTDOWN { \
246 /* SCTP_STATE_CLOSED */ \
247 TYPE_SCTP_FUNC(sctp_sf_ootb), \
248 /* SCTP_STATE_COOKIE_WAIT */ \
249 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
250 /* SCTP_STATE_COOKIE_ECHOED */ \
251 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
252 /* SCTP_STATE_ESTABLISHED */ \
253 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown), \
254 /* SCTP_STATE_SHUTDOWN_PENDING */ \
255 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown), \
256 /* SCTP_STATE_SHUTDOWN_SENT */ \
257 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown_ack), \
258 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
259 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shut_ctsn), \
260 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
261 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
262 } /* TYPE_SCTP_SHUTDOWN */
264 #define TYPE_SCTP_SHUTDOWN_ACK { \
265 /* SCTP_STATE_CLOSED */ \
266 TYPE_SCTP_FUNC(sctp_sf_ootb), \
267 /* SCTP_STATE_COOKIE_WAIT */ \
268 TYPE_SCTP_FUNC(sctp_sf_do_8_5_1_E_sa), \
269 /* SCTP_STATE_COOKIE_ECHOED */ \
270 TYPE_SCTP_FUNC(sctp_sf_do_8_5_1_E_sa), \
271 /* SCTP_STATE_ESTABLISHED */ \
272 TYPE_SCTP_FUNC(sctp_sf_violation), \
273 /* SCTP_STATE_SHUTDOWN_PENDING */ \
274 TYPE_SCTP_FUNC(sctp_sf_violation), \
275 /* SCTP_STATE_SHUTDOWN_SENT */ \
276 TYPE_SCTP_FUNC(sctp_sf_do_9_2_final), \
277 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
278 TYPE_SCTP_FUNC(sctp_sf_violation), \
279 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
280 TYPE_SCTP_FUNC(sctp_sf_do_9_2_final), \
281 } /* TYPE_SCTP_SHUTDOWN_ACK */
283 #define TYPE_SCTP_ERROR { \
284 /* SCTP_STATE_CLOSED */ \
285 TYPE_SCTP_FUNC(sctp_sf_ootb), \
286 /* SCTP_STATE_COOKIE_WAIT */ \
287 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
288 /* SCTP_STATE_COOKIE_ECHOED */ \
289 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_err), \
290 /* SCTP_STATE_ESTABLISHED */ \
291 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
292 /* SCTP_STATE_SHUTDOWN_PENDING */ \
293 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
294 /* SCTP_STATE_SHUTDOWN_SENT */ \
295 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
296 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
297 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
298 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
299 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
300 } /* TYPE_SCTP_ERROR */
302 #define TYPE_SCTP_COOKIE_ECHO { \
303 /* SCTP_STATE_CLOSED */ \
304 TYPE_SCTP_FUNC(sctp_sf_do_5_1D_ce), \
305 /* SCTP_STATE_COOKIE_WAIT */ \
306 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
307 /* SCTP_STATE_COOKIE_ECHOED */ \
308 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
309 /* SCTP_STATE_ESTABLISHED */ \
310 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
311 /* SCTP_STATE_SHUTDOWN_PENDING */ \
312 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
313 /* SCTP_STATE_SHUTDOWN_SENT */ \
314 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
315 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
316 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
317 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
318 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
319 } /* TYPE_SCTP_COOKIE_ECHO */
321 #define TYPE_SCTP_COOKIE_ACK { \
322 /* SCTP_STATE_CLOSED */ \
323 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
324 /* SCTP_STATE_COOKIE_WAIT */ \
325 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
326 /* SCTP_STATE_COOKIE_ECHOED */ \
327 TYPE_SCTP_FUNC(sctp_sf_do_5_1E_ca), \
328 /* SCTP_STATE_ESTABLISHED */ \
329 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
330 /* SCTP_STATE_SHUTDOWN_PENDING */ \
331 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
332 /* SCTP_STATE_SHUTDOWN_SENT */ \
333 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
334 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
335 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
336 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
337 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
338 } /* TYPE_SCTP_COOKIE_ACK */
340 #define TYPE_SCTP_ECN_ECNE { \
341 /* SCTP_STATE_CLOSED */ \
342 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
343 /* SCTP_STATE_COOKIE_WAIT */ \
344 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
345 /* SCTP_STATE_COOKIE_ECHOED */ \
346 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
347 /* SCTP_STATE_ESTABLISHED */ \
348 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
349 /* SCTP_STATE_SHUTDOWN_PENDING */ \
350 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
351 /* SCTP_STATE_SHUTDOWN_SENT */ \
352 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
353 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
354 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
355 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
356 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
357 } /* TYPE_SCTP_ECN_ECNE */
359 #define TYPE_SCTP_ECN_CWR { \
360 /* SCTP_STATE_CLOSED */ \
361 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
362 /* SCTP_STATE_COOKIE_WAIT */ \
363 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
364 /* SCTP_STATE_COOKIE_ECHOED */ \
365 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
366 /* SCTP_STATE_ESTABLISHED */ \
367 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
368 /* SCTP_STATE_SHUTDOWN_PENDING */ \
369 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
370 /* SCTP_STATE_SHUTDOWN_SENT */ \
371 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
372 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
373 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
374 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
375 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
376 } /* TYPE_SCTP_ECN_CWR */
378 #define TYPE_SCTP_SHUTDOWN_COMPLETE { \
379 /* SCTP_STATE_CLOSED */ \
380 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
381 /* SCTP_STATE_COOKIE_WAIT */ \
382 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
383 /* SCTP_STATE_COOKIE_ECHOED */ \
384 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
385 /* SCTP_STATE_ESTABLISHED */ \
386 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
387 /* SCTP_STATE_SHUTDOWN_PENDING */ \
388 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
389 /* SCTP_STATE_SHUTDOWN_SENT */ \
390 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
391 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
392 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
393 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
394 TYPE_SCTP_FUNC(sctp_sf_do_4_C), \
395 } /* TYPE_SCTP_SHUTDOWN_COMPLETE */
397 /* The primary index for this table is the chunk type.
398 * The secondary index for this table is the state.
400 * For base protocol (RFC 2960).
402 static const sctp_sm_table_entry_t chunk_event_table[SCTP_NUM_BASE_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
408 TYPE_SCTP_HEARTBEAT_ACK,
411 TYPE_SCTP_SHUTDOWN_ACK,
413 TYPE_SCTP_COOKIE_ECHO,
414 TYPE_SCTP_COOKIE_ACK,
417 TYPE_SCTP_SHUTDOWN_COMPLETE,
418 }; /* state_fn_t chunk_event_table[][] */
420 #define TYPE_SCTP_ASCONF { \
421 /* SCTP_STATE_CLOSED */ \
422 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
423 /* SCTP_STATE_COOKIE_WAIT */ \
424 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
425 /* SCTP_STATE_COOKIE_ECHOED */ \
426 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
427 /* SCTP_STATE_ESTABLISHED */ \
428 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
429 /* SCTP_STATE_SHUTDOWN_PENDING */ \
430 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
431 /* SCTP_STATE_SHUTDOWN_SENT */ \
432 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
433 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
434 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
435 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
436 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
437 } /* TYPE_SCTP_ASCONF */
439 #define TYPE_SCTP_ASCONF_ACK { \
440 /* SCTP_STATE_CLOSED */ \
441 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
442 /* SCTP_STATE_COOKIE_WAIT */ \
443 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
444 /* SCTP_STATE_COOKIE_ECHOED */ \
445 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
446 /* SCTP_STATE_ESTABLISHED */ \
447 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
448 /* SCTP_STATE_SHUTDOWN_PENDING */ \
449 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
450 /* SCTP_STATE_SHUTDOWN_SENT */ \
451 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
452 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
453 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
454 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
455 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
456 } /* TYPE_SCTP_ASCONF_ACK */
458 /* The primary index for this table is the chunk type.
459 * The secondary index for this table is the state.
461 static const sctp_sm_table_entry_t addip_chunk_event_table[SCTP_NUM_ADDIP_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
463 TYPE_SCTP_ASCONF_ACK,
464 }; /*state_fn_t addip_chunk_event_table[][] */
466 #define TYPE_SCTP_FWD_TSN { \
467 /* SCTP_STATE_CLOSED */ \
468 TYPE_SCTP_FUNC(sctp_sf_ootb), \
469 /* SCTP_STATE_COOKIE_WAIT */ \
470 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
471 /* SCTP_STATE_COOKIE_ECHOED */ \
472 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
473 /* SCTP_STATE_ESTABLISHED */ \
474 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn), \
475 /* SCTP_STATE_SHUTDOWN_PENDING */ \
476 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn), \
477 /* SCTP_STATE_SHUTDOWN_SENT */ \
478 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn_fast), \
479 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
480 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
481 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
482 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
483 } /* TYPE_SCTP_FWD_TSN */
485 /* The primary index for this table is the chunk type.
486 * The secondary index for this table is the state.
488 static const sctp_sm_table_entry_t prsctp_chunk_event_table[SCTP_NUM_PRSCTP_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
490 }; /*state_fn_t prsctp_chunk_event_table[][] */
492 #define TYPE_SCTP_AUTH { \
493 /* SCTP_STATE_CLOSED */ \
494 TYPE_SCTP_FUNC(sctp_sf_ootb), \
495 /* SCTP_STATE_COOKIE_WAIT */ \
496 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
497 /* SCTP_STATE_COOKIE_ECHOED */ \
498 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
499 /* SCTP_STATE_ESTABLISHED */ \
500 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
501 /* SCTP_STATE_SHUTDOWN_PENDING */ \
502 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
503 /* SCTP_STATE_SHUTDOWN_SENT */ \
504 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
505 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
506 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
507 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
508 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
509 } /* TYPE_SCTP_AUTH */
511 /* The primary index for this table is the chunk type.
512 * The secondary index for this table is the state.
514 static const sctp_sm_table_entry_t auth_chunk_event_table[SCTP_NUM_AUTH_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
516 }; /*state_fn_t auth_chunk_event_table[][] */
518 static const sctp_sm_table_entry_t
519 chunk_event_table_unknown[SCTP_STATE_NUM_STATES] = {
520 /* SCTP_STATE_CLOSED */
521 TYPE_SCTP_FUNC(sctp_sf_ootb),
522 /* SCTP_STATE_COOKIE_WAIT */
523 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
524 /* SCTP_STATE_COOKIE_ECHOED */
525 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
526 /* SCTP_STATE_ESTABLISHED */
527 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
528 /* SCTP_STATE_SHUTDOWN_PENDING */
529 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
530 /* SCTP_STATE_SHUTDOWN_SENT */
531 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
532 /* SCTP_STATE_SHUTDOWN_RECEIVED */
533 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
534 /* SCTP_STATE_SHUTDOWN_ACK_SENT */
535 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
536 }; /* chunk unknown */
539 #define TYPE_SCTP_PRIMITIVE_ASSOCIATE { \
540 /* SCTP_STATE_CLOSED */ \
541 TYPE_SCTP_FUNC(sctp_sf_do_prm_asoc), \
542 /* SCTP_STATE_COOKIE_WAIT */ \
543 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
544 /* SCTP_STATE_COOKIE_ECHOED */ \
545 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
546 /* SCTP_STATE_ESTABLISHED */ \
547 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
548 /* SCTP_STATE_SHUTDOWN_PENDING */ \
549 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
550 /* SCTP_STATE_SHUTDOWN_SENT */ \
551 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
552 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
553 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
554 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
555 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
556 } /* TYPE_SCTP_PRIMITIVE_ASSOCIATE */
558 #define TYPE_SCTP_PRIMITIVE_SHUTDOWN { \
559 /* SCTP_STATE_CLOSED */ \
560 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
561 /* SCTP_STATE_COOKIE_WAIT */ \
562 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_prm_shutdown), \
563 /* SCTP_STATE_COOKIE_ECHOED */ \
564 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_prm_shutdown),\
565 /* SCTP_STATE_ESTABLISHED */ \
566 TYPE_SCTP_FUNC(sctp_sf_do_9_2_prm_shutdown), \
567 /* SCTP_STATE_SHUTDOWN_PENDING */ \
568 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
569 /* SCTP_STATE_SHUTDOWN_SENT */ \
570 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
571 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
572 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
573 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
574 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
575 } /* TYPE_SCTP_PRIMITIVE_SHUTDOWN */
577 #define TYPE_SCTP_PRIMITIVE_ABORT { \
578 /* SCTP_STATE_CLOSED */ \
579 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
580 /* SCTP_STATE_COOKIE_WAIT */ \
581 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_prm_abort), \
582 /* SCTP_STATE_COOKIE_ECHOED */ \
583 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_prm_abort), \
584 /* SCTP_STATE_ESTABLISHED */ \
585 TYPE_SCTP_FUNC(sctp_sf_do_9_1_prm_abort), \
586 /* SCTP_STATE_SHUTDOWN_PENDING */ \
587 TYPE_SCTP_FUNC(sctp_sf_shutdown_pending_prm_abort), \
588 /* SCTP_STATE_SHUTDOWN_SENT */ \
589 TYPE_SCTP_FUNC(sctp_sf_shutdown_sent_prm_abort), \
590 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
591 TYPE_SCTP_FUNC(sctp_sf_do_9_1_prm_abort), \
592 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
593 TYPE_SCTP_FUNC(sctp_sf_shutdown_ack_sent_prm_abort), \
594 } /* TYPE_SCTP_PRIMITIVE_ABORT */
596 #define TYPE_SCTP_PRIMITIVE_SEND { \
597 /* SCTP_STATE_CLOSED */ \
598 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
599 /* SCTP_STATE_COOKIE_WAIT */ \
600 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
601 /* SCTP_STATE_COOKIE_ECHOED */ \
602 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
603 /* SCTP_STATE_ESTABLISHED */ \
604 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
605 /* SCTP_STATE_SHUTDOWN_PENDING */ \
606 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
607 /* SCTP_STATE_SHUTDOWN_SENT */ \
608 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
609 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
610 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
611 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
612 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
613 } /* TYPE_SCTP_PRIMITIVE_SEND */
615 #define TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT { \
616 /* SCTP_STATE_CLOSED */ \
617 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
618 /* SCTP_STATE_COOKIE_WAIT */ \
619 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
620 /* SCTP_STATE_COOKIE_ECHOED */ \
621 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
622 /* SCTP_STATE_ESTABLISHED */ \
623 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
624 /* SCTP_STATE_SHUTDOWN_PENDING */ \
625 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
626 /* SCTP_STATE_SHUTDOWN_SENT */ \
627 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
628 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
629 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
630 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
631 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
632 } /* TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT */
634 #define TYPE_SCTP_PRIMITIVE_ASCONF { \
635 /* SCTP_STATE_CLOSED */ \
636 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
637 /* SCTP_STATE_COOKIE_WAIT */ \
638 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
639 /* SCTP_STATE_COOKIE_ECHOED */ \
640 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
641 /* SCTP_STATE_ESTABLISHED */ \
642 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
643 /* SCTP_STATE_SHUTDOWN_PENDING */ \
644 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
645 /* SCTP_STATE_SHUTDOWN_SENT */ \
646 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
647 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
648 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
649 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
650 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
651 } /* TYPE_SCTP_PRIMITIVE_ASCONF */
653 /* The primary index for this table is the primitive type.
654 * The secondary index for this table is the state.
656 static const sctp_sm_table_entry_t primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES] = {
657 TYPE_SCTP_PRIMITIVE_ASSOCIATE,
658 TYPE_SCTP_PRIMITIVE_SHUTDOWN,
659 TYPE_SCTP_PRIMITIVE_ABORT,
660 TYPE_SCTP_PRIMITIVE_SEND,
661 TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT,
662 TYPE_SCTP_PRIMITIVE_ASCONF,
665 #define TYPE_SCTP_OTHER_NO_PENDING_TSN { \
666 /* SCTP_STATE_CLOSED */ \
667 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
668 /* SCTP_STATE_COOKIE_WAIT */ \
669 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
670 /* SCTP_STATE_COOKIE_ECHOED */ \
671 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
672 /* SCTP_STATE_ESTABLISHED */ \
673 TYPE_SCTP_FUNC(sctp_sf_do_no_pending_tsn), \
674 /* SCTP_STATE_SHUTDOWN_PENDING */ \
675 TYPE_SCTP_FUNC(sctp_sf_do_9_2_start_shutdown), \
676 /* SCTP_STATE_SHUTDOWN_SENT */ \
677 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
678 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
679 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown_ack), \
680 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
681 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
684 #define TYPE_SCTP_OTHER_ICMP_PROTO_UNREACH { \
685 /* SCTP_STATE_CLOSED */ \
686 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
687 /* SCTP_STATE_COOKIE_WAIT */ \
688 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_icmp_abort), \
689 /* SCTP_STATE_COOKIE_ECHOED */ \
690 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
691 /* SCTP_STATE_ESTABLISHED */ \
692 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
693 /* SCTP_STATE_SHUTDOWN_PENDING */ \
694 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
695 /* SCTP_STATE_SHUTDOWN_SENT */ \
696 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
697 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
698 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
699 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
700 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
703 static const sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES] = {
704 TYPE_SCTP_OTHER_NO_PENDING_TSN,
705 TYPE_SCTP_OTHER_ICMP_PROTO_UNREACH,
708 #define TYPE_SCTP_EVENT_TIMEOUT_NONE { \
709 /* SCTP_STATE_CLOSED */ \
710 TYPE_SCTP_FUNC(sctp_sf_bug), \
711 /* SCTP_STATE_COOKIE_WAIT */ \
712 TYPE_SCTP_FUNC(sctp_sf_bug), \
713 /* SCTP_STATE_COOKIE_ECHOED */ \
714 TYPE_SCTP_FUNC(sctp_sf_bug), \
715 /* SCTP_STATE_ESTABLISHED */ \
716 TYPE_SCTP_FUNC(sctp_sf_bug), \
717 /* SCTP_STATE_SHUTDOWN_PENDING */ \
718 TYPE_SCTP_FUNC(sctp_sf_bug), \
719 /* SCTP_STATE_SHUTDOWN_SENT */ \
720 TYPE_SCTP_FUNC(sctp_sf_bug), \
721 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
722 TYPE_SCTP_FUNC(sctp_sf_bug), \
723 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
724 TYPE_SCTP_FUNC(sctp_sf_bug), \
727 #define TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE { \
728 /* SCTP_STATE_CLOSED */ \
729 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
730 /* SCTP_STATE_COOKIE_WAIT */ \
731 TYPE_SCTP_FUNC(sctp_sf_bug), \
732 /* SCTP_STATE_COOKIE_ECHOED */ \
733 TYPE_SCTP_FUNC(sctp_sf_t1_cookie_timer_expire), \
734 /* SCTP_STATE_ESTABLISHED */ \
735 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
736 /* SCTP_STATE_SHUTDOWN_PENDING */ \
737 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
738 /* SCTP_STATE_SHUTDOWN_SENT */ \
739 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
740 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
741 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
742 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
743 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
746 #define TYPE_SCTP_EVENT_TIMEOUT_T1_INIT { \
747 /* SCTP_STATE_CLOSED */ \
748 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
749 /* SCTP_STATE_COOKIE_WAIT */ \
750 TYPE_SCTP_FUNC(sctp_sf_t1_init_timer_expire), \
751 /* SCTP_STATE_COOKIE_ECHOED */ \
752 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
753 /* SCTP_STATE_ESTABLISHED */ \
754 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
755 /* SCTP_STATE_SHUTDOWN_PENDING */ \
756 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
757 /* SCTP_STATE_SHUTDOWN_SENT */ \
758 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
759 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
760 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
761 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
762 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
765 #define TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN { \
766 /* SCTP_STATE_CLOSED */ \
767 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
768 /* SCTP_STATE_COOKIE_WAIT */ \
769 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
770 /* SCTP_STATE_COOKIE_ECHOED */ \
771 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
772 /* SCTP_STATE_ESTABLISHED */ \
773 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
774 /* SCTP_STATE_SHUTDOWN_PENDING */ \
775 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
776 /* SCTP_STATE_SHUTDOWN_SENT */ \
777 TYPE_SCTP_FUNC(sctp_sf_t2_timer_expire), \
778 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
779 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
780 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
781 TYPE_SCTP_FUNC(sctp_sf_t2_timer_expire), \
784 #define TYPE_SCTP_EVENT_TIMEOUT_T3_RTX { \
785 /* SCTP_STATE_CLOSED */ \
786 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
787 /* SCTP_STATE_COOKIE_WAIT */ \
788 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
789 /* SCTP_STATE_COOKIE_ECHOED */ \
790 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
791 /* SCTP_STATE_ESTABLISHED */ \
792 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
793 /* SCTP_STATE_SHUTDOWN_PENDING */ \
794 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
795 /* SCTP_STATE_SHUTDOWN_SENT */ \
796 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
797 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
798 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
799 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
800 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
803 #define TYPE_SCTP_EVENT_TIMEOUT_T4_RTO { \
804 /* SCTP_STATE_CLOSED */ \
805 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
806 /* SCTP_STATE_COOKIE_WAIT */ \
807 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
808 /* SCTP_STATE_COOKIE_ECHOED */ \
809 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
810 /* SCTP_STATE_ESTABLISHED */ \
811 TYPE_SCTP_FUNC(sctp_sf_t4_timer_expire), \
812 /* SCTP_STATE_SHUTDOWN_PENDING */ \
813 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
814 /* SCTP_STATE_SHUTDOWN_SENT */ \
815 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
816 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
817 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
818 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
819 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
822 #define TYPE_SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD { \
823 /* SCTP_STATE_CLOSED */ \
824 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
825 /* SCTP_STATE_COOKIE_WAIT */ \
826 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
827 /* SCTP_STATE_COOKIE_ECHOED */ \
828 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
829 /* SCTP_STATE_ESTABLISHED */ \
830 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
831 /* SCTP_STATE_SHUTDOWN_PENDING */ \
832 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
833 /* SCTP_STATE_SHUTDOWN_SENT */ \
834 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
835 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
836 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
837 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
838 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
841 #define TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT { \
842 /* SCTP_STATE_CLOSED */ \
843 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
844 /* SCTP_STATE_COOKIE_WAIT */ \
845 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
846 /* SCTP_STATE_COOKIE_ECHOED */ \
847 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
848 /* SCTP_STATE_ESTABLISHED */ \
849 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
850 /* SCTP_STATE_SHUTDOWN_PENDING */ \
851 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
852 /* SCTP_STATE_SHUTDOWN_SENT */ \
853 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
854 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
855 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
856 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
857 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
860 #define TYPE_SCTP_EVENT_TIMEOUT_SACK { \
861 /* SCTP_STATE_CLOSED */ \
862 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
863 /* SCTP_STATE_COOKIE_WAIT */ \
864 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
865 /* SCTP_STATE_COOKIE_ECHOED */ \
866 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
867 /* SCTP_STATE_ESTABLISHED */ \
868 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
869 /* SCTP_STATE_SHUTDOWN_PENDING */ \
870 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
871 /* SCTP_STATE_SHUTDOWN_SENT */ \
872 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
873 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
874 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
875 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
876 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
879 #define TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE { \
880 /* SCTP_STATE_CLOSED */ \
881 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
882 /* SCTP_STATE_COOKIE_WAIT */ \
883 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
884 /* SCTP_STATE_COOKIE_ECHOED */ \
885 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
886 /* SCTP_STATE_ESTABLISHED */ \
887 TYPE_SCTP_FUNC(sctp_sf_autoclose_timer_expire), \
888 /* SCTP_STATE_SHUTDOWN_PENDING */ \
889 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
890 /* SCTP_STATE_SHUTDOWN_SENT */ \
891 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
892 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
893 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
894 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
895 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
898 static const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES] = {
899 TYPE_SCTP_EVENT_TIMEOUT_NONE,
900 TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE,
901 TYPE_SCTP_EVENT_TIMEOUT_T1_INIT,
902 TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN,
903 TYPE_SCTP_EVENT_TIMEOUT_T3_RTX,
904 TYPE_SCTP_EVENT_TIMEOUT_T4_RTO,
905 TYPE_SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD,
906 TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT,
907 TYPE_SCTP_EVENT_TIMEOUT_SACK,
908 TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE,
911 static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
915 if (state > SCTP_STATE_MAX)
918 if (cid <= SCTP_CID_BASE_MAX)
919 return &chunk_event_table[cid][state];
921 if (net->sctp.prsctp_enable) {
922 if (cid == SCTP_CID_FWD_TSN)
923 return &prsctp_chunk_event_table[0][state];
926 if (net->sctp.addip_enable) {
927 if (cid == SCTP_CID_ASCONF)
928 return &addip_chunk_event_table[0][state];
930 if (cid == SCTP_CID_ASCONF_ACK)
931 return &addip_chunk_event_table[1][state];
934 if (net->sctp.auth_enable) {
935 if (cid == SCTP_CID_AUTH)
936 return &auth_chunk_event_table[0][state];
939 return &chunk_event_table_unknown[state];