blob: a987d54b379c5c57513ef2f0fac046c8cae2bf75 [file] [log] [blame]
Vlad Yasevich60c778b2008-01-11 09:57:09 -05001/* SCTP kernel implementation
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * (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 *
Vlad Yasevich60c778b2008-01-11 09:57:09 -05008 * This file is part of the SCTP kernel implementation
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 *
10 * These are the state tables for the SCTP state machine.
11 *
Vlad Yasevich60c778b2008-01-11 09:57:09 -050012 * This SCTP implementation is free software;
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 * 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 *
Vlad Yasevich60c778b2008-01-11 09:57:09 -050018 * This SCTP implementation is distributed in the hope that it
Linus Torvalds1da177e2005-04-16 15:20:36 -070019 * 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
Jeff Kirsher4b2f13a2013-12-06 06:28:48 -080025 * along with GNU CC; see the file COPYING. If not, see
26 * <http://www.gnu.org/licenses/>.
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 *
28 * Please send any bug reports or fixes you make to the
29 * email address(es):
Daniel Borkmann91705c62013-07-23 14:51:47 +020030 * lksctp developers <linux-sctp@vger.kernel.org>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 * Written or modified by:
33 * La Monte H.P. Yarroll <piggy@acm.org>
34 * Karl Knutson <karl@athena.chicago.il.us>
35 * Jon Grimm <jgrimm@us.ibm.com>
36 * Hui Huang <hui.huang@nokia.com>
37 * Daisy Chang <daisyc@us.ibm.com>
38 * Ardelle Fan <ardelle.fan@intel.com>
39 * Sridhar Samudrala <sri@us.ibm.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 */
41
Joe Perches145ce502010-08-24 13:21:08 +000042#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
43
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#include <linux/skbuff.h>
45#include <net/sctp/sctp.h>
46#include <net/sctp/sm.h>
47
48static const sctp_sm_table_entry_t
49primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES];
50static const sctp_sm_table_entry_t
51other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES];
52static const sctp_sm_table_entry_t
53timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES];
54
Eric W. Biederman55e26eb2012-08-07 07:25:24 +000055static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
56 sctp_cid_t cid,
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 sctp_state_t state);
58
59
60static const sctp_sm_table_entry_t bug = {
61 .fn = sctp_sf_bug,
62 .name = "sctp_sf_bug"
63};
64
Joe Perches145ce502010-08-24 13:21:08 +000065#define DO_LOOKUP(_max, _type, _table) \
66({ \
67 const sctp_sm_table_entry_t *rtn; \
68 \
69 if ((event_subtype._type > (_max))) { \
70 pr_warn("table %p possible attack: event %d exceeds max %d\n", \
71 _table, event_subtype._type, _max); \
wangweidongf7010e62013-12-23 12:16:52 +080072 rtn = &bug; \
Joe Perches145ce502010-08-24 13:21:08 +000073 } else \
74 rtn = &_table[event_subtype._type][(int)state]; \
75 \
76 rtn; \
77})
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
Eric W. Biederman55e26eb2012-08-07 07:25:24 +000079const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *net,
80 sctp_event_t event_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 sctp_state_t state,
82 sctp_subtype_t event_subtype)
83{
84 switch (event_type) {
85 case SCTP_EVENT_T_CHUNK:
Eric W. Biederman55e26eb2012-08-07 07:25:24 +000086 return sctp_chunk_event_lookup(net, event_subtype.chunk, state);
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 case SCTP_EVENT_T_TIMEOUT:
Joe Perches145ce502010-08-24 13:21:08 +000088 return DO_LOOKUP(SCTP_EVENT_TIMEOUT_MAX, timeout,
89 timeout_event_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -070090 case SCTP_EVENT_T_OTHER:
Joe Perches145ce502010-08-24 13:21:08 +000091 return DO_LOOKUP(SCTP_EVENT_OTHER_MAX, other,
92 other_event_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 case SCTP_EVENT_T_PRIMITIVE:
Joe Perches145ce502010-08-24 13:21:08 +000094 return DO_LOOKUP(SCTP_EVENT_PRIMITIVE_MAX, primitive,
95 primitive_event_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -070096 default:
97 /* Yikes! We got an illegal event type. */
98 return &bug;
Stephen Hemminger3ff50b72007-04-20 17:09:22 -070099 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100}
101
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800102#define TYPE_SCTP_FUNC(func) {.fn = func, .name = #func}
103
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104#define TYPE_SCTP_DATA { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400106 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800108 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800110 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800112 TYPE_SCTP_FUNC(sctp_sf_eat_data_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800114 TYPE_SCTP_FUNC(sctp_sf_eat_data_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800116 TYPE_SCTP_FUNC(sctp_sf_eat_data_fast_4_4), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800118 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800120 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121} /* TYPE_SCTP_DATA */
122
123#define TYPE_SCTP_INIT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800125 TYPE_SCTP_FUNC(sctp_sf_do_5_1B_init), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800127 TYPE_SCTP_FUNC(sctp_sf_do_5_2_1_siminit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800129 TYPE_SCTP_FUNC(sctp_sf_do_5_2_1_siminit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800131 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800133 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800135 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800137 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800139 TYPE_SCTP_FUNC(sctp_sf_do_9_2_reshutack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140} /* TYPE_SCTP_INIT */
141
142#define TYPE_SCTP_INIT_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 /* SCTP_STATE_CLOSED */ \
Vlad Yasevich610ab732007-01-15 19:18:30 -0800144 TYPE_SCTP_FUNC(sctp_sf_do_5_2_3_initack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800146 TYPE_SCTP_FUNC(sctp_sf_do_5_1C_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800148 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800150 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800152 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800154 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800156 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800158 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159} /* TYPE_SCTP_INIT_ACK */
160
161#define TYPE_SCTP_SACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400163 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164 /* SCTP_STATE_COOKIE_WAIT */ \
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_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800167 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800169 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800171 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800173 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800175 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800177 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178} /* TYPE_SCTP_SACK */
179
180#define TYPE_SCTP_HEARTBEAT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400182 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800184 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800186 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800188 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800190 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800192 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800194 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
196 /* This should not happen, but we are nice. */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800197 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198} /* TYPE_SCTP_HEARTBEAT */
199
200#define TYPE_SCTP_HEARTBEAT_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400202 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800204 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800206 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800208 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800210 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800212 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800214 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800216 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217} /* TYPE_SCTP_HEARTBEAT_ACK */
218
219#define TYPE_SCTP_ABORT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800221 TYPE_SCTP_FUNC(sctp_sf_pdiscard), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800223 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800225 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800227 TYPE_SCTP_FUNC(sctp_sf_do_9_1_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800229 TYPE_SCTP_FUNC(sctp_sf_shutdown_pending_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800231 TYPE_SCTP_FUNC(sctp_sf_shutdown_sent_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800233 TYPE_SCTP_FUNC(sctp_sf_do_9_1_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800235 TYPE_SCTP_FUNC(sctp_sf_shutdown_ack_sent_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236} /* TYPE_SCTP_ABORT */
237
238#define TYPE_SCTP_SHUTDOWN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400240 TYPE_SCTP_FUNC(sctp_sf_ootb), \
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_discard_chunk), \
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_discard_chunk), \
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_2_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Wei Yongjuncf896d52008-10-23 01:00:49 -0700248 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown), \
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_do_9_2_shutdown_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Wei Yongjun2e3f92d2008-10-23 01:01:18 -0700252 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shut_ctsn), \
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_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255} /* TYPE_SCTP_SHUTDOWN */
256
257#define TYPE_SCTP_SHUTDOWN_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800259 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800261 TYPE_SCTP_FUNC(sctp_sf_do_8_5_1_E_sa), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800263 TYPE_SCTP_FUNC(sctp_sf_do_8_5_1_E_sa), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800265 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800267 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800269 TYPE_SCTP_FUNC(sctp_sf_do_9_2_final), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800271 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800273 TYPE_SCTP_FUNC(sctp_sf_do_9_2_final), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274} /* TYPE_SCTP_SHUTDOWN_ACK */
275
276#define TYPE_SCTP_ERROR { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400278 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800280 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800282 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_err), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800284 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800286 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800288 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800290 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800292 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293} /* TYPE_SCTP_ERROR */
294
295#define TYPE_SCTP_COOKIE_ECHO { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800297 TYPE_SCTP_FUNC(sctp_sf_do_5_1D_ce), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800299 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800301 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800303 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800305 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800307 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800309 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800311 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312} /* TYPE_SCTP_COOKIE_ECHO */
313
314#define TYPE_SCTP_COOKIE_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800316 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800318 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800320 TYPE_SCTP_FUNC(sctp_sf_do_5_1E_ca), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800322 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700323 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800324 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700325 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800326 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800328 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800330 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331} /* TYPE_SCTP_COOKIE_ACK */
332
333#define TYPE_SCTP_ECN_ECNE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800335 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800337 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700338 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800339 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800341 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800343 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800345 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800347 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800349 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350} /* TYPE_SCTP_ECN_ECNE */
351
352#define TYPE_SCTP_ECN_CWR { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700353 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800354 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800356 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700357 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800358 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700359 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800360 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800362 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800364 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800368 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369} /* TYPE_SCTP_ECN_CWR */
370
371#define TYPE_SCTP_SHUTDOWN_COMPLETE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800373 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800375 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700376 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800377 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800379 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800381 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800383 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800385 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800387 TYPE_SCTP_FUNC(sctp_sf_do_4_C), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388} /* TYPE_SCTP_SHUTDOWN_COMPLETE */
389
390/* The primary index for this table is the chunk type.
391 * The secondary index for this table is the state.
392 *
393 * For base protocol (RFC 2960).
394 */
395static const sctp_sm_table_entry_t chunk_event_table[SCTP_NUM_BASE_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
396 TYPE_SCTP_DATA,
397 TYPE_SCTP_INIT,
398 TYPE_SCTP_INIT_ACK,
399 TYPE_SCTP_SACK,
400 TYPE_SCTP_HEARTBEAT,
401 TYPE_SCTP_HEARTBEAT_ACK,
402 TYPE_SCTP_ABORT,
403 TYPE_SCTP_SHUTDOWN,
404 TYPE_SCTP_SHUTDOWN_ACK,
405 TYPE_SCTP_ERROR,
406 TYPE_SCTP_COOKIE_ECHO,
407 TYPE_SCTP_COOKIE_ACK,
408 TYPE_SCTP_ECN_ECNE,
409 TYPE_SCTP_ECN_CWR,
410 TYPE_SCTP_SHUTDOWN_COMPLETE,
411}; /* state_fn_t chunk_event_table[][] */
412
413#define TYPE_SCTP_ASCONF { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800415 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800417 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800419 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800421 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800423 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 /* SCTP_STATE_SHUTDOWN_SENT */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800425 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800427 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800429 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430} /* TYPE_SCTP_ASCONF */
431
432#define TYPE_SCTP_ASCONF_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800434 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800436 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800438 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800440 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800442 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700443 /* SCTP_STATE_SHUTDOWN_SENT */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800444 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800446 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800448 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449} /* TYPE_SCTP_ASCONF_ACK */
450
451/* The primary index for this table is the chunk type.
452 * The secondary index for this table is the state.
453 */
454static const sctp_sm_table_entry_t addip_chunk_event_table[SCTP_NUM_ADDIP_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
455 TYPE_SCTP_ASCONF,
456 TYPE_SCTP_ASCONF_ACK,
457}; /*state_fn_t addip_chunk_event_table[][] */
458
459#define TYPE_SCTP_FWD_TSN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400461 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700462 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800463 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800465 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700466 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800467 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700468 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800469 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800471 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn_fast), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800475 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476} /* TYPE_SCTP_FWD_TSN */
477
478/* The primary index for this table is the chunk type.
479 * The secondary index for this table is the state.
480 */
481static const sctp_sm_table_entry_t prsctp_chunk_event_table[SCTP_NUM_PRSCTP_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
482 TYPE_SCTP_FWD_TSN,
483}; /*state_fn_t prsctp_chunk_event_table[][] */
484
Vlad Yasevichbbd0d592007-10-03 17:51:34 -0700485#define TYPE_SCTP_AUTH { \
Vlad Yasevichbbd0d592007-10-03 17:51:34 -0700486 /* SCTP_STATE_CLOSED */ \
487 TYPE_SCTP_FUNC(sctp_sf_ootb), \
488 /* SCTP_STATE_COOKIE_WAIT */ \
489 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
490 /* SCTP_STATE_COOKIE_ECHOED */ \
491 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
492 /* SCTP_STATE_ESTABLISHED */ \
493 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
494 /* SCTP_STATE_SHUTDOWN_PENDING */ \
495 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
496 /* SCTP_STATE_SHUTDOWN_SENT */ \
497 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
498 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
499 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
500 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
501 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
502} /* TYPE_SCTP_AUTH */
503
504/* The primary index for this table is the chunk type.
505 * The secondary index for this table is the state.
506 */
507static const sctp_sm_table_entry_t auth_chunk_event_table[SCTP_NUM_AUTH_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
508 TYPE_SCTP_AUTH,
509}; /*state_fn_t auth_chunk_event_table[][] */
510
Linus Torvalds1da177e2005-04-16 15:20:36 -0700511static const sctp_sm_table_entry_t
512chunk_event_table_unknown[SCTP_STATE_NUM_STATES] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513 /* SCTP_STATE_CLOSED */
Vlad Yasevichece25df2007-09-07 16:30:54 -0400514 TYPE_SCTP_FUNC(sctp_sf_ootb),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 /* SCTP_STATE_COOKIE_WAIT */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800516 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517 /* SCTP_STATE_COOKIE_ECHOED */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800518 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700519 /* SCTP_STATE_ESTABLISHED */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800520 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700521 /* SCTP_STATE_SHUTDOWN_PENDING */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800522 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700523 /* SCTP_STATE_SHUTDOWN_SENT */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800524 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700525 /* SCTP_STATE_SHUTDOWN_RECEIVED */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800526 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527 /* SCTP_STATE_SHUTDOWN_ACK_SENT */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800528 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700529}; /* chunk unknown */
530
531
532#define TYPE_SCTP_PRIMITIVE_ASSOCIATE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700533 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800534 TYPE_SCTP_FUNC(sctp_sf_do_prm_asoc), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700535 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800536 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700537 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800538 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700539 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800540 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700541 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800542 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800544 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800546 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700547 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800548 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549} /* TYPE_SCTP_PRIMITIVE_ASSOCIATE */
550
551#define TYPE_SCTP_PRIMITIVE_SHUTDOWN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800553 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
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_cookie_wait_prm_shutdown), \
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_cookie_echoed_prm_shutdown),\
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800559 TYPE_SCTP_FUNC(sctp_sf_do_9_2_prm_shutdown), \
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_ignore_primitive), \
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_ignore_primitive), \
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_ignore_primitive), \
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_ignore_primitive), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568} /* TYPE_SCTP_PRIMITIVE_SHUTDOWN */
569
570#define TYPE_SCTP_PRIMITIVE_ABORT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700571 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800572 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700573 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800574 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800576 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800578 TYPE_SCTP_FUNC(sctp_sf_do_9_1_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700579 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800580 TYPE_SCTP_FUNC(sctp_sf_shutdown_pending_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800582 TYPE_SCTP_FUNC(sctp_sf_shutdown_sent_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800584 TYPE_SCTP_FUNC(sctp_sf_do_9_1_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800586 TYPE_SCTP_FUNC(sctp_sf_shutdown_ack_sent_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700587} /* TYPE_SCTP_PRIMITIVE_ABORT */
588
589#define TYPE_SCTP_PRIMITIVE_SEND { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800591 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700592 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800593 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800595 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700596 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800597 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700598 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800599 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800601 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800603 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700604 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800605 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700606} /* TYPE_SCTP_PRIMITIVE_SEND */
607
608#define TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700609 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800610 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700611 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800612 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800614 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800616 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700617 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800618 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700619 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800620 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800622 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700623 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800624 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700625} /* TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT */
626
627#define TYPE_SCTP_PRIMITIVE_ASCONF { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700628 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800629 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700630 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800631 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700632 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800633 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700634 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800635 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700636 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800637 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700638 /* SCTP_STATE_SHUTDOWN_SENT */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800639 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700640 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800641 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800643 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Wei Yongjun4553e882009-04-07 16:36:14 +0800644} /* TYPE_SCTP_PRIMITIVE_ASCONF */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645
646/* The primary index for this table is the primitive type.
647 * The secondary index for this table is the state.
648 */
649static const sctp_sm_table_entry_t primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES] = {
650 TYPE_SCTP_PRIMITIVE_ASSOCIATE,
651 TYPE_SCTP_PRIMITIVE_SHUTDOWN,
652 TYPE_SCTP_PRIMITIVE_ABORT,
653 TYPE_SCTP_PRIMITIVE_SEND,
654 TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT,
655 TYPE_SCTP_PRIMITIVE_ASCONF,
656};
657
658#define TYPE_SCTP_OTHER_NO_PENDING_TSN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700659 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800660 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700661 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800662 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800664 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700665 /* SCTP_STATE_ESTABLISHED */ \
Wei Yongjune1cdd552011-04-17 17:29:03 +0000666 TYPE_SCTP_FUNC(sctp_sf_do_no_pending_tsn), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700667 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800668 TYPE_SCTP_FUNC(sctp_sf_do_9_2_start_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800670 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700671 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800672 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800674 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675}
676
677#define TYPE_SCTP_OTHER_ICMP_PROTO_UNREACH { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800679 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700680 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800681 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_icmp_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700682 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800683 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800685 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700686 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800687 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800689 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700690 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800693 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694}
695
696static const sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES] = {
697 TYPE_SCTP_OTHER_NO_PENDING_TSN,
698 TYPE_SCTP_OTHER_ICMP_PROTO_UNREACH,
699};
700
701#define TYPE_SCTP_EVENT_TIMEOUT_NONE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800703 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700704 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800705 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800707 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800709 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700710 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800711 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700712 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800713 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700714 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800715 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700716 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800717 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700718}
719
720#define TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700721 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800722 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700723 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800724 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700725 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800726 TYPE_SCTP_FUNC(sctp_sf_t1_cookie_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800728 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700729 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800730 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700731 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800732 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700733 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800734 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700735 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800736 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700737}
738
739#define TYPE_SCTP_EVENT_TIMEOUT_T1_INIT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700740 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800741 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700742 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800743 TYPE_SCTP_FUNC(sctp_sf_t1_init_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700744 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800745 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700746 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800747 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800749 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700750 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800751 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700752 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800753 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700754 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800755 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756}
757
758#define TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700759 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800760 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700761 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800762 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700763 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800764 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700765 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800766 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700767 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800768 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700769 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800770 TYPE_SCTP_FUNC(sctp_sf_t2_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700771 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800772 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800774 TYPE_SCTP_FUNC(sctp_sf_t2_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700775}
776
777#define TYPE_SCTP_EVENT_TIMEOUT_T3_RTX { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700778 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800779 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700780 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800781 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700782 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800783 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700784 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800785 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700786 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800787 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700788 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800789 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700790 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800791 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700792 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800793 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700794}
795
796#define TYPE_SCTP_EVENT_TIMEOUT_T4_RTO { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700797 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800798 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700799 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800800 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700801 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800802 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700803 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800804 TYPE_SCTP_FUNC(sctp_sf_t4_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700805 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800806 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800808 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700809 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800810 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700811 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800812 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700813}
814
815#define TYPE_SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700816 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800817 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700818 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800819 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700820 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800821 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700822 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800823 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700824 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Thomas Graff8d96052011-07-07 00:28:35 +0000825 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700826 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800827 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700828 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800829 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700830 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800831 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700832}
833
834#define TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800836 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800838 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800840 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800842 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700843 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800844 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700845 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800846 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700847 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800848 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800850 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700851}
852
853#define TYPE_SCTP_EVENT_TIMEOUT_SACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700854 /* SCTP_STATE_CLOSED */ \
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_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800857 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700858 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800859 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700860 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800861 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700862 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800863 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700864 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800865 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700866 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800867 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700868 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800869 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700870}
871
872#define TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700873 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800874 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700875 /* SCTP_STATE_COOKIE_WAIT */ \
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_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800878 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700879 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800880 TYPE_SCTP_FUNC(sctp_sf_autoclose_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700881 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800882 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700883 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800884 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700885 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800886 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700887 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800888 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700889}
890
891static const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES] = {
892 TYPE_SCTP_EVENT_TIMEOUT_NONE,
893 TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE,
894 TYPE_SCTP_EVENT_TIMEOUT_T1_INIT,
895 TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN,
896 TYPE_SCTP_EVENT_TIMEOUT_T3_RTX,
897 TYPE_SCTP_EVENT_TIMEOUT_T4_RTO,
898 TYPE_SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD,
899 TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT,
900 TYPE_SCTP_EVENT_TIMEOUT_SACK,
901 TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE,
902};
903
Eric W. Biederman55e26eb2012-08-07 07:25:24 +0000904static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
905 sctp_cid_t cid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700906 sctp_state_t state)
907{
908 if (state > SCTP_STATE_MAX)
909 return &bug;
910
Bill Nottingham75202e72007-05-31 21:33:35 -0700911 if (cid <= SCTP_CID_BASE_MAX)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700912 return &chunk_event_table[cid][state];
913
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +0000914 if (net->sctp.prsctp_enable) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700915 if (cid == SCTP_CID_FWD_TSN)
916 return &prsctp_chunk_event_table[0][state];
917 }
918
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +0000919 if (net->sctp.addip_enable) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700920 if (cid == SCTP_CID_ASCONF)
921 return &addip_chunk_event_table[0][state];
922
923 if (cid == SCTP_CID_ASCONF_ACK)
924 return &addip_chunk_event_table[1][state];
925 }
926
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +0000927 if (net->sctp.auth_enable) {
Vlad Yasevichbbd0d592007-10-03 17:51:34 -0700928 if (cid == SCTP_CID_AUTH)
929 return &auth_chunk_event_table[0][state];
930 }
931
Linus Torvalds1da177e2005-04-16 15:20:36 -0700932 return &chunk_event_table_unknown[state];
933}