blob: 84d98d8a5a7417bd92ea919c56e0f8033073a6c4 [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
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
Joe Perches145ce502010-08-24 13:21:08 +000049#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
50
Linus Torvalds1da177e2005-04-16 15:20:36 -070051#include <linux/skbuff.h>
52#include <net/sctp/sctp.h>
53#include <net/sctp/sm.h>
54
55static const sctp_sm_table_entry_t
56primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES];
57static const sctp_sm_table_entry_t
58other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES];
59static const sctp_sm_table_entry_t
60timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES];
61
Eric W. Biederman55e26eb2012-08-07 07:25:24 +000062static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
63 sctp_cid_t cid,
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 sctp_state_t state);
65
66
67static const sctp_sm_table_entry_t bug = {
68 .fn = sctp_sf_bug,
69 .name = "sctp_sf_bug"
70};
71
Joe Perches145ce502010-08-24 13:21:08 +000072#define DO_LOOKUP(_max, _type, _table) \
73({ \
74 const sctp_sm_table_entry_t *rtn; \
75 \
76 if ((event_subtype._type > (_max))) { \
77 pr_warn("table %p possible attack: event %d exceeds max %d\n", \
78 _table, event_subtype._type, _max); \
79 rtn = &bug; \
80 } else \
81 rtn = &_table[event_subtype._type][(int)state]; \
82 \
83 rtn; \
84})
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
Eric W. Biederman55e26eb2012-08-07 07:25:24 +000086const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *net,
87 sctp_event_t event_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 sctp_state_t state,
89 sctp_subtype_t event_subtype)
90{
91 switch (event_type) {
92 case SCTP_EVENT_T_CHUNK:
Eric W. Biederman55e26eb2012-08-07 07:25:24 +000093 return sctp_chunk_event_lookup(net, event_subtype.chunk, state);
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 case SCTP_EVENT_T_TIMEOUT:
Joe Perches145ce502010-08-24 13:21:08 +000095 return DO_LOOKUP(SCTP_EVENT_TIMEOUT_MAX, timeout,
96 timeout_event_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 case SCTP_EVENT_T_OTHER:
Joe Perches145ce502010-08-24 13:21:08 +000098 return DO_LOOKUP(SCTP_EVENT_OTHER_MAX, other,
99 other_event_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 case SCTP_EVENT_T_PRIMITIVE:
Joe Perches145ce502010-08-24 13:21:08 +0000101 return DO_LOOKUP(SCTP_EVENT_PRIMITIVE_MAX, primitive,
102 primitive_event_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 default:
104 /* Yikes! We got an illegal event type. */
105 return &bug;
Stephen Hemminger3ff50b72007-04-20 17:09:22 -0700106 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107}
108
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800109#define TYPE_SCTP_FUNC(func) {.fn = func, .name = #func}
110
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111#define TYPE_SCTP_DATA { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400113 TYPE_SCTP_FUNC(sctp_sf_ootb), \
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 { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800132 TYPE_SCTP_FUNC(sctp_sf_do_5_1B_init), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800134 TYPE_SCTP_FUNC(sctp_sf_do_5_2_1_siminit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135 /* SCTP_STATE_COOKIE_ECHOED */ \
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_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800138 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139 /* SCTP_STATE_SHUTDOWN_PENDING */ \
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_SENT */ \
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_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800146 TYPE_SCTP_FUNC(sctp_sf_do_9_2_reshutack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147} /* TYPE_SCTP_INIT */
148
149#define TYPE_SCTP_INIT_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 /* SCTP_STATE_CLOSED */ \
Vlad Yasevich610ab732007-01-15 19:18:30 -0800151 TYPE_SCTP_FUNC(sctp_sf_do_5_2_3_initack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800153 TYPE_SCTP_FUNC(sctp_sf_do_5_1C_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800155 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800157 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158 /* SCTP_STATE_SHUTDOWN_PENDING */ \
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_SHUTDOWN_SENT */ \
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_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800165 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166} /* TYPE_SCTP_INIT_ACK */
167
168#define TYPE_SCTP_SACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400170 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800172 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800174 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800176 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800178 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800180 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800184 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185} /* TYPE_SCTP_SACK */
186
187#define TYPE_SCTP_HEARTBEAT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400189 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800191 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800193 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800195 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800197 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800199 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_SHUTDOWN_ACK_SENT */ \
203 /* This should not happen, but we are nice. */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800204 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205} /* TYPE_SCTP_HEARTBEAT */
206
207#define TYPE_SCTP_HEARTBEAT_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400209 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800211 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800213 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800215 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800217 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800219 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800221 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800223 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224} /* TYPE_SCTP_HEARTBEAT_ACK */
225
226#define TYPE_SCTP_ABORT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800228 TYPE_SCTP_FUNC(sctp_sf_pdiscard), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800230 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800232 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800234 TYPE_SCTP_FUNC(sctp_sf_do_9_1_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800236 TYPE_SCTP_FUNC(sctp_sf_shutdown_pending_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800238 TYPE_SCTP_FUNC(sctp_sf_shutdown_sent_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800240 TYPE_SCTP_FUNC(sctp_sf_do_9_1_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800242 TYPE_SCTP_FUNC(sctp_sf_shutdown_ack_sent_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243} /* TYPE_SCTP_ABORT */
244
245#define TYPE_SCTP_SHUTDOWN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400247 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800249 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800251 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800253 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Wei Yongjuncf896d52008-10-23 01:00:49 -0700255 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800257 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Wei Yongjun2e3f92d2008-10-23 01:01:18 -0700259 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shut_ctsn), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800261 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262} /* TYPE_SCTP_SHUTDOWN */
263
264#define TYPE_SCTP_SHUTDOWN_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800266 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800268 TYPE_SCTP_FUNC(sctp_sf_do_8_5_1_E_sa), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800270 TYPE_SCTP_FUNC(sctp_sf_do_8_5_1_E_sa), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800272 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800274 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800276 TYPE_SCTP_FUNC(sctp_sf_do_9_2_final), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800278 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800280 TYPE_SCTP_FUNC(sctp_sf_do_9_2_final), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281} /* TYPE_SCTP_SHUTDOWN_ACK */
282
283#define TYPE_SCTP_ERROR { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400285 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800287 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800289 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_err), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800291 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800293 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700294 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800295 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800297 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800299 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300} /* TYPE_SCTP_ERROR */
301
302#define TYPE_SCTP_COOKIE_ECHO { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800304 TYPE_SCTP_FUNC(sctp_sf_do_5_1D_ce), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800306 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800308 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800310 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700311 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800312 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800314 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800316 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800318 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319} /* TYPE_SCTP_COOKIE_ECHO */
320
321#define TYPE_SCTP_COOKIE_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800323 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800325 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700326 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800327 TYPE_SCTP_FUNC(sctp_sf_do_5_1E_ca), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800329 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800331 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800333 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800337 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700338} /* TYPE_SCTP_COOKIE_ACK */
339
340#define TYPE_SCTP_ECN_ECNE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800342 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800344 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800346 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800348 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800350 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800352 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700353 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800354 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800356 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700357} /* TYPE_SCTP_ECN_ECNE */
358
359#define TYPE_SCTP_ECN_CWR { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800361 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800363 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700364 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800365 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800367 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800369 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800371 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800375 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700376} /* TYPE_SCTP_ECN_CWR */
377
378#define TYPE_SCTP_SHUTDOWN_COMPLETE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800380 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700381 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800382 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800384 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700385 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800386 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800388 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800390 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800392 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800394 TYPE_SCTP_FUNC(sctp_sf_do_4_C), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395} /* TYPE_SCTP_SHUTDOWN_COMPLETE */
396
397/* The primary index for this table is the chunk type.
398 * The secondary index for this table is the state.
399 *
400 * For base protocol (RFC 2960).
401 */
402static const sctp_sm_table_entry_t chunk_event_table[SCTP_NUM_BASE_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
403 TYPE_SCTP_DATA,
404 TYPE_SCTP_INIT,
405 TYPE_SCTP_INIT_ACK,
406 TYPE_SCTP_SACK,
407 TYPE_SCTP_HEARTBEAT,
408 TYPE_SCTP_HEARTBEAT_ACK,
409 TYPE_SCTP_ABORT,
410 TYPE_SCTP_SHUTDOWN,
411 TYPE_SCTP_SHUTDOWN_ACK,
412 TYPE_SCTP_ERROR,
413 TYPE_SCTP_COOKIE_ECHO,
414 TYPE_SCTP_COOKIE_ACK,
415 TYPE_SCTP_ECN_ECNE,
416 TYPE_SCTP_ECN_CWR,
417 TYPE_SCTP_SHUTDOWN_COMPLETE,
418}; /* state_fn_t chunk_event_table[][] */
419
420#define TYPE_SCTP_ASCONF { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800422 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800424 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700425 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800426 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800428 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800430 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431 /* SCTP_STATE_SHUTDOWN_SENT */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800432 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800434 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800436 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437} /* TYPE_SCTP_ASCONF */
438
439#define TYPE_SCTP_ASCONF_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800441 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800443 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800445 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800447 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700448 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800449 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450 /* SCTP_STATE_SHUTDOWN_SENT */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800451 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800453 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800455 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456} /* TYPE_SCTP_ASCONF_ACK */
457
458/* The primary index for this table is the chunk type.
459 * The secondary index for this table is the state.
460 */
461static const sctp_sm_table_entry_t addip_chunk_event_table[SCTP_NUM_ADDIP_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
462 TYPE_SCTP_ASCONF,
463 TYPE_SCTP_ASCONF_ACK,
464}; /*state_fn_t addip_chunk_event_table[][] */
465
466#define TYPE_SCTP_FWD_TSN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400468 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800470 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800472 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700473 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800474 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800476 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800478 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn_fast), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700479 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800480 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800482 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483} /* TYPE_SCTP_FWD_TSN */
484
485/* The primary index for this table is the chunk type.
486 * The secondary index for this table is the state.
487 */
488static const sctp_sm_table_entry_t prsctp_chunk_event_table[SCTP_NUM_PRSCTP_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
489 TYPE_SCTP_FWD_TSN,
490}; /*state_fn_t prsctp_chunk_event_table[][] */
491
Vlad Yasevichbbd0d592007-10-03 17:51:34 -0700492#define TYPE_SCTP_AUTH { \
Vlad Yasevichbbd0d592007-10-03 17:51:34 -0700493 /* SCTP_STATE_CLOSED */ \
494 TYPE_SCTP_FUNC(sctp_sf_ootb), \
495 /* SCTP_STATE_COOKIE_WAIT */ \
496 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
497 /* SCTP_STATE_COOKIE_ECHOED */ \
498 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
499 /* SCTP_STATE_ESTABLISHED */ \
500 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
501 /* SCTP_STATE_SHUTDOWN_PENDING */ \
502 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
503 /* SCTP_STATE_SHUTDOWN_SENT */ \
504 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
505 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
506 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
507 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
508 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
509} /* TYPE_SCTP_AUTH */
510
511/* The primary index for this table is the chunk type.
512 * The secondary index for this table is the state.
513 */
514static const sctp_sm_table_entry_t auth_chunk_event_table[SCTP_NUM_AUTH_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
515 TYPE_SCTP_AUTH,
516}; /*state_fn_t auth_chunk_event_table[][] */
517
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518static const sctp_sm_table_entry_t
519chunk_event_table_unknown[SCTP_STATE_NUM_STATES] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 /* SCTP_STATE_CLOSED */
Vlad Yasevichece25df2007-09-07 16:30:54 -0400521 TYPE_SCTP_FUNC(sctp_sf_ootb),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700522 /* SCTP_STATE_COOKIE_WAIT */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800523 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524 /* SCTP_STATE_COOKIE_ECHOED */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800525 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700526 /* SCTP_STATE_ESTABLISHED */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800527 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700528 /* SCTP_STATE_SHUTDOWN_PENDING */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800529 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700530 /* SCTP_STATE_SHUTDOWN_SENT */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800531 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700532 /* SCTP_STATE_SHUTDOWN_RECEIVED */
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_SHUTDOWN_ACK_SENT */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800535 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536}; /* chunk unknown */
537
538
539#define TYPE_SCTP_PRIMITIVE_ASSOCIATE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800541 TYPE_SCTP_FUNC(sctp_sf_do_prm_asoc), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800543 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800545 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700546 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800547 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800549 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800551 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800553 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700554 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800555 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700556} /* TYPE_SCTP_PRIMITIVE_ASSOCIATE */
557
558#define TYPE_SCTP_PRIMITIVE_SHUTDOWN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800560 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800562 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_prm_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800564 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_prm_shutdown),\
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800566 TYPE_SCTP_FUNC(sctp_sf_do_9_2_prm_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800568 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800570 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700571 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800572 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700573 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800574 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575} /* TYPE_SCTP_PRIMITIVE_SHUTDOWN */
576
577#define TYPE_SCTP_PRIMITIVE_ABORT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700578 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800579 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700580 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800581 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700582 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800583 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700584 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800585 TYPE_SCTP_FUNC(sctp_sf_do_9_1_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800587 TYPE_SCTP_FUNC(sctp_sf_shutdown_pending_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700588 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800589 TYPE_SCTP_FUNC(sctp_sf_shutdown_sent_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800591 TYPE_SCTP_FUNC(sctp_sf_do_9_1_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700592 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800593 TYPE_SCTP_FUNC(sctp_sf_shutdown_ack_sent_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594} /* TYPE_SCTP_PRIMITIVE_ABORT */
595
596#define TYPE_SCTP_PRIMITIVE_SEND { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800598 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800600 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800602 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800604 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700605 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800606 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800608 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700609 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800610 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700611 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800612 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613} /* TYPE_SCTP_PRIMITIVE_SEND */
614
615#define TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800617 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700618 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800619 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700620 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800621 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700622 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800623 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800625 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700626 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800627 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700628 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800629 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700630 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800631 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700632} /* TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT */
633
634#define TYPE_SCTP_PRIMITIVE_ASCONF { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700635 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800636 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800638 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800640 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700641 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800642 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700643 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800644 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645 /* SCTP_STATE_SHUTDOWN_SENT */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800646 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800648 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700649 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800650 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Wei Yongjun4553e882009-04-07 16:36:14 +0800651} /* TYPE_SCTP_PRIMITIVE_ASCONF */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652
653/* The primary index for this table is the primitive type.
654 * The secondary index for this table is the state.
655 */
656static const sctp_sm_table_entry_t primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES] = {
657 TYPE_SCTP_PRIMITIVE_ASSOCIATE,
658 TYPE_SCTP_PRIMITIVE_SHUTDOWN,
659 TYPE_SCTP_PRIMITIVE_ABORT,
660 TYPE_SCTP_PRIMITIVE_SEND,
661 TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT,
662 TYPE_SCTP_PRIMITIVE_ASCONF,
663};
664
665#define TYPE_SCTP_OTHER_NO_PENDING_TSN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800667 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700668 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800669 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700670 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800671 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700672 /* SCTP_STATE_ESTABLISHED */ \
Wei Yongjune1cdd552011-04-17 17:29:03 +0000673 TYPE_SCTP_FUNC(sctp_sf_do_no_pending_tsn), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800675 TYPE_SCTP_FUNC(sctp_sf_do_9_2_start_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700676 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800677 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800679 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700680 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800681 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700682}
683
684#define TYPE_SCTP_OTHER_ICMP_PROTO_UNREACH { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700685 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800686 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800688 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_icmp_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800690 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700691 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800692 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800694 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700695 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800696 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700697 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800698 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700699 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800700 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700701}
702
703static const sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES] = {
704 TYPE_SCTP_OTHER_NO_PENDING_TSN,
705 TYPE_SCTP_OTHER_ICMP_PROTO_UNREACH,
706};
707
708#define TYPE_SCTP_EVENT_TIMEOUT_NONE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700709 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800710 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800712 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700713 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800714 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800716 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700717 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800718 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700719 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800720 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700721 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800722 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700723 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800724 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700725}
726
727#define TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700728 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800729 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700730 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800731 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700732 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800733 TYPE_SCTP_FUNC(sctp_sf_t1_cookie_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700734 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800735 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700736 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800737 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700738 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800739 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700740 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800743 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700744}
745
746#define TYPE_SCTP_EVENT_TIMEOUT_T1_INIT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700747 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800748 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700749 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800750 TYPE_SCTP_FUNC(sctp_sf_t1_init_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700751 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800752 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700753 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800754 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700755 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800756 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700757 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800758 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700759 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800762 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700763}
764
765#define TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700766 /* SCTP_STATE_CLOSED */ \
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_COOKIE_WAIT */ \
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_COOKIE_ECHOED */ \
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_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800773 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700774 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800775 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800777 TYPE_SCTP_FUNC(sctp_sf_t2_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700778 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800781 TYPE_SCTP_FUNC(sctp_sf_t2_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700782}
783
784#define TYPE_SCTP_EVENT_TIMEOUT_T3_RTX { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700785 /* SCTP_STATE_CLOSED */ \
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_COOKIE_WAIT */ \
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_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800790 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700791 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800792 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700793 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800794 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800796 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700797 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800798 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700799 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800800 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700801}
802
803#define TYPE_SCTP_EVENT_TIMEOUT_T4_RTO { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700804 /* SCTP_STATE_CLOSED */ \
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_COOKIE_WAIT */ \
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_COOKIE_ECHOED */ \
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_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800811 TYPE_SCTP_FUNC(sctp_sf_t4_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812 /* SCTP_STATE_SHUTDOWN_PENDING */ \
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_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800815 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700816 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800819 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700820}
821
822#define TYPE_SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700823 /* SCTP_STATE_CLOSED */ \
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_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800826 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700827 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800828 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700829 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800830 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700831 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Thomas Graff8d96052011-07-07 00:28:35 +0000832 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700833 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800834 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800838 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839}
840
841#define TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT { \
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_sendbeat_8_3), \
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_sendbeat_8_3), \
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_sendbeat_8_3), \
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_SACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700861 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800862 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700863 /* SCTP_STATE_COOKIE_WAIT */ \
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_ECHOED */ \
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_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800868 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700869 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800870 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700871 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800872 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700873 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800876 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700877}
878
879#define TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700880 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800881 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700882 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800883 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700884 /* SCTP_STATE_COOKIE_ECHOED */ \
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_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800887 TYPE_SCTP_FUNC(sctp_sf_autoclose_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700888 /* SCTP_STATE_SHUTDOWN_PENDING */ \
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_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800891 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700892 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800893 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700894 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800895 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700896}
897
898static const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES] = {
899 TYPE_SCTP_EVENT_TIMEOUT_NONE,
900 TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE,
901 TYPE_SCTP_EVENT_TIMEOUT_T1_INIT,
902 TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN,
903 TYPE_SCTP_EVENT_TIMEOUT_T3_RTX,
904 TYPE_SCTP_EVENT_TIMEOUT_T4_RTO,
905 TYPE_SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD,
906 TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT,
907 TYPE_SCTP_EVENT_TIMEOUT_SACK,
908 TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE,
909};
910
Eric W. Biederman55e26eb2012-08-07 07:25:24 +0000911static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
912 sctp_cid_t cid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700913 sctp_state_t state)
914{
915 if (state > SCTP_STATE_MAX)
916 return &bug;
917
Bill Nottingham75202e72007-05-31 21:33:35 -0700918 if (cid <= SCTP_CID_BASE_MAX)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700919 return &chunk_event_table[cid][state];
920
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +0000921 if (net->sctp.prsctp_enable) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700922 if (cid == SCTP_CID_FWD_TSN)
923 return &prsctp_chunk_event_table[0][state];
924 }
925
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +0000926 if (net->sctp.addip_enable) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700927 if (cid == SCTP_CID_ASCONF)
928 return &addip_chunk_event_table[0][state];
929
930 if (cid == SCTP_CID_ASCONF_ACK)
931 return &addip_chunk_event_table[1][state];
932 }
933
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +0000934 if (net->sctp.auth_enable) {
Vlad Yasevichbbd0d592007-10-03 17:51:34 -0700935 if (cid == SCTP_CID_AUTH)
936 return &auth_chunk_event_table[0][state];
937 }
938
Linus Torvalds1da177e2005-04-16 15:20:36 -0700939 return &chunk_event_table_unknown[state];
940}