~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/sctp/sm_statetable.c

Version: ~ [ linux-5.8-rc4 ] ~ [ linux-5.7.7 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.50 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.131 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.187 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.229 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.229 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SCTP kernel reference Implementation
  2  * Copyright (c) 1999-2000 Cisco, Inc.
  3  * Copyright (c) 1999-2001 Motorola, Inc.
  4  * Copyright (c) 2001-2003 International Business Machines, Corp.
  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  *
 44  * Any bugs reported given to us we will try to fix... any fixes shared will
 45  * be incorporated into the next SCTP release.
 46  */
 47 
 48 #include <linux/skbuff.h>
 49 #include <net/sctp/sctp.h>
 50 #include <net/sctp/sm.h>
 51 
 52 static const sctp_sm_table_entry_t bug = {
 53         .fn = sctp_sf_bug, 
 54         .name = "sctp_sf_bug"
 55 };
 56 
 57 #define DO_LOOKUP(_max, _type, _table) \
 58         if ((event_subtype._type > (_max))) { \
 59                 printk(KERN_WARNING \
 60                        "sctp table %p possible attack:" \
 61                        " event %d exceeds max %d\n", \
 62                        _table, event_subtype._type, _max); \
 63                 return &bug; \
 64         } \
 65         return &_table[event_subtype._type][(int)state];
 66 
 67 const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
 68                                                   sctp_state_t state,
 69                                                   sctp_subtype_t event_subtype)
 70 {
 71         switch (event_type) {
 72         case SCTP_EVENT_T_CHUNK:
 73                 return sctp_chunk_event_lookup(event_subtype.chunk, state);
 74                 break;
 75         case SCTP_EVENT_T_TIMEOUT:
 76                 DO_LOOKUP(SCTP_EVENT_TIMEOUT_MAX, timeout, 
 77                           timeout_event_table);
 78                 break;
 79 
 80         case SCTP_EVENT_T_OTHER:
 81                 DO_LOOKUP(SCTP_EVENT_OTHER_MAX, other, other_event_table);
 82                 break;
 83 
 84         case SCTP_EVENT_T_PRIMITIVE:
 85                 DO_LOOKUP(SCTP_EVENT_PRIMITIVE_MAX, primitive,
 86                           primitive_event_table);
 87                 break;
 88 
 89         default:
 90                 /* Yikes!  We got an illegal event type.  */
 91                 return &bug;
 92         };
 93 }
 94 
 95 #define TYPE_SCTP_DATA { \
 96         /* SCTP_STATE_EMPTY */ \
 97         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
 98         /* SCTP_STATE_CLOSED */ \
 99         {.fn = sctp_sf_tabort_8_4_8, .name = "sctp_sf_tabort_8_4_8"}, \
