blob: 5f6cc7aa661bd0371d1394d23610c6be780a6644 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* 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
53static const sctp_sm_table_entry_t
54primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES];
55static const sctp_sm_table_entry_t
56other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES];
57static const sctp_sm_table_entry_t
58timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES];
59
60static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid,
61 sctp_state_t state);
62
63
64static 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
79const 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
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800107#define TYPE_SCTP_FUNC(func) {.fn = func, .name = #func}
108
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109#define TYPE_SCTP_DATA { \
110 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800111 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800113 TYPE_SCTP_FUNC(sctp_sf_tabort_8_4_8), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800115 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800117 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800119 TYPE_SCTP_FUNC(sctp_sf_eat_data_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800121 TYPE_SCTP_FUNC(sctp_sf_eat_data_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800123 TYPE_SCTP_FUNC(sctp_sf_eat_data_fast_4_4), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800125 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800127 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128} /* TYPE_SCTP_DATA */
129
130#define TYPE_SCTP_INIT { \
131 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800132 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800134 TYPE_SCTP_FUNC(sctp_sf_do_5_1B_init), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800136 TYPE_SCTP_FUNC(sctp_sf_do_5_2_1_siminit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800138 TYPE_SCTP_FUNC(sctp_sf_do_5_2_1_siminit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800140 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800142 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800144 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800146 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800148 TYPE_SCTP_FUNC(sctp_sf_do_9_2_reshutack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149} /* TYPE_SCTP_INIT */
150
151#define TYPE_SCTP_INIT_ACK { \
152 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800153 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 /* SCTP_STATE_CLOSED */ \
Vlad Yasevich610ab732007-01-15 19:18:30 -0800155 TYPE_SCTP_FUNC(sctp_sf_do_5_2_3_initack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800157 TYPE_SCTP_FUNC(sctp_sf_do_5_1C_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800159 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800161 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800163 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800165 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800167 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800169 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170} /* TYPE_SCTP_INIT_ACK */
171
172#define TYPE_SCTP_SACK { \
173 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800174 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800176 TYPE_SCTP_FUNC(sctp_sf_tabort_8_4_8), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800178 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800180 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800182 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800184 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800186 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800188 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800190 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191} /* TYPE_SCTP_SACK */
192
193#define TYPE_SCTP_HEARTBEAT { \
194 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800195 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800197 TYPE_SCTP_FUNC(sctp_sf_tabort_8_4_8), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800199 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800201 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800203 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800205 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800207 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800209 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
211 /* This should not happen, but we are nice. */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800212 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213} /* TYPE_SCTP_HEARTBEAT */
214
215#define TYPE_SCTP_HEARTBEAT_ACK { \
216 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800217 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800219 TYPE_SCTP_FUNC(sctp_sf_tabort_8_4_8), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800221 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800223 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800225 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800227 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800229 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800231 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800233 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234} /* TYPE_SCTP_HEARTBEAT_ACK */
235
236#define TYPE_SCTP_ABORT { \
237 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800238 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800240 TYPE_SCTP_FUNC(sctp_sf_pdiscard), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800242 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800244 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800246 TYPE_SCTP_FUNC(sctp_sf_do_9_1_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800248 TYPE_SCTP_FUNC(sctp_sf_shutdown_pending_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800250 TYPE_SCTP_FUNC(sctp_sf_shutdown_sent_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800252 TYPE_SCTP_FUNC(sctp_sf_do_9_1_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800254 TYPE_SCTP_FUNC(sctp_sf_shutdown_ack_sent_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255} /* TYPE_SCTP_ABORT */
256
257#define TYPE_SCTP_SHUTDOWN { \
258 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800259 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800261 TYPE_SCTP_FUNC(sctp_sf_tabort_8_4_8), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800263 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800265 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800267 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800269 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800271 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800273 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800275 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276} /* TYPE_SCTP_SHUTDOWN */
277
278#define TYPE_SCTP_SHUTDOWN_ACK { \
279 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800280 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800282 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800284 TYPE_SCTP_FUNC(sctp_sf_do_8_5_1_E_sa), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800286 TYPE_SCTP_FUNC(sctp_sf_do_8_5_1_E_sa), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800288 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800290 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800292 TYPE_SCTP_FUNC(sctp_sf_do_9_2_final), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800294 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800296 TYPE_SCTP_FUNC(sctp_sf_do_9_2_final), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297} /* TYPE_SCTP_SHUTDOWN_ACK */
298
299#define TYPE_SCTP_ERROR { \
300 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800301 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800303 TYPE_SCTP_FUNC(sctp_sf_tabort_8_4_8), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800305 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800307 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_err), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800309 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800311 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800313 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800315 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800317 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318} /* TYPE_SCTP_ERROR */
319
320#define TYPE_SCTP_COOKIE_ECHO { \
321 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800322 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700323 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800324 TYPE_SCTP_FUNC(sctp_sf_do_5_1D_ce), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700325 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800326 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800328 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800330 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800332 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700333 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800334 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800336 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800338 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700339} /* TYPE_SCTP_COOKIE_ECHO */
340
341#define TYPE_SCTP_COOKIE_ACK { \
342 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800343 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800345 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800347 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800349 TYPE_SCTP_FUNC(sctp_sf_do_5_1E_ca), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800351 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800353 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800355 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800357 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800359 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360} /* TYPE_SCTP_COOKIE_ACK */
361
362#define TYPE_SCTP_ECN_ECNE { \
363 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800364 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800366 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800368 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800370 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800372 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800374 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800376 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800378 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800380 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700381} /* TYPE_SCTP_ECN_ECNE */
382
383#define TYPE_SCTP_ECN_CWR { \
384 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800385 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800387 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800389 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800391 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700392 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800393 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700394 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800395 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800397 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700398 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800399 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800401 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402} /* TYPE_SCTP_ECN_CWR */
403
404#define TYPE_SCTP_SHUTDOWN_COMPLETE { \
405 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800406 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800408 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800410 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800412 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800414 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800416 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800418 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700419 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800420 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800422 TYPE_SCTP_FUNC(sctp_sf_do_4_C), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423} /* TYPE_SCTP_SHUTDOWN_COMPLETE */
424
425/* The primary index for this table is the chunk type.
426 * The secondary index for this table is the state.
427 *
428 * For base protocol (RFC 2960).
429 */
430static const sctp_sm_table_entry_t chunk_event_table[SCTP_NUM_BASE_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
431 TYPE_SCTP_DATA,
432 TYPE_SCTP_INIT,
433 TYPE_SCTP_INIT_ACK,
434 TYPE_SCTP_SACK,
435 TYPE_SCTP_HEARTBEAT,
436 TYPE_SCTP_HEARTBEAT_ACK,
437 TYPE_SCTP_ABORT,
438 TYPE_SCTP_SHUTDOWN,
439 TYPE_SCTP_SHUTDOWN_ACK,
440 TYPE_SCTP_ERROR,
441 TYPE_SCTP_COOKIE_ECHO,
442 TYPE_SCTP_COOKIE_ACK,
443 TYPE_SCTP_ECN_ECNE,
444 TYPE_SCTP_ECN_CWR,
445 TYPE_SCTP_SHUTDOWN_COMPLETE,
446}; /* state_fn_t chunk_event_table[][] */
447
448#define TYPE_SCTP_ASCONF { \
449 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800450 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800452 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700453 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800454 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800456 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800458 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800460 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800462 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800464 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800466 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467} /* TYPE_SCTP_ASCONF */
468
469#define TYPE_SCTP_ASCONF_ACK { \
470 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800471 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800473 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700474 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800475 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800477 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700478 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800479 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800481 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700482 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800483 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700484 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800485 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800487 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488} /* TYPE_SCTP_ASCONF_ACK */
489
490/* The primary index for this table is the chunk type.
491 * The secondary index for this table is the state.
492 */
493static const sctp_sm_table_entry_t addip_chunk_event_table[SCTP_NUM_ADDIP_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
494 TYPE_SCTP_ASCONF,
495 TYPE_SCTP_ASCONF_ACK,
496}; /*state_fn_t addip_chunk_event_table[][] */
497
498#define TYPE_SCTP_FWD_TSN { \
499 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800500 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800502 TYPE_SCTP_FUNC(sctp_sf_tabort_8_4_8), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700503 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800504 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700505 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800506 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800508 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800510 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700511 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800512 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn_fast), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800514 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800516 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517} /* TYPE_SCTP_FWD_TSN */
518
519/* The primary index for this table is the chunk type.
520 * The secondary index for this table is the state.
521 */
522static const sctp_sm_table_entry_t prsctp_chunk_event_table[SCTP_NUM_PRSCTP_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
523 TYPE_SCTP_FWD_TSN,
524}; /*state_fn_t prsctp_chunk_event_table[][] */
525
526static const sctp_sm_table_entry_t
527chunk_event_table_unknown[SCTP_STATE_NUM_STATES] = {
528 /* SCTP_STATE_EMPTY */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800529 TYPE_SCTP_FUNC(sctp_sf_ootb),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700530 /* SCTP_STATE_CLOSED */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800531 TYPE_SCTP_FUNC(sctp_sf_tabort_8_4_8),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700532 /* SCTP_STATE_COOKIE_WAIT */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800533 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700534 /* SCTP_STATE_COOKIE_ECHOED */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800535 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536 /* SCTP_STATE_ESTABLISHED */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800537 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538 /* SCTP_STATE_SHUTDOWN_PENDING */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800539 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540 /* SCTP_STATE_SHUTDOWN_SENT */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800541 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 /* SCTP_STATE_SHUTDOWN_RECEIVED */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800543 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 /* SCTP_STATE_SHUTDOWN_ACK_SENT */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800545 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700546}; /* chunk unknown */
547
548
549#define TYPE_SCTP_PRIMITIVE_ASSOCIATE { \
550 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800551 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800553 TYPE_SCTP_FUNC(sctp_sf_do_prm_asoc), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700554 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800555 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700556 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800557 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800559 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700560 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800561 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700562 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800563 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800565 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700566 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800567 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568} /* TYPE_SCTP_PRIMITIVE_ASSOCIATE */
569
570#define TYPE_SCTP_PRIMITIVE_SHUTDOWN { \
571 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800572 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700573 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800574 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800576 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_prm_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800578 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_prm_shutdown),\
Linus Torvalds1da177e2005-04-16 15:20:36 -0700579 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800580 TYPE_SCTP_FUNC(sctp_sf_do_9_2_prm_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800582 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800584 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800586 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700587 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800588 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700589} /* TYPE_SCTP_PRIMITIVE_SHUTDOWN */
590
591#define TYPE_SCTP_PRIMITIVE_ABORT { \
592 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800593 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800595 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700596 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800597 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700598 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800599 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800601 TYPE_SCTP_FUNC(sctp_sf_do_9_1_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800603 TYPE_SCTP_FUNC(sctp_sf_shutdown_pending_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700604 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800605 TYPE_SCTP_FUNC(sctp_sf_shutdown_sent_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700606 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800607 TYPE_SCTP_FUNC(sctp_sf_do_9_1_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800609 TYPE_SCTP_FUNC(sctp_sf_shutdown_ack_sent_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610} /* TYPE_SCTP_PRIMITIVE_ABORT */
611
612#define TYPE_SCTP_PRIMITIVE_SEND { \
613 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800614 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800616 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700617 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800618 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700619 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800620 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800622 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700623 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800624 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700625 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800626 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700627 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800628 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800630 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700631} /* TYPE_SCTP_PRIMITIVE_SEND */
632
633#define TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT { \
634 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800635 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700636 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800637 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700638 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800639 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700640 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800641 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800643 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700644 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800645 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700646 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800647 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800649 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700650 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800651 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652} /* TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT */
653
654#define TYPE_SCTP_PRIMITIVE_ASCONF { \
655 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800656 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700657 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800658 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700659 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800660 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700661 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800662 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800664 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700665 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800666 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700667 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800668 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800670 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700671 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800672 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673} /* TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT */
674
675/* The primary index for this table is the primitive type.
676 * The secondary index for this table is the state.
677 */
678static const sctp_sm_table_entry_t primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES] = {
679 TYPE_SCTP_PRIMITIVE_ASSOCIATE,
680 TYPE_SCTP_PRIMITIVE_SHUTDOWN,
681 TYPE_SCTP_PRIMITIVE_ABORT,
682 TYPE_SCTP_PRIMITIVE_SEND,
683 TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT,
684 TYPE_SCTP_PRIMITIVE_ASCONF,
685};
686
687#define TYPE_SCTP_OTHER_NO_PENDING_TSN { \
688 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800689 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700690 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800691 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800693 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800695 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700696 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800697 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700698 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800699 TYPE_SCTP_FUNC(sctp_sf_do_9_2_start_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700700 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800701 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800703 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700704 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800705 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706}
707
708#define TYPE_SCTP_OTHER_ICMP_PROTO_UNREACH { \
709 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800710 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800712 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700713 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800714 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_icmp_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800716 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700717 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800718 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700719 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800720 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700721 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800722 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700723 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800724 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700725 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800726 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727}
728
729static const sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES] = {
730 TYPE_SCTP_OTHER_NO_PENDING_TSN,
731 TYPE_SCTP_OTHER_ICMP_PROTO_UNREACH,
732};
733
734#define TYPE_SCTP_EVENT_TIMEOUT_NONE { \
735 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800736 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700737 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800738 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700739 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800740 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700741 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800742 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700743 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800744 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700745 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800746 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700747 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800748 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700749 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800750 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700751 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800752 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700753}
754
755#define TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE { \
756 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800757 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700758 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800759 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700760 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800761 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700762 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800763 TYPE_SCTP_FUNC(sctp_sf_t1_cookie_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700764 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800765 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700766 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800767 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800769 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700770 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800771 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700772 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800773 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700774}
775
776#define TYPE_SCTP_EVENT_TIMEOUT_T1_INIT { \
777 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800778 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800780 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700781 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800782 TYPE_SCTP_FUNC(sctp_sf_t1_init_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700783 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800784 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700785 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800786 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800788 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800790 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700791 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800792 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700793 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800794 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795}
796
797#define TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN { \
798 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800799 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700800 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800801 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800803 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700804 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800805 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700806 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800807 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700808 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800809 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700810 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800811 TYPE_SCTP_FUNC(sctp_sf_t2_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800813 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700814 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800815 TYPE_SCTP_FUNC(sctp_sf_t2_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700816}
817
818#define TYPE_SCTP_EVENT_TIMEOUT_T3_RTX { \
819 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800820 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700821 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800822 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700823 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800824 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700825 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800826 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700827 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800828 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700829 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800830 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700831 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800832 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700833 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800834 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800836 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837}
838
839#define TYPE_SCTP_EVENT_TIMEOUT_T4_RTO { \
840 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800841 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700842 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800843 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800845 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700846 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800847 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700848 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800849 TYPE_SCTP_FUNC(sctp_sf_t4_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700850 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800851 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700852 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800853 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700854 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800855 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700856 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800857 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700858}
859
860#define TYPE_SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD { \
861 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800862 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700863 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800864 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700865 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800866 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700867 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800868 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700869 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800870 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700871 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800872 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700873 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800874 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700875 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800876 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700877 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800878 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700879}
880
881#define TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT { \
882 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800883 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700884 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800885 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700886 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800887 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700888 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800889 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700890 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800891 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700892 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800893 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700894 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800895 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700896 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800897 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700898 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800899 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700900}
901
902#define TYPE_SCTP_EVENT_TIMEOUT_SACK { \
903 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800904 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700905 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800906 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700907 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800908 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700909 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800910 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700911 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800912 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700913 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800914 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700915 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800916 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700917 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800918 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700919 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800920 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700921}
922
923#define TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE { \
924 /* SCTP_STATE_EMPTY */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800925 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700926 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800927 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700928 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800929 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700930 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800931 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700932 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800933 TYPE_SCTP_FUNC(sctp_sf_autoclose_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700934 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800935 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700936 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800937 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700938 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800939 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700940 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800941 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700942}
943
944static const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES] = {
945 TYPE_SCTP_EVENT_TIMEOUT_NONE,
946 TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE,
947 TYPE_SCTP_EVENT_TIMEOUT_T1_INIT,
948 TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN,
949 TYPE_SCTP_EVENT_TIMEOUT_T3_RTX,
950 TYPE_SCTP_EVENT_TIMEOUT_T4_RTO,
951 TYPE_SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD,
952 TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT,
953 TYPE_SCTP_EVENT_TIMEOUT_SACK,
954 TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE,
955};
956
957static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid,
958 sctp_state_t state)
959{
960 if (state > SCTP_STATE_MAX)
961 return &bug;
962
963 if (cid >= 0 && cid <= SCTP_CID_BASE_MAX)
964 return &chunk_event_table[cid][state];
965
966 if (sctp_prsctp_enable) {
967 if (cid == SCTP_CID_FWD_TSN)
968 return &prsctp_chunk_event_table[0][state];
969 }
970
971 if (sctp_addip_enable) {
972 if (cid == SCTP_CID_ASCONF)
973 return &addip_chunk_event_table[0][state];
974
975 if (cid == SCTP_CID_ASCONF_ACK)
976 return &addip_chunk_event_table[1][state];
977 }
978
979 return &chunk_event_table_unknown[state];
980}