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