blob: c5999b2dde7dfa5fcd53e68cf3d7791e838e602b [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):
Daniel Borkmann91705c62013-07-23 14:51:47 +020031 * lksctp developers <linux-sctp@vger.kernel.org>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 * Written or modified by:
34 * La Monte H.P. Yarroll <piggy@acm.org>
35 * Karl Knutson <karl@athena.chicago.il.us>
36 * Jon Grimm <jgrimm@us.ibm.com>
37 * Hui Huang <hui.huang@nokia.com>
38 * Daisy Chang <daisyc@us.ibm.com>
39 * Ardelle Fan <ardelle.fan@intel.com>
40 * Sridhar Samudrala <sri@us.ibm.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 */
42
Joe Perches145ce502010-08-24 13:21:08 +000043#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
44
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#include <linux/skbuff.h>
46#include <net/sctp/sctp.h>
47#include <net/sctp/sm.h>
48
49static const sctp_sm_table_entry_t
50primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES];
51static const sctp_sm_table_entry_t
52other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES];
53static const sctp_sm_table_entry_t
54timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES];
55
Eric W. Biederman55e26eb2012-08-07 07:25:24 +000056static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
57 sctp_cid_t cid,
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 sctp_state_t state);
59
60
61static const sctp_sm_table_entry_t bug = {
62 .fn = sctp_sf_bug,
63 .name = "sctp_sf_bug"
64};
65
Joe Perches145ce502010-08-24 13:21:08 +000066#define DO_LOOKUP(_max, _type, _table) \
67({ \
68 const sctp_sm_table_entry_t *rtn; \
69 \
70 if ((event_subtype._type > (_max))) { \
71 pr_warn("table %p possible attack: event %d exceeds max %d\n", \
72 _table, event_subtype._type, _max); \
73 rtn = &bug; \
74 } else \
75 rtn = &_table[event_subtype._type][(int)state]; \
76 \
77 rtn; \
78})
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
Eric W. Biederman55e26eb2012-08-07 07:25:24 +000080const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *net,
81 sctp_event_t event_type,
Linus Torvalds1da177e2005-04-16 15:20:36 -070082 sctp_state_t state,
83 sctp_subtype_t event_subtype)
84{
85 switch (event_type) {
86 case SCTP_EVENT_T_CHUNK:
Eric W. Biederman55e26eb2012-08-07 07:25:24 +000087 return sctp_chunk_event_lookup(net, event_subtype.chunk, state);
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 case SCTP_EVENT_T_TIMEOUT:
Joe Perches145ce502010-08-24 13:21:08 +000089 return DO_LOOKUP(SCTP_EVENT_TIMEOUT_MAX, timeout,
90 timeout_event_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -070091 case SCTP_EVENT_T_OTHER:
Joe Perches145ce502010-08-24 13:21:08 +000092 return DO_LOOKUP(SCTP_EVENT_OTHER_MAX, other,
93 other_event_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 case SCTP_EVENT_T_PRIMITIVE:
Joe Perches145ce502010-08-24 13:21:08 +000095 return DO_LOOKUP(SCTP_EVENT_PRIMITIVE_MAX, primitive,
96 primitive_event_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 default:
98 /* Yikes! We got an illegal event type. */
99 return &bug;
Stephen Hemminger3ff50b72007-04-20 17:09:22 -0700100 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101}
102
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800103#define TYPE_SCTP_FUNC(func) {.fn = func, .name = #func}
104
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105#define TYPE_SCTP_DATA { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400107 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800109 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800111 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800113 TYPE_SCTP_FUNC(sctp_sf_eat_data_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800115 TYPE_SCTP_FUNC(sctp_sf_eat_data_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800117 TYPE_SCTP_FUNC(sctp_sf_eat_data_fast_4_4), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800119 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800121 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122} /* TYPE_SCTP_DATA */
123
124#define TYPE_SCTP_INIT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800126 TYPE_SCTP_FUNC(sctp_sf_do_5_1B_init), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800128 TYPE_SCTP_FUNC(sctp_sf_do_5_2_1_siminit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800130 TYPE_SCTP_FUNC(sctp_sf_do_5_2_1_siminit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800132 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800134 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800136 TYPE_SCTP_FUNC(sctp_sf_do_5_2_2_dupinit), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800140 TYPE_SCTP_FUNC(sctp_sf_do_9_2_reshutack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141} /* TYPE_SCTP_INIT */
142
143#define TYPE_SCTP_INIT_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 /* SCTP_STATE_CLOSED */ \
Vlad Yasevich610ab732007-01-15 19:18:30 -0800145 TYPE_SCTP_FUNC(sctp_sf_do_5_2_3_initack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800147 TYPE_SCTP_FUNC(sctp_sf_do_5_1C_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800149 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800151 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800153 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 /* SCTP_STATE_SHUTDOWN_SENT */ \
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_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800159 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160} /* TYPE_SCTP_INIT_ACK */
161
162#define TYPE_SCTP_SACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400164 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800166 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800168 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800170 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800172 TYPE_SCTP_FUNC(sctp_sf_eat_sack_6_2), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800174 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800178 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179} /* TYPE_SCTP_SACK */
180
181#define TYPE_SCTP_HEARTBEAT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400183 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800185 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800187 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800189 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800191 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192 /* SCTP_STATE_SHUTDOWN_SENT */ \
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_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
197 /* This should not happen, but we are nice. */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800198 TYPE_SCTP_FUNC(sctp_sf_beat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199} /* TYPE_SCTP_HEARTBEAT */
200
201#define TYPE_SCTP_HEARTBEAT_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400203 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800205 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800207 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800209 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800211 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800213 TYPE_SCTP_FUNC(sctp_sf_backbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800217 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218} /* TYPE_SCTP_HEARTBEAT_ACK */
219
220#define TYPE_SCTP_ABORT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800222 TYPE_SCTP_FUNC(sctp_sf_pdiscard), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800224 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800226 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800228 TYPE_SCTP_FUNC(sctp_sf_do_9_1_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800230 TYPE_SCTP_FUNC(sctp_sf_shutdown_pending_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800232 TYPE_SCTP_FUNC(sctp_sf_shutdown_sent_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800236 TYPE_SCTP_FUNC(sctp_sf_shutdown_ack_sent_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237} /* TYPE_SCTP_ABORT */
238
239#define TYPE_SCTP_SHUTDOWN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400241 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800243 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800245 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800247 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Wei Yongjuncf896d52008-10-23 01:00:49 -0700249 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800251 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Wei Yongjun2e3f92d2008-10-23 01:01:18 -0700253 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shut_ctsn), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800255 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256} /* TYPE_SCTP_SHUTDOWN */
257
258#define TYPE_SCTP_SHUTDOWN_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800260 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800262 TYPE_SCTP_FUNC(sctp_sf_do_8_5_1_E_sa), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800264 TYPE_SCTP_FUNC(sctp_sf_do_8_5_1_E_sa), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800266 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800268 TYPE_SCTP_FUNC(sctp_sf_violation), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800270 TYPE_SCTP_FUNC(sctp_sf_do_9_2_final), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800274 TYPE_SCTP_FUNC(sctp_sf_do_9_2_final), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275} /* TYPE_SCTP_SHUTDOWN_ACK */
276
277#define TYPE_SCTP_ERROR { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400279 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800281 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800283 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_err), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800285 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800287 TYPE_SCTP_FUNC(sctp_sf_operr_notify), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800289 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800293 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700294} /* TYPE_SCTP_ERROR */
295
296#define TYPE_SCTP_COOKIE_ECHO { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800298 TYPE_SCTP_FUNC(sctp_sf_do_5_1D_ce), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800300 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800302 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800304 TYPE_SCTP_FUNC(sctp_sf_do_5_2_4_dupcook), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305 /* SCTP_STATE_SHUTDOWN_PENDING */ \
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_SHUTDOWN_SENT */ \
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_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
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} /* TYPE_SCTP_COOKIE_ECHO */
314
315#define TYPE_SCTP_COOKIE_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800317 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800319 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800321 TYPE_SCTP_FUNC(sctp_sf_do_5_1E_ca), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322 /* SCTP_STATE_ESTABLISHED */ \
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_SHUTDOWN_PENDING */ \
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_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800327 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800331 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332} /* TYPE_SCTP_COOKIE_ACK */
333
334#define TYPE_SCTP_ECN_ECNE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800336 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800338 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700339 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800340 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800342 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800344 TYPE_SCTP_FUNC(sctp_sf_do_ecne), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345 /* SCTP_STATE_SHUTDOWN_SENT */ \
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_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800350 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351} /* TYPE_SCTP_ECN_ECNE */
352
353#define TYPE_SCTP_ECN_CWR { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800355 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800357 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800359 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800361 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800363 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700364 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800365 TYPE_SCTP_FUNC(sctp_sf_do_ecn_cwr), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800367 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800369 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370} /* TYPE_SCTP_ECN_CWR */
371
372#define TYPE_SCTP_SHUTDOWN_COMPLETE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800374 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800376 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800378 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379 /* SCTP_STATE_ESTABLISHED */ \
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_SHUTDOWN_PENDING */ \
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_SHUTDOWN_SENT */ \
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_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800388 TYPE_SCTP_FUNC(sctp_sf_do_4_C), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389} /* TYPE_SCTP_SHUTDOWN_COMPLETE */
390
391/* The primary index for this table is the chunk type.
392 * The secondary index for this table is the state.
393 *
394 * For base protocol (RFC 2960).
395 */
396static const sctp_sm_table_entry_t chunk_event_table[SCTP_NUM_BASE_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
397 TYPE_SCTP_DATA,
398 TYPE_SCTP_INIT,
399 TYPE_SCTP_INIT_ACK,
400 TYPE_SCTP_SACK,
401 TYPE_SCTP_HEARTBEAT,
402 TYPE_SCTP_HEARTBEAT_ACK,
403 TYPE_SCTP_ABORT,
404 TYPE_SCTP_SHUTDOWN,
405 TYPE_SCTP_SHUTDOWN_ACK,
406 TYPE_SCTP_ERROR,
407 TYPE_SCTP_COOKIE_ECHO,
408 TYPE_SCTP_COOKIE_ACK,
409 TYPE_SCTP_ECN_ECNE,
410 TYPE_SCTP_ECN_CWR,
411 TYPE_SCTP_SHUTDOWN_COMPLETE,
412}; /* state_fn_t chunk_event_table[][] */
413
414#define TYPE_SCTP_ASCONF { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800416 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800418 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700419 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800420 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800422 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800424 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700425 /* SCTP_STATE_SHUTDOWN_SENT */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800426 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800428 TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800430 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431} /* TYPE_SCTP_ASCONF */
432
433#define TYPE_SCTP_ASCONF_ACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800435 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700436 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800437 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800439 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800441 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800443 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444 /* SCTP_STATE_SHUTDOWN_SENT */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800445 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800447 TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700448 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800449 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450} /* TYPE_SCTP_ASCONF_ACK */
451
452/* The primary index for this table is the chunk type.
453 * The secondary index for this table is the state.
454 */
455static const sctp_sm_table_entry_t addip_chunk_event_table[SCTP_NUM_ADDIP_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
456 TYPE_SCTP_ASCONF,
457 TYPE_SCTP_ASCONF_ACK,
458}; /*state_fn_t addip_chunk_event_table[][] */
459
460#define TYPE_SCTP_FWD_TSN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461 /* SCTP_STATE_CLOSED */ \
Vlad Yasevichece25df2007-09-07 16:30:54 -0400462 TYPE_SCTP_FUNC(sctp_sf_ootb), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800464 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800466 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800468 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800470 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800472 TYPE_SCTP_FUNC(sctp_sf_eat_fwd_tsn_fast), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700473 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800474 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800476 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477} /* TYPE_SCTP_FWD_TSN */
478
479/* The primary index for this table is the chunk type.
480 * The secondary index for this table is the state.
481 */
482static const sctp_sm_table_entry_t prsctp_chunk_event_table[SCTP_NUM_PRSCTP_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
483 TYPE_SCTP_FWD_TSN,
484}; /*state_fn_t prsctp_chunk_event_table[][] */
485
Vlad Yasevichbbd0d592007-10-03 17:51:34 -0700486#define TYPE_SCTP_AUTH { \
Vlad Yasevichbbd0d592007-10-03 17:51:34 -0700487 /* SCTP_STATE_CLOSED */ \
488 TYPE_SCTP_FUNC(sctp_sf_ootb), \
489 /* SCTP_STATE_COOKIE_WAIT */ \
490 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
491 /* SCTP_STATE_COOKIE_ECHOED */ \
492 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
493 /* SCTP_STATE_ESTABLISHED */ \
494 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
495 /* SCTP_STATE_SHUTDOWN_PENDING */ \
496 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
497 /* SCTP_STATE_SHUTDOWN_SENT */ \
498 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
499 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
500 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
501 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
502 TYPE_SCTP_FUNC(sctp_sf_eat_auth), \
503} /* TYPE_SCTP_AUTH */
504
505/* The primary index for this table is the chunk type.
506 * The secondary index for this table is the state.
507 */
508static const sctp_sm_table_entry_t auth_chunk_event_table[SCTP_NUM_AUTH_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
509 TYPE_SCTP_AUTH,
510}; /*state_fn_t auth_chunk_event_table[][] */
511
Linus Torvalds1da177e2005-04-16 15:20:36 -0700512static const sctp_sm_table_entry_t
513chunk_event_table_unknown[SCTP_STATE_NUM_STATES] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700514 /* SCTP_STATE_CLOSED */
Vlad Yasevichece25df2007-09-07 16:30:54 -0400515 TYPE_SCTP_FUNC(sctp_sf_ootb),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700516 /* SCTP_STATE_COOKIE_WAIT */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800517 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 /* SCTP_STATE_COOKIE_ECHOED */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800519 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 /* SCTP_STATE_ESTABLISHED */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800521 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700522 /* SCTP_STATE_SHUTDOWN_PENDING */
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_SHUTDOWN_SENT */
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_SHUTDOWN_RECEIVED */
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_ACK_SENT */
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800529 TYPE_SCTP_FUNC(sctp_sf_unk_chunk),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700530}; /* chunk unknown */
531
532
533#define TYPE_SCTP_PRIMITIVE_ASSOCIATE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700534 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800535 TYPE_SCTP_FUNC(sctp_sf_do_prm_asoc), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800537 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800539 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800541 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 /* SCTP_STATE_SHUTDOWN_PENDING */ \
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_SHUTDOWN_SENT */ \
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_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800549 TYPE_SCTP_FUNC(sctp_sf_not_impl), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550} /* TYPE_SCTP_PRIMITIVE_ASSOCIATE */
551
552#define TYPE_SCTP_PRIMITIVE_SHUTDOWN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700553 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800554 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800556 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_prm_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700557 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800558 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_prm_shutdown),\
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800560 TYPE_SCTP_FUNC(sctp_sf_do_9_2_prm_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800562 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800564 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800566 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800568 TYPE_SCTP_FUNC(sctp_sf_ignore_primitive), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569} /* TYPE_SCTP_PRIMITIVE_SHUTDOWN */
570
571#define TYPE_SCTP_PRIMITIVE_ABORT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800573 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700574 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800575 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700576 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800577 TYPE_SCTP_FUNC(sctp_sf_cookie_echoed_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700578 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800579 TYPE_SCTP_FUNC(sctp_sf_do_9_1_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700580 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800581 TYPE_SCTP_FUNC(sctp_sf_shutdown_pending_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700582 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800583 TYPE_SCTP_FUNC(sctp_sf_shutdown_sent_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700584 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800587 TYPE_SCTP_FUNC(sctp_sf_shutdown_ack_sent_prm_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700588} /* TYPE_SCTP_PRIMITIVE_ABORT */
589
590#define TYPE_SCTP_PRIMITIVE_SEND { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800592 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700593 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800594 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800596 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800598 TYPE_SCTP_FUNC(sctp_sf_do_prm_send), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800600 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800602 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800604 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700605 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800606 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607} /* TYPE_SCTP_PRIMITIVE_SEND */
608
609#define TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800611 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800613 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700614 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800615 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800617 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700618 /* SCTP_STATE_SHUTDOWN_PENDING */ \
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_SHUTDOWN_SENT */ \
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_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800625 TYPE_SCTP_FUNC(sctp_sf_do_prm_requestheartbeat), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700626} /* TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT */
627
628#define TYPE_SCTP_PRIMITIVE_ASCONF { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800630 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700631 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800632 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800634 TYPE_SCTP_FUNC(sctp_sf_error_closed), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700635 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800636 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800638 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639 /* SCTP_STATE_SHUTDOWN_SENT */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800640 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700641 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Vlad Yasevichba8a06d2007-12-20 14:11:11 -0800642 TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700643 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800644 TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
Wei Yongjun4553e882009-04-07 16:36:14 +0800645} /* TYPE_SCTP_PRIMITIVE_ASCONF */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700646
647/* The primary index for this table is the primitive type.
648 * The secondary index for this table is the state.
649 */
650static const sctp_sm_table_entry_t primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES] = {
651 TYPE_SCTP_PRIMITIVE_ASSOCIATE,
652 TYPE_SCTP_PRIMITIVE_SHUTDOWN,
653 TYPE_SCTP_PRIMITIVE_ABORT,
654 TYPE_SCTP_PRIMITIVE_SEND,
655 TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT,
656 TYPE_SCTP_PRIMITIVE_ASCONF,
657};
658
659#define TYPE_SCTP_OTHER_NO_PENDING_TSN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700660 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800661 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700662 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800663 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800665 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666 /* SCTP_STATE_ESTABLISHED */ \
Wei Yongjune1cdd552011-04-17 17:29:03 +0000667 TYPE_SCTP_FUNC(sctp_sf_do_no_pending_tsn), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700668 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800669 TYPE_SCTP_FUNC(sctp_sf_do_9_2_start_shutdown), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700670 /* SCTP_STATE_SHUTDOWN_SENT */ \
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_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800673 TYPE_SCTP_FUNC(sctp_sf_do_9_2_shutdown_ack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800675 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700676}
677
678#define TYPE_SCTP_OTHER_ICMP_PROTO_UNREACH { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800680 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700681 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800682 TYPE_SCTP_FUNC(sctp_sf_cookie_wait_icmp_abort), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800684 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700685 /* SCTP_STATE_ESTABLISHED */ \
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_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800688 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 /* SCTP_STATE_SHUTDOWN_SENT */ \
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_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800694 TYPE_SCTP_FUNC(sctp_sf_ignore_other), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700695}
696
697static const sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES] = {
698 TYPE_SCTP_OTHER_NO_PENDING_TSN,
699 TYPE_SCTP_OTHER_ICMP_PROTO_UNREACH,
700};
701
702#define TYPE_SCTP_EVENT_TIMEOUT_NONE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700703 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800704 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700705 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800706 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700707 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800708 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700709 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800710 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800712 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700713 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800714 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800718 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700719}
720
721#define TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700722 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800723 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700724 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800725 TYPE_SCTP_FUNC(sctp_sf_bug), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700726 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800727 TYPE_SCTP_FUNC(sctp_sf_t1_cookie_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700728 /* SCTP_STATE_ESTABLISHED */ \
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_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800731 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700732 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800733 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700734 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800737 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700738}
739
740#define TYPE_SCTP_EVENT_TIMEOUT_T1_INIT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700741 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800742 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700743 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800744 TYPE_SCTP_FUNC(sctp_sf_t1_init_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700745 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800746 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700747 /* SCTP_STATE_ESTABLISHED */ \
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_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800750 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700751 /* SCTP_STATE_SHUTDOWN_SENT */ \
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_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800756 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700757}
758
759#define TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700760 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800761 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700762 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800763 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700764 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800765 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700766 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800767 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800769 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700770 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800771 TYPE_SCTP_FUNC(sctp_sf_t2_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700772 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800775 TYPE_SCTP_FUNC(sctp_sf_t2_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776}
777
778#define TYPE_SCTP_EVENT_TIMEOUT_T3_RTX { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800780 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700781 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800782 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700783 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800784 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700785 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800786 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800788 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800790 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700791 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800792 TYPE_SCTP_FUNC(sctp_sf_do_6_3_3_rtx), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700793 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800794 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795}
796
797#define TYPE_SCTP_EVENT_TIMEOUT_T4_RTO { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700798 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800799 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700800 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800801 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800803 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700804 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800805 TYPE_SCTP_FUNC(sctp_sf_t4_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700806 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800807 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700808 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800809 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700810 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800811 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800813 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700814}
815
816#define TYPE_SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800818 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700819 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800820 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700821 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800822 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700823 /* SCTP_STATE_ESTABLISHED */ \
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_SHUTDOWN_PENDING */ \
Thomas Graff8d96052011-07-07 00:28:35 +0000826 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700827 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800828 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700829 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800832 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700833}
834
835#define TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700836 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800837 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700838 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800839 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700840 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800841 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700842 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800843 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800845 TYPE_SCTP_FUNC(sctp_sf_sendbeat_8_3), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700846 /* SCTP_STATE_SHUTDOWN_SENT */ \
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_SHUTDOWN_RECEIVED */ \
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_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800851 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700852}
853
854#define TYPE_SCTP_EVENT_TIMEOUT_SACK { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700855 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800856 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700857 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800858 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700859 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800860 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700861 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800862 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700863 /* SCTP_STATE_SHUTDOWN_PENDING */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800864 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700865 /* SCTP_STATE_SHUTDOWN_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800866 TYPE_SCTP_FUNC(sctp_sf_do_6_2_sack), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700867 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800868 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700869 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800870 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700871}
872
873#define TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700874 /* SCTP_STATE_CLOSED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800875 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700876 /* SCTP_STATE_COOKIE_WAIT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800877 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700878 /* SCTP_STATE_COOKIE_ECHOED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800879 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700880 /* SCTP_STATE_ESTABLISHED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800881 TYPE_SCTP_FUNC(sctp_sf_autoclose_timer_expire), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700882 /* SCTP_STATE_SHUTDOWN_PENDING */ \
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_SHUTDOWN_SENT */ \
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_SHUTDOWN_RECEIVED */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800887 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700888 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
Peter Zijlstra1ed176a2006-11-13 16:19:07 -0800889 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700890}
891
892static const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES] = {
893 TYPE_SCTP_EVENT_TIMEOUT_NONE,
894 TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE,
895 TYPE_SCTP_EVENT_TIMEOUT_T1_INIT,
896 TYPE_SCTP_EVENT_TIMEOUT_T2_SHUTDOWN,
897 TYPE_SCTP_EVENT_TIMEOUT_T3_RTX,
898 TYPE_SCTP_EVENT_TIMEOUT_T4_RTO,
899 TYPE_SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD,
900 TYPE_SCTP_EVENT_TIMEOUT_HEARTBEAT,
901 TYPE_SCTP_EVENT_TIMEOUT_SACK,
902 TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE,
903};
904
Eric W. Biederman55e26eb2012-08-07 07:25:24 +0000905static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
906 sctp_cid_t cid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700907 sctp_state_t state)
908{
909 if (state > SCTP_STATE_MAX)
910 return &bug;
911
Bill Nottingham75202e72007-05-31 21:33:35 -0700912 if (cid <= SCTP_CID_BASE_MAX)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700913 return &chunk_event_table[cid][state];
914
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +0000915 if (net->sctp.prsctp_enable) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700916 if (cid == SCTP_CID_FWD_TSN)
917 return &prsctp_chunk_event_table[0][state];
918 }
919
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +0000920 if (net->sctp.addip_enable) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700921 if (cid == SCTP_CID_ASCONF)
922 return &addip_chunk_event_table[0][state];
923
924 if (cid == SCTP_CID_ASCONF_ACK)
925 return &addip_chunk_event_table[1][state];
926 }
927
Eric W. Biedermane1fc3b12012-08-07 07:29:57 +0000928 if (net->sctp.auth_enable) {
Vlad Yasevichbbd0d592007-10-03 17:51:34 -0700929 if (cid == SCTP_CID_AUTH)
930 return &auth_chunk_event_table[0][state];
931 }
932
Linus Torvalds1da177e2005-04-16 15:20:36 -0700933 return &chunk_event_table_unknown[state];
934}