media: cpia2_usb: drop bogus interface-release call
[linux/fpc-iii.git] / net / sctp / sm_statetable.c
blob691d9dc620e3ea55ec14fca3cdf46b7d0e349ee0
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)
16 * any later version.
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, see
26 * <http://www.gnu.org/licenses/>.
28 * Please send any bug reports or fixes you make to the
29 * email address(es):
30 * lksctp developers <linux-sctp@vger.kernel.org>
32 * Written or modified by:
33 * La Monte H.P. Yarroll <piggy@acm.org>
34 * Karl Knutson <karl@athena.chicago.il.us>
35 * Jon Grimm <jgrimm@us.ibm.com>
36 * Hui Huang <hui.huang@nokia.com>
37 * Daisy Chang <daisyc@us.ibm.com>
38 * Ardelle Fan <ardelle.fan@intel.com>
39 * Sridhar Samudrala <sri@us.ibm.com>
42 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
44 #include <linux/skbuff.h>
45 #include <net/sctp/sctp.h>
46 #include <net/sctp/sm.h>
48 static const struct sctp_sm_table_entry
49 primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES];
50 static const struct sctp_sm_table_entry
51 other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES];
52 static const struct sctp_sm_table_entry
53 timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES];
55 static const struct sctp_sm_table_entry *sctp_chunk_event_lookup(
56 struct net *net,
57 enum sctp_cid cid,
58 enum sctp_state state);
61 static const struct sctp_sm_table_entry bug = {
62 .fn = sctp_sf_bug,
63 .name = "sctp_sf_bug"
66 #define DO_LOOKUP(_max, _type, _table) \
67 ({ \
68 const struct sctp_sm_table_entry *rtn; \
70 if ((event_subtype._type > (_max))) { \
71 pr_warn("table %p possible attack: event %d exceeds max %d\n", \
72 _table, event_subtype._type, _max); \
73 rtn = &bug; \
74 } else \
75 rtn = &_table[event_subtype._type][(int)state]; \
77 rtn; \
80 const struct sctp_sm_table_entry *sctp_sm_lookup_event(
81 struct net *net,
82 enum sctp_event event_type,
83 enum sctp_state state,
84 union sctp_subtype event_subtype)
86 switch (event_type) {
87 case SCTP_EVENT_T_CHUNK:
88 return sctp_chunk_event_lookup(net, event_subtype.chunk, state);
89 case SCTP_EVENT_T_TIMEOUT:
90 return DO_LOOKUP(SCTP_EVENT_TIMEOUT_MAX, timeout,
91 timeout_event_table);
92 case SCTP_EVENT_T_OTHER:
93 return DO_LOOKUP(SCTP_EVENT_OTHER_MAX, other,
94 other_event_table);
95 case SCTP_EVENT_T_PRIMITIVE:
96 return DO_LOOKUP(SCTP_EVENT_PRIMITIVE_MAX, primitive,
97 primitive_event_table);
98 default:
99 /* Yikes! We got an illegal event type. */
100 return &bug;
104 #define TYPE_SCTP_FUNC(func) {.fn = func, .name = #func}
106 #define TYPE_SCTP_DATA { \
107 /* SCTP_STATE_CLOSED */ \
108 TYPE_SCTP_FUNC(sctp_sf_ootb), \
109 /* SCTP_STATE_COOKIE_WAIT */ \
110 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
111 /* SCTP_STATE_COOKIE_ECHOED */ \
112 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
113 /* SCTP_STATE_ESTABLISHED */ \
114 TYPE_SCTP_FUNC(sctp_sf_eat_data_6_2), \
115 /* SCTP_STATE_SHUTDOWN_PENDING */ \
116 TYPE_SCTP_FUNC(sctp_sf_eat_data_6_2), \
117 /* SCTP_STATE_SHUTDOWN_SENT */ \
118 TYPE_SCTP_FUNC(sctp_sf_eat_data_fast_4_4), \
119 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
120 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
121 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
122 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
123 } /* TYPE_SCTP_DATA */
125 #define TYPE_SCTP_INIT { \
126 /* SCTP_STATE_CLOSED */ \
127 TYPE_SCTP_FUNC(sctp_sf_do_5_1B_init), \
128 /* SCTP_STATE_COOKIE_WAIT */ \
129 TYPE_SCTP_FUNC(sctp_sf_do_5_2_1_siminit), \
130 /* SCTP_STATE_COOKIE_ECHOED */ \
131 TYPE_SCTP_FUNC(sctp_sf_do_5_2_1_siminit), \
132 /* SCTP_STATE_ESTABLISHED */ \
133 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
134 /* SCTP_STATE_SHUTDOWN_PENDING */ \
135 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
136 /* SCTP_STATE_SHUTDOWN_SENT */ \
137 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
138 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
139 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
140 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
141 TYPE_SCTP_FUNC(sctp_sf_do_9_2_reshutack), \
142 } /* TYPE_SCTP_INIT */
144 #define TYPE_SCTP_INIT_ACK { \
145 /* SCTP_STATE_CLOSED */ \
146 TYPE_SCTP_FUNC(sctp_sf_do_5_2_3_initack), \
147 /* SCTP_STATE_COOKIE_WAIT */ \
148 TYPE_SCTP_FUNC(sctp_sf_do_5_1C_ack), \
149 /* SCTP_STATE_COOKIE_ECHOED */ \
150 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
151 /* SCTP_STATE_ESTABLISHED */ \
152 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
153 /* SCTP_STATE_SHUTDOWN_PENDING */ \
154 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
155 /* SCTP_STATE_SHUTDOWN_SENT */ \
156 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
157 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
158 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
159 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
160 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
161 } /* TYPE_SCTP_INIT_ACK */
163 #define TYPE_SCTP_SACK { \
164 /* SCTP_STATE_CLOSED */ \
165 TYPE_SCTP_FUNC(sctp_sf_ootb), \
166 /* SCTP_STATE_COOKIE_WAIT */ \
167 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
168 /* SCTP_STATE_COOKIE_ECHOED */ \
169 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
170 /* SCTP_STATE_ESTABLISHED */ \
171 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
172 /* SCTP_STATE_SHUTDOWN_PENDING */ \
173 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
174 /* SCTP_STATE_SHUTDOWN_SENT */ \
175 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
176 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
177 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
178 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
179 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
180 } /* TYPE_SCTP_SACK */
182 #define TYPE_SCTP_HEARTBEAT { \
183 /* SCTP_STATE_CLOSED */ \
184 TYPE_SCTP_FUNC(sctp_sf_ootb), \
185 /* SCTP_STATE_COOKIE_WAIT */ \
186 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
187 /* SCTP_STATE_COOKIE_ECHOED */ \
188 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
189 /* SCTP_STATE_ESTABLISHED */ \
190 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
191 /* SCTP_STATE_SHUTDOWN_PENDING */ \
192 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
193 /* SCTP_STATE_SHUTDOWN_SENT */ \
194 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
195 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
196 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
197 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
198 /* This should not happen, but we are nice. */ \
199 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
200 } /* TYPE_SCTP_HEARTBEAT */
202 #define TYPE_SCTP_HEARTBEAT_ACK { \
203 /* SCTP_STATE_CLOSED */ \
204 TYPE_SCTP_FUNC(sctp_sf_ootb), \
205 /* SCTP_STATE_COOKIE_WAIT */ \
206 TYPE_SCTP_FUNC(sctp_sf_violation), \
207 /* SCTP_STATE_COOKIE_ECHOED */ \
208 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
209 /* SCTP_STATE_ESTABLISHED */ \
210 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
211 /* SCTP_STATE_SHUTDOWN_PENDING */ \
212 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
213 /* SCTP_STATE_SHUTDOWN_SENT */ \
214 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
215 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
216 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
217 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
218 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
219 } /* TYPE_SCTP_HEARTBEAT_ACK */
221 #define TYPE_SCTP_ABORT { \
222 /* SCTP_STATE_CLOSED */ \
223 TYPE_SCTP_FUNC(sctp_sf_pdiscard), \
224 /* SCTP_STATE_COOKIE_WAIT */ \
225 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_abort), \
226 /* SCTP_STATE_COOKIE_ECHOED */ \
227 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_abort), \
228 /* SCTP_STATE_ESTABLISHED */ \
229 TYPE_SCTP_FUNC(sctp_sf_do_9_1_abort), \
230 /* SCTP_STATE_SHUTDOWN_PENDING */ \
231 TYPE_SCTP_FUNC(sctp_sf_shutdown_pending_abort), \
232 /* SCTP_STATE_SHUTDOWN_SENT */ \
233 TYPE_SCTP_FUNC(sctp_sf_shutdown_sent_abort), \
234 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
235 TYPE_SCTP_FUNC(sctp_sf_do_9_1_abort), \
236 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
237 TYPE_SCTP_FUNC(sctp_sf_shutdown_ack_sent_abort), \
238 } /* TYPE_SCTP_ABORT */
240 #define TYPE_SCTP_SHUTDOWN { \
241 /* SCTP_STATE_CLOSED */ \
242 TYPE_SCTP_FUNC(sctp_sf_ootb), \
243 /* SCTP_STATE_COOKIE_WAIT */ \
244 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
245 /* SCTP_STATE_COOKIE_ECHOED */ \
246 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
247 /* SCTP_STATE_ESTABLISHED */ \
248 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown), \
249 /* SCTP_STATE_SHUTDOWN_PENDING */ \
250 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown), \
251 /* SCTP_STATE_SHUTDOWN_SENT */ \
252 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown_ack), \
253 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
254 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shut_ctsn), \
255 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
256 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
257 } /* TYPE_SCTP_SHUTDOWN */
259 #define TYPE_SCTP_SHUTDOWN_ACK { \
260 /* SCTP_STATE_CLOSED */ \
261 TYPE_SCTP_FUNC(sctp_sf_ootb), \
262 /* SCTP_STATE_COOKIE_WAIT */ \
263 TYPE_SCTP_FUNC(sctp_sf_do_8_5_1_E_sa), \
264 /* SCTP_STATE_COOKIE_ECHOED */ \
265 TYPE_SCTP_FUNC(sctp_sf_do_8_5_1_E_sa), \
266 /* SCTP_STATE_ESTABLISHED */ \
267 TYPE_SCTP_FUNC(sctp_sf_violation), \
268 /* SCTP_STATE_SHUTDOWN_PENDING */ \
269 TYPE_SCTP_FUNC(sctp_sf_violation), \
270 /* SCTP_STATE_SHUTDOWN_SENT */ \
271 TYPE_SCTP_FUNC(sctp_sf_do_9_2_final), \
272 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
273 TYPE_SCTP_FUNC(sctp_sf_violation), \
274 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
275 TYPE_SCTP_FUNC(sctp_sf_do_9_2_final), \
276 } /* TYPE_SCTP_SHUTDOWN_ACK */
278 #define TYPE_SCTP_ERROR { \
279 /* SCTP_STATE_CLOSED */ \
280 TYPE_SCTP_FUNC(sctp_sf_ootb), \
281 /* SCTP_STATE_COOKIE_WAIT */ \
282 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
283 /* SCTP_STATE_COOKIE_ECHOED */ \
284 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_err), \
285 /* SCTP_STATE_ESTABLISHED */ \
286 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
287 /* SCTP_STATE_SHUTDOWN_PENDING */ \
288 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
289 /* SCTP_STATE_SHUTDOWN_SENT */ \
290 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
291 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
292 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
293 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
294 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
295 } /* TYPE_SCTP_ERROR */
297 #define TYPE_SCTP_COOKIE_ECHO { \
298 /* SCTP_STATE_CLOSED */ \
299 TYPE_SCTP_FUNC(sctp_sf_do_5_1D_ce), \
300 /* SCTP_STATE_COOKIE_WAIT */ \
301 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
302 /* SCTP_STATE_COOKIE_ECHOED */ \
303 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
304 /* SCTP_STATE_ESTABLISHED */ \
305 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
306 /* SCTP_STATE_SHUTDOWN_PENDING */ \
307 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
308 /* SCTP_STATE_SHUTDOWN_SENT */ \
309 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
310 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
311 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
312 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
313 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
314 } /* TYPE_SCTP_COOKIE_ECHO */
316 #define TYPE_SCTP_COOKIE_ACK { \
317 /* SCTP_STATE_CLOSED */ \
318 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
319 /* SCTP_STATE_COOKIE_WAIT */ \
320 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
321 /* SCTP_STATE_COOKIE_ECHOED */ \
322 TYPE_SCTP_FUNC(sctp_sf_do_5_1E_ca), \
323 /* SCTP_STATE_ESTABLISHED */ \
324 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
325 /* SCTP_STATE_SHUTDOWN_PENDING */ \
326 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
327 /* SCTP_STATE_SHUTDOWN_SENT */ \
328 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
329 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
330 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
331 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
332 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
333 } /* TYPE_SCTP_COOKIE_ACK */
335 #define TYPE_SCTP_ECN_ECNE { \
336 /* SCTP_STATE_CLOSED */ \
337 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
338 /* SCTP_STATE_COOKIE_WAIT */ \
339 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
340 /* SCTP_STATE_COOKIE_ECHOED */ \
341 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
342 /* SCTP_STATE_ESTABLISHED */ \
343 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
344 /* SCTP_STATE_SHUTDOWN_PENDING */ \
345 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
346 /* SCTP_STATE_SHUTDOWN_SENT */ \
347 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
348 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
349 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
350 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
351 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
352 } /* TYPE_SCTP_ECN_ECNE */
354 #define TYPE_SCTP_ECN_CWR { \
355 /* SCTP_STATE_CLOSED */ \
356 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
357 /* SCTP_STATE_COOKIE_WAIT */ \
358 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
359 /* SCTP_STATE_COOKIE_ECHOED */ \
360 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
361 /* SCTP_STATE_ESTABLISHED */ \
362 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
363 /* SCTP_STATE_SHUTDOWN_PENDING */ \
364 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
365 /* SCTP_STATE_SHUTDOWN_SENT */ \
366 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
367 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
368 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
369 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
370 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
371 } /* TYPE_SCTP_ECN_CWR */
373 #define TYPE_SCTP_SHUTDOWN_COMPLETE { \
374 /* SCTP_STATE_CLOSED */ \
375 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
376 /* SCTP_STATE_COOKIE_WAIT */ \
377 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
378 /* SCTP_STATE_COOKIE_ECHOED */ \
379 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
380 /* SCTP_STATE_ESTABLISHED */ \
381 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
382 /* SCTP_STATE_SHUTDOWN_PENDING */ \
383 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
384 /* SCTP_STATE_SHUTDOWN_SENT */ \
385 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
386 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
387 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
388 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
389 TYPE_SCTP_FUNC(sctp_sf_do_4_C), \
390 } /* TYPE_SCTP_SHUTDOWN_COMPLETE */
392 /* The primary index for this table is the chunk type.
393 * The secondary index for this table is the state.
395 * For base protocol (RFC 2960).
397 static const struct sctp_sm_table_entry
398 chunk_event_table[SCTP_NUM_BASE_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
399 TYPE_SCTP_DATA,
400 TYPE_SCTP_INIT,
401 TYPE_SCTP_INIT_ACK,
402 TYPE_SCTP_SACK,
403 TYPE_SCTP_HEARTBEAT,
404 TYPE_SCTP_HEARTBEAT_ACK,
405 TYPE_SCTP_ABORT,
406 TYPE_SCTP_SHUTDOWN,
407 TYPE_SCTP_SHUTDOWN_ACK,
408 TYPE_SCTP_ERROR,
409 TYPE_SCTP_COOKIE_ECHO,
410 TYPE_SCTP_COOKIE_ACK,
411 TYPE_SCTP_ECN_ECNE,
412 TYPE_SCTP_ECN_CWR,
413 TYPE_SCTP_SHUTDOWN_COMPLETE,
414 }; /* state_fn_t chunk_event_table[][] */
416 #define TYPE_SCTP_ASCONF { \
417 /* SCTP_STATE_CLOSED */ \
418 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
419 /* SCTP_STATE_COOKIE_WAIT */ \
420 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
421 /* SCTP_STATE_COOKIE_ECHOED */ \
422 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
423 /* SCTP_STATE_ESTABLISHED */ \
424 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
425 /* SCTP_STATE_SHUTDOWN_PENDING */ \
426 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
427 /* SCTP_STATE_SHUTDOWN_SENT */ \
428 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
429 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
430 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
431 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
432 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
433 } /* TYPE_SCTP_ASCONF */
435 #define TYPE_SCTP_ASCONF_ACK { \
436 /* SCTP_STATE_CLOSED */ \
437 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
438 /* SCTP_STATE_COOKIE_WAIT */ \
439 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
440 /* SCTP_STATE_COOKIE_ECHOED */ \
441 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
442 /* SCTP_STATE_ESTABLISHED */ \
443 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
444 /* SCTP_STATE_SHUTDOWN_PENDING */ \
445 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
446 /* SCTP_STATE_SHUTDOWN_SENT */ \
447 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
448 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
449 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
450 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
451 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
452 } /* TYPE_SCTP_ASCONF_ACK */
454 /* The primary index for this table is the chunk type.
455 * The secondary index for this table is the state.
457 static const struct sctp_sm_table_entry
458 addip_chunk_event_table[SCTP_NUM_ADDIP_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
459 TYPE_SCTP_ASCONF,
460 TYPE_SCTP_ASCONF_ACK,
461 }; /*state_fn_t addip_chunk_event_table[][] */
463 #define TYPE_SCTP_FWD_TSN { \
464 /* SCTP_STATE_CLOSED */ \
465 TYPE_SCTP_FUNC(sctp_sf_ootb), \
466 /* SCTP_STATE_COOKIE_WAIT */ \
467 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
468 /* SCTP_STATE_COOKIE_ECHOED */ \
469 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
470 /* SCTP_STATE_ESTABLISHED */ \
471 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn), \
472 /* SCTP_STATE_SHUTDOWN_PENDING */ \
473 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn), \
474 /* SCTP_STATE_SHUTDOWN_SENT */ \
475 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn_fast), \
476 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
477 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
478 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
479 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
480 } /* TYPE_SCTP_FWD_TSN */
482 /* The primary index for this table is the chunk type.
483 * The secondary index for this table is the state.
485 static const struct sctp_sm_table_entry
486 prsctp_chunk_event_table[SCTP_NUM_PRSCTP_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
487 TYPE_SCTP_FWD_TSN,
488 }; /*state_fn_t prsctp_chunk_event_table[][] */
490 #define TYPE_SCTP_RECONF { \
491 /* SCTP_STATE_CLOSED */ \
492 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
493 /* SCTP_STATE_COOKIE_WAIT */ \
494 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
495 /* SCTP_STATE_COOKIE_ECHOED */ \
496 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
497 /* SCTP_STATE_ESTABLISHED */ \
498 TYPE_SCTP_FUNC(sctp_sf_do_reconf), \
499 /* SCTP_STATE_SHUTDOWN_PENDING */ \
500 TYPE_SCTP_FUNC(sctp_sf_do_reconf), \
501 /* SCTP_STATE_SHUTDOWN_SENT */ \
502 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
503 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
504 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
505 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
506 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
507 } /* TYPE_SCTP_RECONF */
509 /* The primary index for this table is the chunk type.
510 * The secondary index for this table is the state.
512 static const struct sctp_sm_table_entry
513 reconf_chunk_event_table[SCTP_NUM_RECONF_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
514 TYPE_SCTP_RECONF,
515 }; /*state_fn_t reconf_chunk_event_table[][] */
517 #define TYPE_SCTP_AUTH { \
518 /* SCTP_STATE_CLOSED */ \
519 TYPE_SCTP_FUNC(sctp_sf_ootb), \
520 /* SCTP_STATE_COOKIE_WAIT */ \
521 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
522 /* SCTP_STATE_COOKIE_ECHOED */ \
523 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
524 /* SCTP_STATE_ESTABLISHED */ \
525 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
526 /* SCTP_STATE_SHUTDOWN_PENDING */ \
527 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
528 /* SCTP_STATE_SHUTDOWN_SENT */ \
529 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
530 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
531 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
532 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
533 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
534 } /* TYPE_SCTP_AUTH */
536 /* The primary index for this table is the chunk type.
537 * The secondary index for this table is the state.
539 static const struct sctp_sm_table_entry
540 auth_chunk_event_table[SCTP_NUM_AUTH_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
541 TYPE_SCTP_AUTH,
542 }; /*state_fn_t auth_chunk_event_table[][] */
544 static const struct sctp_sm_table_entry
545 chunk_event_table_unknown[SCTP_STATE_NUM_STATES] = {
546 /* SCTP_STATE_CLOSED */
547 TYPE_SCTP_FUNC(sctp_sf_ootb),
548 /* SCTP_STATE_COOKIE_WAIT */
549 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
550 /* SCTP_STATE_COOKIE_ECHOED */
551 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
552 /* SCTP_STATE_ESTABLISHED */
553 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
554 /* SCTP_STATE_SHUTDOWN_PENDING */
555 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
556 /* SCTP_STATE_SHUTDOWN_SENT */
557 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
558 /* SCTP_STATE_SHUTDOWN_RECEIVED */
559 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
560 /* SCTP_STATE_SHUTDOWN_ACK_SENT */
561 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
562 }; /* chunk unknown */
565 #define TYPE_SCTP_PRIMITIVE_ASSOCIATE { \
566 /* SCTP_STATE_CLOSED */ \
567 TYPE_SCTP_FUNC(sctp_sf_do_prm_asoc), \
568 /* SCTP_STATE_COOKIE_WAIT */ \
569 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
570 /* SCTP_STATE_COOKIE_ECHOED */ \
571 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
572 /* SCTP_STATE_ESTABLISHED */ \
573 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
574 /* SCTP_STATE_SHUTDOWN_PENDING */ \
575 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
576 /* SCTP_STATE_SHUTDOWN_SENT */ \
577 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
578 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
579 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
580 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
581 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
582 } /* TYPE_SCTP_PRIMITIVE_ASSOCIATE */
584 #define TYPE_SCTP_PRIMITIVE_SHUTDOWN { \
585 /* SCTP_STATE_CLOSED */ \
586 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
587 /* SCTP_STATE_COOKIE_WAIT */ \
588 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_prm_shutdown), \
589 /* SCTP_STATE_COOKIE_ECHOED */ \
590 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_prm_shutdown),\
591 /* SCTP_STATE_ESTABLISHED */ \
592 TYPE_SCTP_FUNC(sctp_sf_do_9_2_prm_shutdown), \
593 /* SCTP_STATE_SHUTDOWN_PENDING */ \
594 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
595 /* SCTP_STATE_SHUTDOWN_SENT */ \
596 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
597 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
598 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
599 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
600 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
601 } /* TYPE_SCTP_PRIMITIVE_SHUTDOWN */
603 #define TYPE_SCTP_PRIMITIVE_ABORT { \
604 /* SCTP_STATE_CLOSED */ \
605 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
606 /* SCTP_STATE_COOKIE_WAIT */ \
607 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_prm_abort), \
608 /* SCTP_STATE_COOKIE_ECHOED */ \
609 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_prm_abort), \
610 /* SCTP_STATE_ESTABLISHED */ \
611 TYPE_SCTP_FUNC(sctp_sf_do_9_1_prm_abort), \
612 /* SCTP_STATE_SHUTDOWN_PENDING */ \
613 TYPE_SCTP_FUNC(sctp_sf_shutdown_pending_prm_abort), \
614 /* SCTP_STATE_SHUTDOWN_SENT */ \
615 TYPE_SCTP_FUNC(sctp_sf_shutdown_sent_prm_abort), \
616 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
617 TYPE_SCTP_FUNC(sctp_sf_do_9_1_prm_abort), \
618 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
619 TYPE_SCTP_FUNC(sctp_sf_shutdown_ack_sent_prm_abort), \
620 } /* TYPE_SCTP_PRIMITIVE_ABORT */
622 #define TYPE_SCTP_PRIMITIVE_SEND { \
623 /* SCTP_STATE_CLOSED */ \
624 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
625 /* SCTP_STATE_COOKIE_WAIT */ \
626 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
627 /* SCTP_STATE_COOKIE_ECHOED */ \
628 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
629 /* SCTP_STATE_ESTABLISHED */ \
630 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
631 /* SCTP_STATE_SHUTDOWN_PENDING */ \
632 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
633 /* SCTP_STATE_SHUTDOWN_SENT */ \
634 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
635 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
636 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
637 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
638 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
639 } /* TYPE_SCTP_PRIMITIVE_SEND */
641 #define TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT { \
642 /* SCTP_STATE_CLOSED */ \
643 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
644 /* SCTP_STATE_COOKIE_WAIT */ \
645 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
646 /* SCTP_STATE_COOKIE_ECHOED */ \
647 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
648 /* SCTP_STATE_ESTABLISHED */ \
649 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
650 /* SCTP_STATE_SHUTDOWN_PENDING */ \
651 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
652 /* SCTP_STATE_SHUTDOWN_SENT */ \
653 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
654 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
655 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
656 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
657 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
658 } /* TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT */
660 #define TYPE_SCTP_PRIMITIVE_ASCONF { \
661 /* SCTP_STATE_CLOSED */ \
662 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
663 /* SCTP_STATE_COOKIE_WAIT */ \
664 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
665 /* SCTP_STATE_COOKIE_ECHOED */ \
666 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
667 /* SCTP_STATE_ESTABLISHED */ \
668 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
669 /* SCTP_STATE_SHUTDOWN_PENDING */ \
670 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
671 /* SCTP_STATE_SHUTDOWN_SENT */ \
672 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
673 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
674 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
675 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
676 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
677 } /* TYPE_SCTP_PRIMITIVE_ASCONF */
679 #define TYPE_SCTP_PRIMITIVE_RECONF { \
680 /* SCTP_STATE_CLOSED */ \
681 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
682 /* SCTP_STATE_COOKIE_WAIT */ \
683 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
684 /* SCTP_STATE_COOKIE_ECHOED */ \
685 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
686 /* SCTP_STATE_ESTABLISHED */ \
687 TYPE_SCTP_FUNC(sctp_sf_do_prm_reconf), \
688 /* SCTP_STATE_SHUTDOWN_PENDING */ \
689 TYPE_SCTP_FUNC(sctp_sf_do_prm_reconf), \
690 /* SCTP_STATE_SHUTDOWN_SENT */ \
691 TYPE_SCTP_FUNC(sctp_sf_do_prm_reconf), \
692 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
693 TYPE_SCTP_FUNC(sctp_sf_do_prm_reconf), \
694 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
695 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
696 } /* TYPE_SCTP_PRIMITIVE_RECONF */
698 /* The primary index for this table is the primitive type.
699 * The secondary index for this table is the state.
701 static const struct sctp_sm_table_entry
702 primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES] = {
703 TYPE_SCTP_PRIMITIVE_ASSOCIATE,
704 TYPE_SCTP_PRIMITIVE_SHUTDOWN,
705 TYPE_SCTP_PRIMITIVE_ABORT,
706 TYPE_SCTP_PRIMITIVE_SEND,
707 TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT,
708 TYPE_SCTP_PRIMITIVE_ASCONF,
709 TYPE_SCTP_PRIMITIVE_RECONF,
712 #define TYPE_SCTP_OTHER_NO_PENDING_TSN { \
713 /* SCTP_STATE_CLOSED */ \
714 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
715 /* SCTP_STATE_COOKIE_WAIT */ \
716 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
717 /* SCTP_STATE_COOKIE_ECHOED */ \
718 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
719 /* SCTP_STATE_ESTABLISHED */ \
720 TYPE_SCTP_FUNC(sctp_sf_do_no_pending_tsn), \
721 /* SCTP_STATE_SHUTDOWN_PENDING */ \
722 TYPE_SCTP_FUNC(sctp_sf_do_9_2_start_shutdown), \
723 /* SCTP_STATE_SHUTDOWN_SENT */ \
724 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
725 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
726 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown_ack), \
727 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
728 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
731 #define TYPE_SCTP_OTHER_ICMP_PROTO_UNREACH { \
732 /* SCTP_STATE_CLOSED */ \
733 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
734 /* SCTP_STATE_COOKIE_WAIT */ \
735 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_icmp_abort), \
736 /* SCTP_STATE_COOKIE_ECHOED */ \
737 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
738 /* SCTP_STATE_ESTABLISHED */ \
739 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
740 /* SCTP_STATE_SHUTDOWN_PENDING */ \
741 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
742 /* SCTP_STATE_SHUTDOWN_SENT */ \
743 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
744 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
745 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
746 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
747 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
750 static const struct sctp_sm_table_entry
751 other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES] = {
752 TYPE_SCTP_OTHER_NO_PENDING_TSN,
753 TYPE_SCTP_OTHER_ICMP_PROTO_UNREACH,
756 #define TYPE_SCTP_EVENT_TIMEOUT_NONE { \
757 /* SCTP_STATE_CLOSED */ \
758 TYPE_SCTP_FUNC(sctp_sf_bug), \
759 /* SCTP_STATE_COOKIE_WAIT */ \
760 TYPE_SCTP_FUNC(sctp_sf_bug), \
761 /* SCTP_STATE_COOKIE_ECHOED */ \
762 TYPE_SCTP_FUNC(sctp_sf_bug), \
763 /* SCTP_STATE_ESTABLISHED */ \
764 TYPE_SCTP_FUNC(sctp_sf_bug), \
765 /* SCTP_STATE_SHUTDOWN_PENDING */ \
766 TYPE_SCTP_FUNC(sctp_sf_bug), \
767 /* SCTP_STATE_SHUTDOWN_SENT */ \
768 TYPE_SCTP_FUNC(sctp_sf_bug), \
769 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
770 TYPE_SCTP_FUNC(sctp_sf_bug), \
771 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
772 TYPE_SCTP_FUNC(sctp_sf_bug), \
775 #define TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE { \
776 /* SCTP_STATE_CLOSED */ \
777 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
778 /* SCTP_STATE_COOKIE_WAIT */ \
779 TYPE_SCTP_FUNC(sctp_sf_bug), \
780 /* SCTP_STATE_COOKIE_ECHOED */ \
781 TYPE_SCTP_FUNC(sctp_sf_t1_cookie_timer_expire), \
782 /* SCTP_STATE_ESTABLISHED */ \
783 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
784 /* SCTP_STATE_SHUTDOWN_PENDING */ \
785 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
786 /* SCTP_STATE_SHUTDOWN_SENT */ \
787 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
788 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
789 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
790 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
791 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
794 #define TYPE_SCTP_EVENT_TIMEOUT_T1_INIT { \
795 /* SCTP_STATE_CLOSED */ \
796 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
797 /* SCTP_STATE_COOKIE_WAIT */ \
798 TYPE_SCTP_FUNC(sctp_sf_t1_init_timer_expire), \
799 /* SCTP_STATE_COOKIE_ECHOED */ \
800 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
801 /* SCTP_STATE_ESTABLISHED */ \
802 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
803 /* SCTP_STATE_SHUTDOWN_PENDING */ \
804 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
805 /* SCTP_STATE_SHUTDOWN_SENT */ \
806 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
807 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
808 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
809 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
810 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
813 #define TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN { \
814 /* SCTP_STATE_CLOSED */ \
815 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
816 /* SCTP_STATE_COOKIE_WAIT */ \
817 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
818 /* SCTP_STATE_COOKIE_ECHOED */ \
819 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
820 /* SCTP_STATE_ESTABLISHED */ \
821 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
822 /* SCTP_STATE_SHUTDOWN_PENDING */ \
823 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
824 /* SCTP_STATE_SHUTDOWN_SENT */ \
825 TYPE_SCTP_FUNC(sctp_sf_t2_timer_expire), \
826 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
827 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
828 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
829 TYPE_SCTP_FUNC(sctp_sf_t2_timer_expire), \
832 #define TYPE_SCTP_EVENT_TIMEOUT_T3_RTX { \
833 /* SCTP_STATE_CLOSED */ \
834 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
835 /* SCTP_STATE_COOKIE_WAIT */ \
836 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
837 /* SCTP_STATE_COOKIE_ECHOED */ \
838 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
839 /* SCTP_STATE_ESTABLISHED */ \
840 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
841 /* SCTP_STATE_SHUTDOWN_PENDING */ \
842 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
843 /* SCTP_STATE_SHUTDOWN_SENT */ \
844 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
845 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
846 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
847 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
848 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
851 #define TYPE_SCTP_EVENT_TIMEOUT_T4_RTO { \
852 /* SCTP_STATE_CLOSED */ \
853 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
854 /* SCTP_STATE_COOKIE_WAIT */ \
855 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
856 /* SCTP_STATE_COOKIE_ECHOED */ \
857 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
858 /* SCTP_STATE_ESTABLISHED */ \
859 TYPE_SCTP_FUNC(sctp_sf_t4_timer_expire), \
860 /* SCTP_STATE_SHUTDOWN_PENDING */ \
861 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
862 /* SCTP_STATE_SHUTDOWN_SENT */ \
863 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
864 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
865 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
866 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
867 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
870 #define TYPE_SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD { \
871 /* SCTP_STATE_CLOSED */ \
872 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
873 /* SCTP_STATE_COOKIE_WAIT */ \
874 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
875 /* SCTP_STATE_COOKIE_ECHOED */ \
876 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
877 /* SCTP_STATE_ESTABLISHED */ \
878 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
879 /* SCTP_STATE_SHUTDOWN_PENDING */ \
880 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
881 /* SCTP_STATE_SHUTDOWN_SENT */ \
882 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
883 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
884 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
885 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
886 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
889 #define TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT { \
890 /* SCTP_STATE_CLOSED */ \
891 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
892 /* SCTP_STATE_COOKIE_WAIT */ \
893 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
894 /* SCTP_STATE_COOKIE_ECHOED */ \
895 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
896 /* SCTP_STATE_ESTABLISHED */ \
897 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
898 /* SCTP_STATE_SHUTDOWN_PENDING */ \
899 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
900 /* SCTP_STATE_SHUTDOWN_SENT */ \
901 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
902 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
903 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
904 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
905 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
908 #define TYPE_SCTP_EVENT_TIMEOUT_SACK { \
909 /* SCTP_STATE_CLOSED */ \
910 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
911 /* SCTP_STATE_COOKIE_WAIT */ \
912 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
913 /* SCTP_STATE_COOKIE_ECHOED */ \
914 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
915 /* SCTP_STATE_ESTABLISHED */ \
916 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
917 /* SCTP_STATE_SHUTDOWN_PENDING */ \
918 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
919 /* SCTP_STATE_SHUTDOWN_SENT */ \
920 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
921 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
922 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
923 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
924 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
927 #define TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE { \
928 /* SCTP_STATE_CLOSED */ \
929 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
930 /* SCTP_STATE_COOKIE_WAIT */ \
931 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
932 /* SCTP_STATE_COOKIE_ECHOED */ \
933 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
934 /* SCTP_STATE_ESTABLISHED */ \
935 TYPE_SCTP_FUNC(sctp_sf_autoclose_timer_expire), \
936 /* SCTP_STATE_SHUTDOWN_PENDING */ \
937 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
938 /* SCTP_STATE_SHUTDOWN_SENT */ \
939 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
940 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
941 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
942 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
943 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
946 #define TYPE_SCTP_EVENT_TIMEOUT_RECONF { \
947 /* SCTP_STATE_CLOSED */ \
948 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
949 /* SCTP_STATE_COOKIE_WAIT */ \
950 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
951 /* SCTP_STATE_COOKIE_ECHOED */ \
952 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
953 /* SCTP_STATE_ESTABLISHED */ \
954 TYPE_SCTP_FUNC(sctp_sf_send_reconf), \
955 /* SCTP_STATE_SHUTDOWN_PENDING */ \
956 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
957 /* SCTP_STATE_SHUTDOWN_SENT */ \
958 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
959 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
960 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
961 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
962 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
965 static const struct sctp_sm_table_entry
966 timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES] = {
967 TYPE_SCTP_EVENT_TIMEOUT_NONE,
968 TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE,
969 TYPE_SCTP_EVENT_TIMEOUT_T1_INIT,
970 TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN,
971 TYPE_SCTP_EVENT_TIMEOUT_T3_RTX,
972 TYPE_SCTP_EVENT_TIMEOUT_T4_RTO,
973 TYPE_SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD,
974 TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT,
975 TYPE_SCTP_EVENT_TIMEOUT_RECONF,
976 TYPE_SCTP_EVENT_TIMEOUT_SACK,
977 TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE,
980 static const struct sctp_sm_table_entry *sctp_chunk_event_lookup(
981 struct net *net,
982 enum sctp_cid cid,
983 enum sctp_state state)
985 if (state > SCTP_STATE_MAX)
986 return &bug;
988 if (cid == SCTP_CID_I_DATA)
989 cid = SCTP_CID_DATA;
991 if (cid <= SCTP_CID_BASE_MAX)
992 return &chunk_event_table[cid][state];
994 if (net->sctp.prsctp_enable) {
995 if (cid == SCTP_CID_FWD_TSN || cid == SCTP_CID_I_FWD_TSN)
996 return &prsctp_chunk_event_table[0][state];
999 if (net->sctp.addip_enable) {
1000 if (cid == SCTP_CID_ASCONF)
1001 return &addip_chunk_event_table[0][state];
1003 if (cid == SCTP_CID_ASCONF_ACK)
1004 return &addip_chunk_event_table[1][state];
1007 if (net->sctp.reconf_enable)
1008 if (cid == SCTP_CID_RECONF)
1009 return &reconf_chunk_event_table[0][state];
1011 if (net->sctp.auth_enable) {
1012 if (cid == SCTP_CID_AUTH)
1013 return &auth_chunk_event_table[0][state];
1016 return &chunk_event_table_unknown[state];