100         /* SCTP_STATE_COOKIE_WAIT */ \
101         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
102         /* SCTP_STATE_COOKIE_ECHOED */ \
103         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
104         /* SCTP_STATE_ESTABLISHED */ \
105         {.fn = sctp_sf_eat_data_6_2, .name = "sctp_sf_eat_data_6_2"}, \
106         /* SCTP_STATE_SHUTDOWN_PENDING */ \
107         {.fn = sctp_sf_eat_data_6_2, .name = "sctp_sf_eat_data_6_2"}, \
108         /* SCTP_STATE_SHUTDOWN_SENT */ \
109         {.fn = sctp_sf_eat_data_fast_4_4, .name = "sctp_sf_eat_data_fast_4_4"}, \
110         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
111         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
112         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
113         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
114 } /* TYPE_SCTP_DATA */
115 
116 #define TYPE_SCTP_INIT { \
117         /* SCTP_STATE_EMPTY */ \
118         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
119         /* SCTP_STATE_CLOSED */ \
120         {.fn = sctp_sf_do_5_1B_init, .name = "sctp_sf_do_5_1B_init"}, \
121         /* SCTP_STATE_COOKIE_WAIT */ \
122         {.fn = sctp_sf_do_5_2_1_siminit, .name = "sctp_sf_do_5_2_1_siminit"}, \
123         /* SCTP_STATE_COOKIE_ECHOED */ \
124         {.fn = sctp_sf_do_5_2_1_siminit, .name = "sctp_sf_do_5_2_1_siminit"}, \
125         /* SCTP_STATE_ESTABLISHED */ \
126         {.fn = sctp_sf_do_5_2_2_dupinit, .name = "sctp_sf_do_5_2_2_dupinit"}, \
127         /* SCTP_STATE_SHUTDOWN_PENDING */ \
128         {.fn = sctp_sf_do_5_2_2_dupinit, .name = "sctp_sf_do_5_2_2_dupinit"}, \
129         /* SCTP_STATE_SHUTDOWN_SENT */ \
130         {.fn = sctp_sf_do_5_2_2_dupinit, .name = "sctp_sf_do_5_2_2_dupinit"}, \
131         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
132         {.fn = sctp_sf_do_5_2_2_dupinit, .name = "sctp_sf_do_5_2_2_dupinit"}, \
133         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
134         {.fn = sctp_sf_do_9_2_reshutack, .name = "sctp_sf_do_9_2_reshutack"}, \
135 } /* TYPE_SCTP_INIT */
136 
137 #define TYPE_SCTP_INIT_ACK { \
138         /* SCTP_STATE_EMPTY */ \
139         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
140         /* SCTP_STATE_CLOSED */ \
141         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
142         /* SCTP_STATE_COOKIE_WAIT */ \
143         {.fn = sctp_sf_do_5_1C_ack, .name = "sctp_sf_do_5_1C_ack"}, \
144         /* SCTP_STATE_COOKIE_ECHOED */ \
145         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
146         /* SCTP_STATE_ESTABLISHED */ \
147         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
148         /* SCTP_STATE_SHUTDOWN_PENDING */ \
149         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
150         /* SCTP_STATE_SHUTDOWN_SENT */ \
151         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
152         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
153         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
154         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
155         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
156 } /* TYPE_SCTP_INIT_ACK */
157 
158 #define TYPE_SCTP_SACK { \
159         /*  SCTP_STATE_EMPTY */ \
160         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
161         /* SCTP_STATE_CLOSED */ \
162         {.fn = sctp_sf_tabort_8_4_8, .name = "sctp_sf_tabort_8_4_8"}, \
163         /* SCTP_STATE_COOKIE_WAIT */ \
164         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
165         /* SCTP_STATE_COOKIE_ECHOED */ \
166         {.fn = sctp_sf_eat_sack_6_2, .name = "sctp_sf_eat_sack_6_2"}, \
167         /* SCTP_STATE_ESTABLISHED */ \
168         {.fn = sctp_sf_eat_sack_6_2, .name = "sctp_sf_eat_sack_6_2"}, \
169         /* SCTP_STATE_SHUTDOWN_PENDING */ \
170         {.fn = sctp_sf_eat_sack_6_2, .name = "sctp_sf_eat_sack_6_2"}, \
171         /* SCTP_STATE_SHUTDOWN_SENT */ \
172         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
173         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
174         {.fn = sctp_sf_eat_sack_6_2, .name = "sctp_sf_eat_sack_6_2"}, \
175         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
176         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
177 } /* TYPE_SCTP_SACK */
178 
179 #define TYPE_SCTP_HEARTBEAT { \
180         /*  SCTP_STATE_EMPTY */ \
181         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
182         /* SCTP_STATE_CLOSED */ \
183         {.fn = sctp_sf_tabort_8_4_8, .name = "sctp_sf_tabort_8_4_8"}, \
184         /* SCTP_STATE_COOKIE_WAIT */ \
185         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
186         /* SCTP_STATE_COOKIE_ECHOED */ \
187         {.fn = sctp_sf_beat_8_3, .name = "sctp_sf_beat_8_3"}, \
188         /* SCTP_STATE_ESTABLISHED */ \
189         {.fn = sctp_sf_beat_8_3, .name = "sctp_sf_beat_8_3"}, \
190         /* SCTP_STATE_SHUTDOWN_PENDING */ \
191         {.fn = sctp_sf_beat_8_3, .name = "sctp_sf_beat_8_3"}, \
192         /* SCTP_STATE_SHUTDOWN_SENT */ \
193         {.fn = sctp_sf_beat_8_3, .name = "sctp_sf_beat_8_3"}, \
194         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
195         {.fn = sctp_sf_beat_8_3, .name = "sctp_sf_beat_8_3"}, \
196         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
197         /* This should not happen, but we are nice.  */ \
198         {.fn = sctp_sf_beat_8_3, .name = "sctp_sf_beat_8_3"}, \
199 } /* TYPE_SCTP_HEARTBEAT */
200 
201 #define TYPE_SCTP_HEARTBEAT_ACK { \
202         /*  SCTP_STATE_EMPTY */ \
203         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
204         /* SCTP_STATE_CLOSED */ \
205         {.fn = sctp_sf_tabort_8_4_8, .name = "sctp_sf_tabort_8_4_8"}, \
206         /* SCTP_STATE_COOKIE_WAIT */ \
207         {.fn = sctp_sf_violation, .name = "sctp_sf_violation"}, \
208         /* SCTP_STATE_COOKIE_ECHOED */ \
209         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
210         /* SCTP_STATE_ESTABLISHED */ \
211         {.fn = sctp_sf_backbeat_8_3, .name = "sctp_sf_backbeat_8_3"}, \
212         /* SCTP_STATE_SHUTDOWN_PENDING */ \
213         {.fn = sctp_sf_backbeat_8_3, .name = "sctp_sf_backbeat_8_3"}, \
214         /* SCTP_STATE_SHUTDOWN_SENT */ \
215         {.fn = sctp_sf_backbeat_8_3, .name = "sctp_sf_backbeat_8_3"}, \
216         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
217         {.fn = sctp_sf_backbeat_8_3, .name = "sctp_sf_backbeat_8_3"}, \
218         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
219         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
220 } /* TYPE_SCTP_HEARTBEAT_ACK */
221 
222 #define TYPE_SCTP_ABORT { \
223         /* SCTP_STATE_EMPTY */ \
224         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
225         /* SCTP_STATE_CLOSED */ \
226         {.fn = sctp_sf_pdiscard, .name = "sctp_sf_pdiscard"}, \
227         /* SCTP_STATE_COOKIE_WAIT */ \
228         {.fn = sctp_sf_cookie_wait_abort, .name = "sctp_sf_cookie_wait_abort"}, \
229         /* SCTP_STATE_COOKIE_ECHOED */ \
230         {.fn = sctp_sf_cookie_echoed_abort, \
231          .name = "sctp_sf_cookie_echoed_abort"}, \
232         /* SCTP_STATE_ESTABLISHED */ \
233         {.fn = sctp_sf_do_9_1_abort, .name = "sctp_sf_do_9_1_abort"}, \
234         /* SCTP_STATE_SHUTDOWN_PENDING */ \
235         {.fn = sctp_sf_shutdown_pending_abort, \
236         .name = "sctp_sf_shutdown_pending_abort"}, \
237         /* SCTP_STATE_SHUTDOWN_SENT */ \
238         {.fn = sctp_sf_shutdown_sent_abort, \
239         .name = "sctp_sf_shutdown_sent_abort"}, \
240         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
241         {.fn = sctp_sf_do_9_1_abort, .name = "sctp_sf_do_9_1_abort"}, \
242         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
243         {.fn = sctp_sf_shutdown_ack_sent_abort, \
244         .name = "sctp_sf_shutdown_ack_sent_abort"}, \
245 } /* TYPE_SCTP_ABORT */
246 
247 #define TYPE_SCTP_SHUTDOWN { \
248         /* SCTP_STATE_EMPTY */ \
249         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
250         /* SCTP_STATE_CLOSED */ \
251         {.fn = sctp_sf_tabort_8_4_8, .name = "sctp_sf_tabort_8_4_8"}, \
252         /* SCTP_STATE_COOKIE_WAIT */ \
253         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
254         /* SCTP_STATE_COOKIE_ECHOED */ \
255         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
256         /* SCTP_STATE_ESTABLISHED */ \
257         {.fn = sctp_sf_do_9_2_shutdown, .name = "sctp_sf_do_9_2_shutdown"}, \
258         /* SCTP_STATE_SHUTDOWN_PENDING */ \
259         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
260         /* SCTP_STATE_SHUTDOWN_SENT */ \
261         {.fn = sctp_sf_do_9_2_shutdown_ack, \
262          .name = "sctp_sf_do_9_2_shutdown_ack"}, \
263         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
264         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
265         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
266         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
267 } /* TYPE_SCTP_SHUTDOWN */
268 
269 #define TYPE_SCTP_SHUTDOWN_ACK { \
270         /* SCTP_STATE_EMPTY */ \
271         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
272         /* SCTP_STATE_CLOSED */ \
273         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
274         /* SCTP_STATE_COOKIE_WAIT */ \
275         {.fn = sctp_sf_do_8_5_1_E_sa, .name = "sctp_sf_do_8_5_1_E_sa"}, \
276         /* SCTP_STATE_COOKIE_ECHOED */ \
277         {.fn = sctp_sf_do_8_5_1_E_sa, .name = "sctp_sf_do_8_5_1_E_sa"}, \
278         /* SCTP_STATE_ESTABLISHED */ \
279         {.fn = sctp_sf_violation, .name = "sctp_sf_violation"}, \
280         /* SCTP_STATE_SHUTDOWN_PENDING */ \
281         {.fn = sctp_sf_violation, .name = "sctp_sf_violation"}, \
282         /* SCTP_STATE_SHUTDOWN_SENT */ \
283         {.fn = sctp_sf_do_9_2_final, .name = "sctp_sf_do_9_2_final"}, \
284         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
285         {.fn = sctp_sf_violation, .name = "sctp_sf_violation"}, \
286         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
287         {.fn = sctp_sf_do_9_2_final, .name = "sctp_sf_do_9_2_final"}, \
288 } /* TYPE_SCTP_SHUTDOWN_ACK */
289 
290 #define TYPE_SCTP_ERROR { \
291         /* SCTP_STATE_EMPTY */ \
292         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
293         /* SCTP_STATE_CLOSED */ \
294         {.fn = sctp_sf_tabort_8_4_8, .name = "sctp_sf_tabort_8_4_8"}, \
295         /* SCTP_STATE_COOKIE_WAIT */ \
296         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
297         /* SCTP_STATE_COOKIE_ECHOED */ \
298         {.fn = sctp_sf_cookie_echoed_err, .name = "sctp_sf_cookie_echoed_err"}, \
299         /* SCTP_STATE_ESTABLISHED */ \
300         {.fn = sctp_sf_operr_notify, .name = "sctp_sf_operr_notify"}, \
301         /* SCTP_STATE_SHUTDOWN_PENDING */ \
302         {.fn = sctp_sf_operr_notify, .name = "sctp_sf_operr_notify"}, \
303         /* SCTP_STATE_SHUTDOWN_SENT */ \
304         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
305         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
306         {.fn = sctp_sf_operr_notify, .name = "sctp_sf_operr_notify"}, \
307         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
308         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
309 } /* TYPE_SCTP_ERROR */
310 
311 #define TYPE_SCTP_COOKIE_ECHO { \
312         /* SCTP_STATE_EMPTY */ \
313         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
314         /* SCTP_STATE_CLOSED */ \
315         {.fn = sctp_sf_do_5_1D_ce, .name = "sctp_sf_do_5_1D_ce"}, \
316         /* SCTP_STATE_COOKIE_WAIT */ \
317         {.fn = sctp_sf_do_5_2_4_dupcook, .name = "sctp_sf_do_5_2_4_dupcook"}, \
318         /* SCTP_STATE_COOKIE_ECHOED */ \
319         {.fn = sctp_sf_do_5_2_4_dupcook, .name = "sctp_sf_do_5_2_4_dupcook"}, \
320         /* SCTP_STATE_ESTABLISHED */ \
321         {.fn = sctp_sf_do_5_2_4_dupcook, .name = "sctp_sf_do_5_2_4_dupcook"}, \
322         /* SCTP_STATE_SHUTDOWN_PENDING */ \
323         {.fn = sctp_sf_do_5_2_4_dupcook, .name = "sctp_sf_do_5_2_4_dupcook"}, \
324         /* SCTP_STATE_SHUTDOWN_SENT */ \
325         {.fn = sctp_sf_do_5_2_4_dupcook, .name = "sctp_sf_do_5_2_4_dupcook"}, \
326         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
327         {.fn = sctp_sf_do_5_2_4_dupcook, .name = "sctp_sf_do_5_2_4_dupcook"}, \
328         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
329         {.fn = sctp_sf_do_5_2_4_dupcook, .name = "sctp_sf_do_5_2_4_dupcook"}, \
330 } /* TYPE_SCTP_COOKIE_ECHO */
331 
332 #define TYPE_SCTP_COOKIE_ACK { \
333         /* SCTP_STATE_EMPTY */ \
334         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
335         /* SCTP_STATE_CLOSED */ \
336         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
337         /* SCTP_STATE_COOKIE_WAIT */ \
338         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
339         /* SCTP_STATE_COOKIE_ECHOED */ \
340         {.fn = sctp_sf_do_5_1E_ca, .name = "sctp_sf_do_5_1E_ca"}, \
341         /* SCTP_STATE_ESTABLISHED */ \
342         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
343         /* SCTP_STATE_SHUTDOWN_PENDING */ \
344         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
345         /* SCTP_STATE_SHUTDOWN_SENT */ \
346         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
347         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
348         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
349         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
350         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
351 } /* TYPE_SCTP_COOKIE_ACK */
352 
353 #define TYPE_SCTP_ECN_ECNE { \
354         /* SCTP_STATE_EMPTY */ \
355         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
356         /* SCTP_STATE_CLOSED */ \
357         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
358         /* SCTP_STATE_COOKIE_WAIT */ \
359         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
360         /* SCTP_STATE_COOKIE_ECHOED */ \
361         {.fn = sctp_sf_do_ecne, .name = "sctp_sf_do_ecne"}, \
362         /* SCTP_STATE_ESTABLISHED */ \
363         {.fn = sctp_sf_do_ecne, .name = "sctp_sf_do_ecne"}, \
364         /* SCTP_STATE_SHUTDOWN_PENDING */ \
365         {.fn = sctp_sf_do_ecne, .name = "sctp_sf_do_ecne"}, \
366         /* SCTP_STATE_SHUTDOWN_SENT */ \
367         {.fn = sctp_sf_do_ecne, .name = "sctp_sf_do_ecne"}, \
368         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
369         {.fn = sctp_sf_do_ecne, .name = "sctp_sf_do_ecne"}, \
370         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
371         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
372 } /* TYPE_SCTP_ECN_ECNE */
373 
374 #define TYPE_SCTP_ECN_CWR { \
375         /* SCTP_STATE_EMPTY */ \
376         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
377         /* SCTP_STATE_CLOSED */ \
378         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
379         /* SCTP_STATE_COOKIE_WAIT */ \
380         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
381         /* SCTP_STATE_COOKIE_ECHOED */ \
382         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
383         /* SCTP_STATE_ESTABLISHED */ \
384         {.fn = sctp_sf_do_ecn_cwr, .name = "sctp_sf_do_ecn_cwr"}, \
385         /* SCTP_STATE_SHUTDOWN_PENDING */ \
386         {.fn = sctp_sf_do_ecn_cwr, .name = "sctp_sf_do_ecn_cwr"}, \
387         /* SCTP_STATE_SHUTDOWN_SENT */ \
388         {.fn = sctp_sf_do_ecn_cwr, .name = "sctp_sf_do_ecn_cwr"}, \
389         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
390         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
391         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
392         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
393 } /* TYPE_SCTP_ECN_CWR */
394 
395 #define TYPE_SCTP_SHUTDOWN_COMPLETE { \
396         /* SCTP_STATE_EMPTY */ \
397         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
398         /* SCTP_STATE_CLOSED */ \
399         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
400         /* SCTP_STATE_COOKIE_WAIT */ \
401         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
402         /* SCTP_STATE_COOKIE_ECHOED */ \
403         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
404         /* SCTP_STATE_ESTABLISHED */ \
405         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
406         /* SCTP_STATE_SHUTDOWN_PENDING */ \
407         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
408         /* SCTP_STATE_SHUTDOWN_SENT */ \
409         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
410         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
411         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
412         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
413         {.fn = sctp_sf_do_4_C, .name = "sctp_sf_do_4_C"}, \
414 } /* TYPE_SCTP_SHUTDOWN_COMPLETE */
415 
416 /* The primary index for this table is the chunk type.
417  * The secondary index for this table is the state.
418  *
419  * For base protocol (RFC 2960).
420  */
421 const sctp_sm_table_entry_t chunk_event_table[SCTP_NUM_BASE_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
422         TYPE_SCTP_DATA,
423         TYPE_SCTP_INIT,
424         TYPE_SCTP_INIT_ACK,
425         TYPE_SCTP_SACK,
426         TYPE_SCTP_HEARTBEAT,
427         TYPE_SCTP_HEARTBEAT_ACK,
428         TYPE_SCTP_ABORT,
429         TYPE_SCTP_SHUTDOWN,
430         TYPE_SCTP_SHUTDOWN_ACK,
431         TYPE_SCTP_ERROR,
432         TYPE_SCTP_COOKIE_ECHO,
433         TYPE_SCTP_COOKIE_ACK,
434         TYPE_SCTP_ECN_ECNE,
435         TYPE_SCTP_ECN_CWR,
436         TYPE_SCTP_SHUTDOWN_COMPLETE,
437 }; /* state_fn_t chunk_event_table[][] */
438 
439 #define TYPE_SCTP_ASCONF { \
440         /* SCTP_STATE_EMPTY */ \
441         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
442         /* SCTP_STATE_CLOSED */ \
443         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
444         /* SCTP_STATE_COOKIE_WAIT */ \
445         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
446         /* SCTP_STATE_COOKIE_ECHOED */ \
447         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
448         /* SCTP_STATE_ESTABLISHED */ \
449         {.fn = sctp_sf_do_asconf, .name = "sctp_sf_do_asconf"}, \
450         /* SCTP_STATE_SHUTDOWN_PENDING */ \
451         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
452         /* SCTP_STATE_SHUTDOWN_SENT */ \
453         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
454         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
455         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
456         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
457         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
458 } /* TYPE_SCTP_ASCONF */
459 
460 #define TYPE_SCTP_ASCONF_ACK { \
461         /* SCTP_STATE_EMPTY */ \
462         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
463         /* SCTP_STATE_CLOSED */ \
464         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
465         /* SCTP_STATE_COOKIE_WAIT */ \
466         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
467         /* SCTP_STATE_COOKIE_ECHOED */ \
468         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
469         /* SCTP_STATE_ESTABLISHED */ \
470         {.fn = sctp_sf_do_asconf_ack, .name = "sctp_sf_do_asconf_ack"}, \
471         /* SCTP_STATE_SHUTDOWN_PENDING */ \
472         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
473         /* SCTP_STATE_SHUTDOWN_SENT */ \
474         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
475         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
476         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
477         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
478         {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
479 } /* TYPE_SCTP_ASCONF_ACK */
480 
481 /* The primary index for this table is the chunk type.
482  * The secondary index for this table is the state.
483  */
484 const sctp_sm_table_entry_t addip_chunk_event_table[SCTP_NUM_ADDIP_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
485         TYPE_SCTP_ASCONF,
486         TYPE_SCTP_ASCONF_ACK,
487 }; /*state_fn_t addip_chunk_event_table[][] */
488 
489 static const sctp_sm_table_entry_t
490 chunk_event_table_unknown[SCTP_STATE_NUM_STATES] = {
491         /* SCTP_STATE_EMPTY */
492         {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"},
493         /* SCTP_STATE_CLOSED */
494         {.fn = sctp_sf_tabort_8_4_8, .name = "sctp_sf_tabort_8_4_8"},
495         /* SCTP_STATE_COOKIE_WAIT */
496         {.fn = sctp_sf_unk_chunk, .name = "sctp_sf_unk_chunk"},
497         /* SCTP_STATE_COOKIE_ECHOED */
498         {.fn = sctp_sf_unk_chunk, .name = "sctp_sf_unk_chunk"},
499         /* SCTP_STATE_ESTABLISHED */
500         {.fn = sctp_sf_unk_chunk, .name = "sctp_sf_unk_chunk"},
501         /* SCTP_STATE_SHUTDOWN_PENDING */
502         {.fn = sctp_sf_unk_chunk, .name = "sctp_sf_unk_chunk"},
503         /* SCTP_STATE_SHUTDOWN_SENT */
504         {.fn = sctp_sf_unk_chunk, .name = "sctp_sf_unk_chunk"},
505         /* SCTP_STATE_SHUTDOWN_RECEIVED */
506         {.fn = sctp_sf_unk_chunk, .name = "sctp_sf_unk_chunk"},
507         /* SCTP_STATE_SHUTDOWN_ACK_SENT */
508         {.fn = sctp_sf_unk_chunk, .name = "sctp_sf_unk_chunk"},
509 };      /* chunk unknown */
510 
511 
512 #define TYPE_SCTP_PRIMITIVE_ASSOCIATE  { \
513         /* SCTP_STATE_EMPTY */ \
514         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
515         /* SCTP_STATE_CLOSED */ \
516         {.fn = sctp_sf_do_prm_asoc, .name = "sctp_sf_do_prm_asoc"}, \
517         /* SCTP_STATE_COOKIE_WAIT */ \
518         {.fn = sctp_sf_not_impl, .name = "sctp_sf_not_impl"}, \
519         /* SCTP_STATE_COOKIE_ECHOED */ \
520         {.fn = sctp_sf_not_impl, .name = "sctp_sf_not_impl"}, \
521         /* SCTP_STATE_ESTABLISHED */ \
522         {.fn = sctp_sf_not_impl, .name = "sctp_sf_not_impl"}, \
523         /* SCTP_STATE_SHUTDOWN_PENDING */ \
524         {.fn = sctp_sf_not_impl, .name = "sctp_sf_not_impl"}, \
525         /* SCTP_STATE_SHUTDOWN_SENT */ \
526         {.fn = sctp_sf_not_impl, .name = "sctp_sf_not_impl"}, \
527         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
528         {.fn = sctp_sf_not_impl, .name = "sctp_sf_not_impl"}, \
529         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
530         {.fn = sctp_sf_not_impl, .name = "sctp_sf_not_impl"}, \
531 } /* TYPE_SCTP_PRIMITIVE_ASSOCIATE */
532 
533 #define TYPE_SCTP_PRIMITIVE_SHUTDOWN  { \
534         /* SCTP_STATE_EMPTY */ \
535         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
536         /* SCTP_STATE_CLOSED */ \
537         {.fn = sctp_sf_error_closed, .name = "sctp_sf_error_closed"}, \
538         /* SCTP_STATE_COOKIE_WAIT */ \
539         {.fn = sctp_sf_cookie_wait_prm_shutdown, \
540          .name = "sctp_sf_cookie_wait_prm_shutdown"}, \
541         /* SCTP_STATE_COOKIE_ECHOED */ \
542         {.fn = sctp_sf_cookie_echoed_prm_shutdown, \
543          .name = "sctp_sf_cookie_echoed_prm_shutdown"},\
544         /* SCTP_STATE_ESTABLISHED */ \
545         {.fn = sctp_sf_do_9_2_prm_shutdown, \
546          .name = "sctp_sf_do_9_2_prm_shutdown"}, \
547         /* SCTP_STATE_SHUTDOWN_PENDING */ \
548         {.fn = sctp_sf_ignore_primitive, .name = "sctp_sf_ignore_primitive"}, \
549         /* SCTP_STATE_SHUTDOWN_SENT */ \
550         {.fn = sctp_sf_ignore_primitive, .name = "sctp_sf_ignore_primitive"}, \
551         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
552         {.fn = sctp_sf_ignore_primitive, .name = "sctp_sf_ignore_primitive"}, \
553         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
554         {.fn = sctp_sf_ignore_primitive, .name = "sctp_sf_ignore_primitive"}, \
555 } /* TYPE_SCTP_PRIMITIVE_SHUTDOWN */
556 
557 #define TYPE_SCTP_PRIMITIVE_ABORT  { \
558         /* SCTP_STATE_EMPTY */ \
559         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
560         /* SCTP_STATE_CLOSED */ \
561         {.fn = sctp_sf_error_closed, .name = "sctp_sf_error_closed"}, \
562         /* SCTP_STATE_COOKIE_WAIT */ \
563         {.fn = sctp_sf_cookie_wait_prm_abort, \
564         .name = "sctp_sf_cookie_wait_prm_abort"}, \
565         /* SCTP_STATE_COOKIE_ECHOED */ \
566         {.fn = sctp_sf_cookie_echoed_prm_abort, \
567         .name = "sctp_sf_cookie_echoed_prm_abort"}, \
568         /* SCTP_STATE_ESTABLISHED */ \
569         {.fn = sctp_sf_do_9_1_prm_abort, \
570         .name = "sctp_sf_do_9_1_prm_abort"}, \
571         /* SCTP_STATE_SHUTDOWN_PENDING */ \
572         {.fn = sctp_sf_shutdown_pending_prm_abort, \
573         .name = "sctp_sf_shutdown_pending_prm_abort"}, \
574         /* SCTP_STATE_SHUTDOWN_SENT */ \
575         {.fn = sctp_sf_shutdown_sent_prm_abort, \
576         .name = "sctp_sf_shutdown_sent_prm_abort"}, \
577         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
578         {.fn = sctp_sf_do_9_1_prm_abort, \
579         .name = "sctp_sf_do_9_1_prm_abort"}, \
580         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
581         {.fn = sctp_sf_shutdown_ack_sent_prm_abort, \
582         .name = "sctp_sf_shutdown_ack_sent_prm_abort"}, \
583 } /* TYPE_SCTP_PRIMITIVE_ABORT */
584 
585 #define TYPE_SCTP_PRIMITIVE_SEND  { \
586         /* SCTP_STATE_EMPTY */ \
587         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
588         /* SCTP_STATE_CLOSED */ \
589         {.fn = sctp_sf_error_closed, .name = "sctp_sf_error_closed"}, \
590         /* SCTP_STATE_COOKIE_WAIT */ \
591         {.fn = sctp_sf_do_prm_send, .name = "sctp_sf_do_prm_send"}, \
592         /* SCTP_STATE_COOKIE_ECHOED */ \
593         {.fn = sctp_sf_do_prm_send, .name = "sctp_sf_do_prm_send"}, \
594         /* SCTP_STATE_ESTABLISHED */ \
595         {.fn = sctp_sf_do_prm_send, .name = "sctp_sf_do_prm_send"}, \
596         /* SCTP_STATE_SHUTDOWN_PENDING */ \
597         {.fn = sctp_sf_error_shutdown, .name = "sctp_sf_error_shutdown"}, \
598         /* SCTP_STATE_SHUTDOWN_SENT */ \
599         {.fn = sctp_sf_error_shutdown, .name = "sctp_sf_error_shutdown"}, \
600         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
601         {.fn = sctp_sf_error_shutdown, .name = "sctp_sf_error_shutdown"}, \
602         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
603         {.fn = sctp_sf_error_shutdown, .name = "sctp_sf_error_shutdown"}, \
604 } /* TYPE_SCTP_PRIMITIVE_SEND */
605 
606 #define TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT  { \
607         /* SCTP_STATE_EMPTY */ \
608         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
609         /* SCTP_STATE_CLOSED */ \
610         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
611         /* SCTP_STATE_COOKIE_WAIT */ \
612         {.fn = sctp_sf_do_prm_requestheartbeat,               \
613          .name = "sctp_sf_do_prm_requestheartbeat"},          \
614         /* SCTP_STATE_COOKIE_ECHOED */ \
615         {.fn = sctp_sf_do_prm_requestheartbeat,               \
616          .name = "sctp_sf_do_prm_requestheartbeat"},          \
617         /* SCTP_STATE_ESTABLISHED */ \
618         {.fn = sctp_sf_do_prm_requestheartbeat,               \
619          .name = "sctp_sf_do_prm_requestheartbeat"},          \
620         /* SCTP_STATE_SHUTDOWN_PENDING */ \
621         {.fn = sctp_sf_do_prm_requestheartbeat,               \
622          .name = "sctp_sf_do_prm_requestheartbeat"},          \
623         /* SCTP_STATE_SHUTDOWN_SENT */ \
624         {.fn = sctp_sf_do_prm_requestheartbeat,               \
625          .name = "sctp_sf_do_prm_requestheartbeat"},          \
626         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
627         {.fn = sctp_sf_do_prm_requestheartbeat,               \
628          .name = "sctp_sf_do_prm_requestheartbeat"},          \
629         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
630         {.fn = sctp_sf_do_prm_requestheartbeat,               \
631          .name = "sctp_sf_do_prm_requestheartbeat"},          \
632 } /* TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT */
633 
634 #define TYPE_SCTP_PRIMITIVE_ASCONF { \
635         /* SCTP_STATE_EMPTY */ \
636         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
637         /* SCTP_STATE_CLOSED */ \
638         {.fn = sctp_sf_error_closed, .name = "sctp_sf_error_closed"}, \
639         /* SCTP_STATE_COOKIE_WAIT */ \
640         {.fn = sctp_sf_error_closed, .name = "sctp_sf_error_closed"}, \
641         /* SCTP_STATE_COOKIE_ECHOED */ \
642         {.fn = sctp_sf_error_closed, .name = "sctp_sf_error_closed"}, \
643         /* SCTP_STATE_ESTABLISHED */ \
644         {.fn = sctp_sf_do_prm_asconf, .name = "sctp_sf_do_prm_asconf"}, \
645         /* SCTP_STATE_SHUTDOWN_PENDING */ \
646         {.fn = sctp_sf_error_shutdown, .name = "sctp_sf_error_shutdown"}, \
647         /* SCTP_STATE_SHUTDOWN_SENT */ \
648         {.fn = sctp_sf_error_shutdown, .name = "sctp_sf_error_shutdown"}, \
649         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
650         {.fn = sctp_sf_error_shutdown, .name = "sctp_sf_error_shutdown"}, \
651         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
652         {.fn = sctp_sf_error_shutdown, .name = "sctp_sf_error_shutdown"}, \
653 } /* TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT */
654 
655 /* The primary index for this table is the primitive type.
656  * The secondary index for this table is the state.
657  */
658 const sctp_sm_table_entry_t primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES] = {
659         TYPE_SCTP_PRIMITIVE_ASSOCIATE,
660         TYPE_SCTP_PRIMITIVE_SHUTDOWN,
661         TYPE_SCTP_PRIMITIVE_ABORT,
662         TYPE_SCTP_PRIMITIVE_SEND,
663         TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT,
664         TYPE_SCTP_PRIMITIVE_ASCONF,
665 };
666 
667 #define TYPE_SCTP_OTHER_NO_PENDING_TSN  { \
668         /* SCTP_STATE_EMPTY */ \
669         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
670         /* SCTP_STATE_CLOSED */ \
671         {.fn = sctp_sf_ignore_other, .name = "sctp_sf_ignore_other"}, \
672         /* SCTP_STATE_COOKIE_WAIT */ \
673         {.fn = sctp_sf_ignore_other, .name = "sctp_sf_ignore_other"}, \
674         /* SCTP_STATE_COOKIE_ECHOED */ \
675         {.fn = sctp_sf_ignore_other, .name = "sctp_sf_ignore_other"}, \
676         /* SCTP_STATE_ESTABLISHED */ \
677         {.fn = sctp_sf_ignore_other, .name = "sctp_sf_ignore_other"}, \
678         /* SCTP_STATE_SHUTDOWN_PENDING */ \
679         {.fn = sctp_sf_do_9_2_start_shutdown, \
680          .name = "sctp_do_9_2_start_shutdown"}, \
681         /* SCTP_STATE_SHUTDOWN_SENT */ \
682         {.fn = sctp_sf_ignore_other, .name = "sctp_sf_ignore_other"}, \
683         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
684         {.fn = sctp_sf_do_9_2_shutdown_ack, \
685          .name = "sctp_sf_do_9_2_shutdown_ack"}, \
686         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
687         {.fn = sctp_sf_ignore_other, .name = "sctp_sf_ignore_other"}, \
688 }
689 
690 const sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES] = {
691         TYPE_SCTP_OTHER_NO_PENDING_TSN,
692 };
693 
694 #define TYPE_SCTP_EVENT_TIMEOUT_NONE { \
695         /* SCTP_STATE_EMPTY */ \
696         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
697         /* SCTP_STATE_CLOSED */ \
698         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
699         /* SCTP_STATE_COOKIE_WAIT */ \
700         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
701         /* SCTP_STATE_COOKIE_ECHOED */ \
702         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
703         /* SCTP_STATE_ESTABLISHED */ \
704         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
705         /* SCTP_STATE_SHUTDOWN_PENDING */ \
706         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
707         /* SCTP_STATE_SHUTDOWN_SENT */ \
708         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
709         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
710         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
711         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
712         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
713 }
714 
715 #define TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE { \
716         /* SCTP_STATE_EMPTY */ \
717         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
718         /* SCTP_STATE_CLOSED */ \
719         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
720         /* SCTP_STATE_COOKIE_WAIT */ \
721         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
722         /* SCTP_STATE_COOKIE_ECHOED */ \
723         {.fn = sctp_sf_t1_timer_expire, .name = "sctp_sf_t1_timer_expire"}, \
724         /* SCTP_STATE_ESTABLISHED */ \
725         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
726         /* SCTP_STATE_SHUTDOWN_PENDING */ \
727         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
728         /* SCTP_STATE_SHUTDOWN_SENT */ \
729         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
730         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
731         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
732         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
733         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
734 }
735 
736 #define TYPE_SCTP_EVENT_TIMEOUT_T1_INIT { \
737         /* SCTP_STATE_EMPTY */ \
738         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
739         /* SCTP_STATE_CLOSED */ \
740         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
741         /* SCTP_STATE_COOKIE_WAIT */ \
742         {.fn = sctp_sf_t1_timer_expire, .name = "sctp_sf_t1_timer_expire"}, \
743         /* SCTP_STATE_COOKIE_ECHOED */ \
744         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
745         /* SCTP_STATE_ESTABLISHED */ \
746         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
747         /* SCTP_STATE_SHUTDOWN_PENDING */ \
748         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
749         /* SCTP_STATE_SHUTDOWN_SENT */ \
750         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
751         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
752         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
753         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
754         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
755 }
756 
757 #define TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN { \
758         /* SCTP_STATE_EMPTY */ \
759         {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
760         /* SCTP_STATE_CLOSED */ \
761         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
762         /* SCTP_STATE_COOKIE_WAIT */ \
763         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
764         /* SCTP_STATE_COOKIE_ECHOED */ \
765         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
766         /* SCTP_STATE_ESTABLISHED */ \
767         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
768         /* SCTP_STATE_SHUTDOWN_PENDING */ \
769         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
770         /* SCTP_STATE_SHUTDOWN_SENT */ \
771         {.fn = sctp_sf_t2_timer_expire, .name = "sctp_sf_t2_timer_expire"}, \
772         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
773         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
774         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
775         {.fn = sctp_sf_t2_timer_expire, .name = "sctp_sf_t2_timer_expire"}, \
776 }
777 
778 #define TYPE_SCTP_EVENT_TIMEOUT_T3_RTX { \
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_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
785         /* SCTP_STATE_COOKIE_ECHOED */ \
786         {.fn = sctp_sf_do_6_3_3_rtx, .name = "sctp_sf_do_6_3_3_rtx"}, \
787         /* SCTP_STATE_ESTABLISHED */ \
788         {.fn = sctp_sf_do_6_3_3_rtx, .name = "sctp_sf_do_6_3_3_rtx"}, \
789         /* SCTP_STATE_SHUTDOWN_PENDING */ \
790         {.fn = sctp_sf_do_6_3_3_rtx, .name = "sctp_sf_do_6_3_3_rtx"}, \
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_do_6_3_3_rtx, .name = "sctp_sf_do_6_3_3_rtx"}, \
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_T4_RTO { \
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_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
806         /* SCTP_STATE_COOKIE_ECHOED */ \
807         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
808         /* SCTP_STATE_ESTABLISHED */ \
809         {.fn = sctp_sf_t4_timer_expire, .name = "sctp_sf_t4_timer_expire"}, \
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_T5_SHUTDOWN_GUARD { \
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_t5_timer_expire, .name = "sctp_sf_t5_timer_expire"}, \
833         /* SCTP_STATE_SHUTDOWN_SENT */ \
834         {.fn = sctp_sf_t5_timer_expire, .name = "sctp_sf_t5_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_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
839 }
840 
841 #define TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT { \
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_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
850         /* SCTP_STATE_ESTABLISHED */ \
851         {.fn = sctp_sf_sendbeat_8_3, .name = "sctp_sf_sendbeat_8_3"}, \
852         /* SCTP_STATE_SHUTDOWN_PENDING */ \
853         {.fn = sctp_sf_sendbeat_8_3, .name = "sctp_sf_sendbeat_8_3"}, \
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_sendbeat_8_3, .name = "sctp_sf_sendbeat_8_3"}, \
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_SACK { \
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_do_6_2_sack, .name = "sctp_sf_do_6_2_sack"}, \
873         /* SCTP_STATE_SHUTDOWN_PENDING */ \
874         {.fn = sctp_sf_do_6_2_sack, .name = "sctp_sf_do_6_2_sack"}, \
875         /* SCTP_STATE_SHUTDOWN_SENT */ \
876         {.fn = sctp_sf_do_6_2_sack, .name = "sctp_sf_do_6_2_sack"}, \
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_AUTOCLOSE { \
884         /* SCTP_STATE_EMPTY */ \
885         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
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_autoclose_timer_expire, \
894          .name = "sctp_sf_autoclose_timer_expire"}, \
895         /* SCTP_STATE_SHUTDOWN_PENDING */ \
896         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
897         /* SCTP_STATE_SHUTDOWN_SENT */ \
898         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
899         /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
900         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
901         /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
902         {.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
903 }
904 
905 const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES] = {
906         TYPE_SCTP_EVENT_TIMEOUT_NONE,
907         TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE,
908         TYPE_SCTP_EVENT_TIMEOUT_T1_INIT,
909         TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN,
910         TYPE_SCTP_EVENT_TIMEOUT_T3_RTX,
911         TYPE_SCTP_EVENT_TIMEOUT_T4_RTO,
912         TYPE_SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD,
913         TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT,
914         TYPE_SCTP_EVENT_TIMEOUT_SACK,
915         TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE,
916 };
917 
918 const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid, 
919                                                      sctp_state_t state)
920 {
921         if (state > SCTP_STATE_MAX)
922                 return &bug;
923 
924         if (cid >= 0 && cid <= SCTP_CID_BASE_MAX) {
925                 return &chunk_event_table[cid][state];
926         }
927 
928         if (cid >= SCTP_CID_ADDIP_MIN && cid <= SCTP_CID_ADDIP_MAX) {
929                 return &addip_chunk_event_table
930                         [cid - SCTP_CID_ADDIP_MIN][state];
931         }
932 
933         return &chunk_event_table_unknown[state];
934 }
935 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp