2 * Connection tracking protocol helper module for SCTP.
4 * SCTP is defined in RFC 2960. References to various sections in this code
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * 17 Oct 2004: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
12 * - enable working with L3 protocol independent connection tracking.
14 * Derived from net/ipv4/ip_conntrack_sctp.c
18 * Added support for proc manipulation of timeouts.
21 #include <linux/types.h>
22 #include <linux/timer.h>
23 #include <linux/netfilter.h>
24 #include <linux/module.h>
27 #include <linux/sctp.h>
28 #include <linux/string.h>
29 #include <linux/seq_file.h>
30 #include <linux/spinlock.h>
31 #include <linux/interrupt.h>
33 #include <net/netfilter/nf_conntrack.h>
34 #include <net/netfilter/nf_conntrack_l4proto.h>
35 #include <net/netfilter/nf_conntrack_ecache.h>
38 #define DEBUGP(format, ...) printk(format, ## __VA_ARGS__)
40 #define DEBUGP(format, args...)
43 /* Protects conntrack->proto.sctp */
44 static DEFINE_RWLOCK(sctp_lock
);
46 /* FIXME: Examine ipfilter's timeouts and conntrack transitions more
47 closely. They're more complex. --RR
49 And so for me for SCTP :D -Kiran */
51 static const char *sctp_conntrack_names
[] = {
63 #define MINS * 60 SECS
64 #define HOURS * 60 MINS
65 #define DAYS * 24 HOURS
67 static unsigned int nf_ct_sctp_timeout_closed __read_mostly
= 10 SECS
;
68 static unsigned int nf_ct_sctp_timeout_cookie_wait __read_mostly
= 3 SECS
;
69 static unsigned int nf_ct_sctp_timeout_cookie_echoed __read_mostly
= 3 SECS
;
70 static unsigned int nf_ct_sctp_timeout_established __read_mostly
= 5 DAYS
;
71 static unsigned int nf_ct_sctp_timeout_shutdown_sent __read_mostly
= 300 SECS
/ 1000;
72 static unsigned int nf_ct_sctp_timeout_shutdown_recd __read_mostly
= 300 SECS
/ 1000;
73 static unsigned int nf_ct_sctp_timeout_shutdown_ack_sent __read_mostly
= 3 SECS
;
75 static unsigned int * sctp_timeouts
[]
76 = { NULL
, /* SCTP_CONNTRACK_NONE */
77 &nf_ct_sctp_timeout_closed
, /* SCTP_CONNTRACK_CLOSED */
78 &nf_ct_sctp_timeout_cookie_wait
, /* SCTP_CONNTRACK_COOKIE_WAIT */
79 &nf_ct_sctp_timeout_cookie_echoed
, /* SCTP_CONNTRACK_COOKIE_ECHOED */
80 &nf_ct_sctp_timeout_established
, /* SCTP_CONNTRACK_ESTABLISHED */
81 &nf_ct_sctp_timeout_shutdown_sent
, /* SCTP_CONNTRACK_SHUTDOWN_SENT */
82 &nf_ct_sctp_timeout_shutdown_recd
, /* SCTP_CONNTRACK_SHUTDOWN_RECD */
83 &nf_ct_sctp_timeout_shutdown_ack_sent
/* SCTP_CONNTRACK_SHUTDOWN_ACK_SENT */
86 #define sNO SCTP_CONNTRACK_NONE
87 #define sCL SCTP_CONNTRACK_CLOSED
88 #define sCW SCTP_CONNTRACK_COOKIE_WAIT
89 #define sCE SCTP_CONNTRACK_COOKIE_ECHOED
90 #define sES SCTP_CONNTRACK_ESTABLISHED
91 #define sSS SCTP_CONNTRACK_SHUTDOWN_SENT
92 #define sSR SCTP_CONNTRACK_SHUTDOWN_RECD
93 #define sSA SCTP_CONNTRACK_SHUTDOWN_ACK_SENT
94 #define sIV SCTP_CONNTRACK_MAX
97 These are the descriptions of the states:
99 NOTE: These state names are tantalizingly similar to the states of an
100 SCTP endpoint. But the interpretation of the states is a little different,
101 considering that these are the states of the connection and not of an end
102 point. Please note the subtleties. -Kiran
104 NONE - Nothing so far.
105 COOKIE WAIT - We have seen an INIT chunk in the original direction, or also
106 an INIT_ACK chunk in the reply direction.
107 COOKIE ECHOED - We have seen a COOKIE_ECHO chunk in the original direction.
108 ESTABLISHED - We have seen a COOKIE_ACK in the reply direction.
109 SHUTDOWN_SENT - We have seen a SHUTDOWN chunk in the original direction.
110 SHUTDOWN_RECD - We have seen a SHUTDOWN chunk in the reply directoin.
111 SHUTDOWN_ACK_SENT - We have seen a SHUTDOWN_ACK chunk in the direction opposite
112 to that of the SHUTDOWN chunk.
113 CLOSED - We have seen a SHUTDOWN_COMPLETE chunk in the direction of
114 the SHUTDOWN chunk. Connection is closed.
118 - I have assumed that the first INIT is in the original direction.
119 This messes things when an INIT comes in the reply direction in CLOSED
121 - Check the error type in the reply dir before transitioning from
122 cookie echoed to closed.
123 - Sec 5.2.4 of RFC 2960
124 - Multi Homing support.
127 /* SCTP conntrack state transitions */
128 static enum sctp_conntrack sctp_conntracks
[2][9][SCTP_CONNTRACK_MAX
] = {
131 /* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA */
132 /* init */ {sCW
, sCW
, sCW
, sCE
, sES
, sSS
, sSR
, sSA
},
133 /* init_ack */ {sCL
, sCL
, sCW
, sCE
, sES
, sSS
, sSR
, sSA
},
134 /* abort */ {sCL
, sCL
, sCL
, sCL
, sCL
, sCL
, sCL
, sCL
},
135 /* shutdown */ {sCL
, sCL
, sCW
, sCE
, sSS
, sSS
, sSR
, sSA
},
136 /* shutdown_ack */ {sSA
, sCL
, sCW
, sCE
, sES
, sSA
, sSA
, sSA
},
137 /* error */ {sCL
, sCL
, sCW
, sCE
, sES
, sSS
, sSR
, sSA
},/* Cant have Stale cookie*/
138 /* cookie_echo */ {sCL
, sCL
, sCE
, sCE
, sES
, sSS
, sSR
, sSA
},/* 5.2.4 - Big TODO */
139 /* cookie_ack */ {sCL
, sCL
, sCW
, sCE
, sES
, sSS
, sSR
, sSA
},/* Cant come in orig dir */
140 /* shutdown_comp*/ {sCL
, sCL
, sCW
, sCE
, sES
, sSS
, sSR
, sCL
}
144 /* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA */
145 /* init */ {sIV
, sCL
, sCW
, sCE
, sES
, sSS
, sSR
, sSA
},/* INIT in sCL Big TODO */
146 /* init_ack */ {sIV
, sCL
, sCW
, sCE
, sES
, sSS
, sSR
, sSA
},
147 /* abort */ {sIV
, sCL
, sCL
, sCL
, sCL
, sCL
, sCL
, sCL
},
148 /* shutdown */ {sIV
, sCL
, sCW
, sCE
, sSR
, sSS
, sSR
, sSA
},
149 /* shutdown_ack */ {sIV
, sCL
, sCW
, sCE
, sES
, sSA
, sSA
, sSA
},
150 /* error */ {sIV
, sCL
, sCW
, sCL
, sES
, sSS
, sSR
, sSA
},
151 /* cookie_echo */ {sIV
, sCL
, sCW
, sCE
, sES
, sSS
, sSR
, sSA
},/* Cant come in reply dir */
152 /* cookie_ack */ {sIV
, sCL
, sCW
, sES
, sES
, sSS
, sSR
, sSA
},
153 /* shutdown_comp*/ {sIV
, sCL
, sCW
, sCE
, sES
, sSS
, sSR
, sCL
}
157 static int sctp_pkt_to_tuple(const struct sk_buff
*skb
,
158 unsigned int dataoff
,
159 struct nf_conntrack_tuple
*tuple
)
161 sctp_sctphdr_t _hdr
, *hp
;
163 DEBUGP(__FUNCTION__
);
166 /* Actually only need first 8 bytes. */
167 hp
= skb_header_pointer(skb
, dataoff
, 8, &_hdr
);
171 tuple
->src
.u
.sctp
.port
= hp
->source
;
172 tuple
->dst
.u
.sctp
.port
= hp
->dest
;
176 static int sctp_invert_tuple(struct nf_conntrack_tuple
*tuple
,
177 const struct nf_conntrack_tuple
*orig
)
179 DEBUGP(__FUNCTION__
);
182 tuple
->src
.u
.sctp
.port
= orig
->dst
.u
.sctp
.port
;
183 tuple
->dst
.u
.sctp
.port
= orig
->src
.u
.sctp
.port
;
187 /* Print out the per-protocol part of the tuple. */
188 static int sctp_print_tuple(struct seq_file
*s
,
189 const struct nf_conntrack_tuple
*tuple
)
191 DEBUGP(__FUNCTION__
);
194 return seq_printf(s
, "sport=%hu dport=%hu ",
195 ntohs(tuple
->src
.u
.sctp
.port
),
196 ntohs(tuple
->dst
.u
.sctp
.port
));
199 /* Print out the private part of the conntrack. */
200 static int sctp_print_conntrack(struct seq_file
*s
,
201 const struct nf_conn
*conntrack
)
203 enum sctp_conntrack state
;
205 DEBUGP(__FUNCTION__
);
208 read_lock_bh(&sctp_lock
);
209 state
= conntrack
->proto
.sctp
.state
;
210 read_unlock_bh(&sctp_lock
);
212 return seq_printf(s
, "%s ", sctp_conntrack_names
[state
]);
215 #define for_each_sctp_chunk(skb, sch, _sch, offset, dataoff, count) \
216 for (offset = dataoff + sizeof(sctp_sctphdr_t), count = 0; \
217 offset < skb->len && \
218 (sch = skb_header_pointer(skb, offset, sizeof(_sch), &_sch)); \
219 offset += (ntohs(sch->length) + 3) & ~3, count++)
221 /* Some validity checks to make sure the chunks are fine */
222 static int do_basic_checks(struct nf_conn
*conntrack
,
223 const struct sk_buff
*skb
,
224 unsigned int dataoff
,
227 u_int32_t offset
, count
;
228 sctp_chunkhdr_t _sch
, *sch
;
231 DEBUGP(__FUNCTION__
);
236 for_each_sctp_chunk (skb
, sch
, _sch
, offset
, dataoff
, count
) {
237 DEBUGP("Chunk Num: %d Type: %d\n", count
, sch
->type
);
239 if (sch
->type
== SCTP_CID_INIT
240 || sch
->type
== SCTP_CID_INIT_ACK
241 || sch
->type
== SCTP_CID_SHUTDOWN_COMPLETE
) {
246 * Cookie Ack/Echo chunks not the first OR
247 * Init / Init Ack / Shutdown compl chunks not the only chunks
250 if (((sch
->type
== SCTP_CID_COOKIE_ACK
251 || sch
->type
== SCTP_CID_COOKIE_ECHO
253 && count
!=0) || !sch
->length
) {
254 DEBUGP("Basic checks failed\n");
259 set_bit(sch
->type
, (void *)map
);
263 DEBUGP("Basic checks passed\n");
267 static int new_state(enum ip_conntrack_dir dir
,
268 enum sctp_conntrack cur_state
,
273 DEBUGP(__FUNCTION__
);
276 DEBUGP("Chunk type: %d\n", chunk_type
);
278 switch (chunk_type
) {
280 DEBUGP("SCTP_CID_INIT\n");
282 case SCTP_CID_INIT_ACK
:
283 DEBUGP("SCTP_CID_INIT_ACK\n");
286 DEBUGP("SCTP_CID_ABORT\n");
288 case SCTP_CID_SHUTDOWN
:
289 DEBUGP("SCTP_CID_SHUTDOWN\n");
291 case SCTP_CID_SHUTDOWN_ACK
:
292 DEBUGP("SCTP_CID_SHUTDOWN_ACK\n");
295 DEBUGP("SCTP_CID_ERROR\n");
297 case SCTP_CID_COOKIE_ECHO
:
298 DEBUGP("SCTP_CID_COOKIE_ECHO\n");
300 case SCTP_CID_COOKIE_ACK
:
301 DEBUGP("SCTP_CID_COOKIE_ACK\n");
303 case SCTP_CID_SHUTDOWN_COMPLETE
:
304 DEBUGP("SCTP_CID_SHUTDOWN_COMPLETE\n");
307 /* Other chunks like DATA, SACK, HEARTBEAT and
308 its ACK do not cause a change in state */
309 DEBUGP("Unknown chunk type, Will stay in %s\n",
310 sctp_conntrack_names
[cur_state
]);
314 DEBUGP("dir: %d cur_state: %s chunk_type: %d new_state: %s\n",
315 dir
, sctp_conntrack_names
[cur_state
], chunk_type
,
316 sctp_conntrack_names
[sctp_conntracks
[dir
][i
][cur_state
]]);
318 return sctp_conntracks
[dir
][i
][cur_state
];
321 /* Returns verdict for packet, or -1 for invalid. */
322 static int sctp_packet(struct nf_conn
*conntrack
,
323 const struct sk_buff
*skb
,
324 unsigned int dataoff
,
325 enum ip_conntrack_info ctinfo
,
327 unsigned int hooknum
)
329 enum sctp_conntrack newconntrack
, oldsctpstate
;
330 sctp_sctphdr_t _sctph
, *sh
;
331 sctp_chunkhdr_t _sch
, *sch
;
332 u_int32_t offset
, count
;
333 char map
[256 / sizeof (char)] = {0};
335 DEBUGP(__FUNCTION__
);
338 sh
= skb_header_pointer(skb
, dataoff
, sizeof(_sctph
), &_sctph
);
342 if (do_basic_checks(conntrack
, skb
, dataoff
, map
) != 0)
345 /* Check the verification tag (Sec 8.5) */
346 if (!test_bit(SCTP_CID_INIT
, (void *)map
)
347 && !test_bit(SCTP_CID_SHUTDOWN_COMPLETE
, (void *)map
)
348 && !test_bit(SCTP_CID_COOKIE_ECHO
, (void *)map
)
349 && !test_bit(SCTP_CID_ABORT
, (void *)map
)
350 && !test_bit(SCTP_CID_SHUTDOWN_ACK
, (void *)map
)
351 && (sh
->vtag
!= conntrack
->proto
.sctp
.vtag
[CTINFO2DIR(ctinfo
)])) {
352 DEBUGP("Verification tag check failed\n");
356 oldsctpstate
= newconntrack
= SCTP_CONNTRACK_MAX
;
357 for_each_sctp_chunk (skb
, sch
, _sch
, offset
, dataoff
, count
) {
358 write_lock_bh(&sctp_lock
);
360 /* Special cases of Verification tag check (Sec 8.5.1) */
361 if (sch
->type
== SCTP_CID_INIT
) {
364 write_unlock_bh(&sctp_lock
);
367 } else if (sch
->type
== SCTP_CID_ABORT
) {
369 if (!(sh
->vtag
== conntrack
->proto
.sctp
.vtag
[CTINFO2DIR(ctinfo
)])
370 && !(sh
->vtag
== conntrack
->proto
.sctp
.vtag
371 [1 - CTINFO2DIR(ctinfo
)])) {
372 write_unlock_bh(&sctp_lock
);
375 } else if (sch
->type
== SCTP_CID_SHUTDOWN_COMPLETE
) {
377 if (!(sh
->vtag
== conntrack
->proto
.sctp
.vtag
[CTINFO2DIR(ctinfo
)])
378 && !(sh
->vtag
== conntrack
->proto
.sctp
.vtag
379 [1 - CTINFO2DIR(ctinfo
)]
380 && (sch
->flags
& 1))) {
381 write_unlock_bh(&sctp_lock
);
384 } else if (sch
->type
== SCTP_CID_COOKIE_ECHO
) {
386 if (!(sh
->vtag
== conntrack
->proto
.sctp
.vtag
[CTINFO2DIR(ctinfo
)])) {
387 write_unlock_bh(&sctp_lock
);
392 oldsctpstate
= conntrack
->proto
.sctp
.state
;
393 newconntrack
= new_state(CTINFO2DIR(ctinfo
), oldsctpstate
, sch
->type
);
396 if (newconntrack
== SCTP_CONNTRACK_MAX
) {
397 DEBUGP("nf_conntrack_sctp: Invalid dir=%i ctype=%u conntrack=%u\n",
398 CTINFO2DIR(ctinfo
), sch
->type
, oldsctpstate
);
399 write_unlock_bh(&sctp_lock
);
403 /* If it is an INIT or an INIT ACK note down the vtag */
404 if (sch
->type
== SCTP_CID_INIT
405 || sch
->type
== SCTP_CID_INIT_ACK
) {
406 sctp_inithdr_t _inithdr
, *ih
;
408 ih
= skb_header_pointer(skb
, offset
+ sizeof(sctp_chunkhdr_t
),
409 sizeof(_inithdr
), &_inithdr
);
411 write_unlock_bh(&sctp_lock
);
414 DEBUGP("Setting vtag %x for dir %d\n",
415 ih
->init_tag
, !CTINFO2DIR(ctinfo
));
416 conntrack
->proto
.sctp
.vtag
[!CTINFO2DIR(ctinfo
)] = ih
->init_tag
;
419 conntrack
->proto
.sctp
.state
= newconntrack
;
420 if (oldsctpstate
!= newconntrack
)
421 nf_conntrack_event_cache(IPCT_PROTOINFO
, skb
);
422 write_unlock_bh(&sctp_lock
);
425 nf_ct_refresh_acct(conntrack
, ctinfo
, skb
, *sctp_timeouts
[newconntrack
]);
427 if (oldsctpstate
== SCTP_CONNTRACK_COOKIE_ECHOED
428 && CTINFO2DIR(ctinfo
) == IP_CT_DIR_REPLY
429 && newconntrack
== SCTP_CONNTRACK_ESTABLISHED
) {
430 DEBUGP("Setting assured bit\n");
431 set_bit(IPS_ASSURED_BIT
, &conntrack
->status
);
432 nf_conntrack_event_cache(IPCT_STATUS
, skb
);
438 /* Called when a new connection for this protocol found. */
439 static int sctp_new(struct nf_conn
*conntrack
, const struct sk_buff
*skb
,
440 unsigned int dataoff
)
442 enum sctp_conntrack newconntrack
;
443 sctp_sctphdr_t _sctph
, *sh
;
444 sctp_chunkhdr_t _sch
, *sch
;
445 u_int32_t offset
, count
;
446 char map
[256 / sizeof (char)] = {0};
448 DEBUGP(__FUNCTION__
);
451 sh
= skb_header_pointer(skb
, dataoff
, sizeof(_sctph
), &_sctph
);
455 if (do_basic_checks(conntrack
, skb
, dataoff
, map
) != 0)
458 /* If an OOTB packet has any of these chunks discard (Sec 8.4) */
459 if ((test_bit (SCTP_CID_ABORT
, (void *)map
))
460 || (test_bit (SCTP_CID_SHUTDOWN_COMPLETE
, (void *)map
))
461 || (test_bit (SCTP_CID_COOKIE_ACK
, (void *)map
))) {
465 newconntrack
= SCTP_CONNTRACK_MAX
;
466 for_each_sctp_chunk (skb
, sch
, _sch
, offset
, dataoff
, count
) {
467 /* Don't need lock here: this conntrack not in circulation yet */
468 newconntrack
= new_state(IP_CT_DIR_ORIGINAL
,
469 SCTP_CONNTRACK_NONE
, sch
->type
);
471 /* Invalid: delete conntrack */
472 if (newconntrack
== SCTP_CONNTRACK_MAX
) {
473 DEBUGP("nf_conntrack_sctp: invalid new deleting.\n");
477 /* Copy the vtag into the state info */
478 if (sch
->type
== SCTP_CID_INIT
) {
480 sctp_inithdr_t _inithdr
, *ih
;
482 ih
= skb_header_pointer(skb
, offset
+ sizeof(sctp_chunkhdr_t
),
483 sizeof(_inithdr
), &_inithdr
);
487 DEBUGP("Setting vtag %x for new conn\n",
490 conntrack
->proto
.sctp
.vtag
[IP_CT_DIR_REPLY
] =
497 /* If it is a shutdown ack OOTB packet, we expect a return
498 shutdown complete, otherwise an ABORT Sec 8.4 (5) and (8) */
500 DEBUGP("Setting vtag %x for new conn OOTB\n",
502 conntrack
->proto
.sctp
.vtag
[IP_CT_DIR_REPLY
] = sh
->vtag
;
505 conntrack
->proto
.sctp
.state
= newconntrack
;
512 static unsigned int sctp_sysctl_table_users
;
513 static struct ctl_table_header
*sctp_sysctl_header
;
514 static struct ctl_table sctp_sysctl_table
[] = {
516 .ctl_name
= NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED
,
517 .procname
= "nf_conntrack_sctp_timeout_closed",
518 .data
= &nf_ct_sctp_timeout_closed
,
519 .maxlen
= sizeof(unsigned int),
521 .proc_handler
= &proc_dointvec_jiffies
,
524 .ctl_name
= NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT
,
525 .procname
= "nf_conntrack_sctp_timeout_cookie_wait",
526 .data
= &nf_ct_sctp_timeout_cookie_wait
,
527 .maxlen
= sizeof(unsigned int),
529 .proc_handler
= &proc_dointvec_jiffies
,
532 .ctl_name
= NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED
,
533 .procname
= "nf_conntrack_sctp_timeout_cookie_echoed",
534 .data
= &nf_ct_sctp_timeout_cookie_echoed
,
535 .maxlen
= sizeof(unsigned int),
537 .proc_handler
= &proc_dointvec_jiffies
,
540 .ctl_name
= NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED
,
541 .procname
= "nf_conntrack_sctp_timeout_established",
542 .data
= &nf_ct_sctp_timeout_established
,
543 .maxlen
= sizeof(unsigned int),
545 .proc_handler
= &proc_dointvec_jiffies
,
548 .ctl_name
= NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT
,
549 .procname
= "nf_conntrack_sctp_timeout_shutdown_sent",
550 .data
= &nf_ct_sctp_timeout_shutdown_sent
,
551 .maxlen
= sizeof(unsigned int),
553 .proc_handler
= &proc_dointvec_jiffies
,
556 .ctl_name
= NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD
,
557 .procname
= "nf_conntrack_sctp_timeout_shutdown_recd",
558 .data
= &nf_ct_sctp_timeout_shutdown_recd
,
559 .maxlen
= sizeof(unsigned int),
561 .proc_handler
= &proc_dointvec_jiffies
,
564 .ctl_name
= NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT
,
565 .procname
= "nf_conntrack_sctp_timeout_shutdown_ack_sent",
566 .data
= &nf_ct_sctp_timeout_shutdown_ack_sent
,
567 .maxlen
= sizeof(unsigned int),
569 .proc_handler
= &proc_dointvec_jiffies
,
576 #ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
577 static struct ctl_table sctp_compat_sysctl_table
[] = {
579 .ctl_name
= NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED
,
580 .procname
= "ip_conntrack_sctp_timeout_closed",
581 .data
= &nf_ct_sctp_timeout_closed
,
582 .maxlen
= sizeof(unsigned int),
584 .proc_handler
= &proc_dointvec_jiffies
,
587 .ctl_name
= NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT
,
588 .procname
= "ip_conntrack_sctp_timeout_cookie_wait",
589 .data
= &nf_ct_sctp_timeout_cookie_wait
,
590 .maxlen
= sizeof(unsigned int),
592 .proc_handler
= &proc_dointvec_jiffies
,
595 .ctl_name
= NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED
,
596 .procname
= "ip_conntrack_sctp_timeout_cookie_echoed",
597 .data
= &nf_ct_sctp_timeout_cookie_echoed
,
598 .maxlen
= sizeof(unsigned int),
600 .proc_handler
= &proc_dointvec_jiffies
,
603 .ctl_name
= NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED
,
604 .procname
= "ip_conntrack_sctp_timeout_established",
605 .data
= &nf_ct_sctp_timeout_established
,
606 .maxlen
= sizeof(unsigned int),
608 .proc_handler
= &proc_dointvec_jiffies
,
611 .ctl_name
= NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT
,
612 .procname
= "ip_conntrack_sctp_timeout_shutdown_sent",
613 .data
= &nf_ct_sctp_timeout_shutdown_sent
,
614 .maxlen
= sizeof(unsigned int),
616 .proc_handler
= &proc_dointvec_jiffies
,
619 .ctl_name
= NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD
,
620 .procname
= "ip_conntrack_sctp_timeout_shutdown_recd",
621 .data
= &nf_ct_sctp_timeout_shutdown_recd
,
622 .maxlen
= sizeof(unsigned int),
624 .proc_handler
= &proc_dointvec_jiffies
,
627 .ctl_name
= NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT
,
628 .procname
= "ip_conntrack_sctp_timeout_shutdown_ack_sent",
629 .data
= &nf_ct_sctp_timeout_shutdown_ack_sent
,
630 .maxlen
= sizeof(unsigned int),
632 .proc_handler
= &proc_dointvec_jiffies
,
638 #endif /* CONFIG_NF_CONNTRACK_PROC_COMPAT */
641 struct nf_conntrack_l4proto nf_conntrack_l4proto_sctp4
= {
643 .l4proto
= IPPROTO_SCTP
,
645 .pkt_to_tuple
= sctp_pkt_to_tuple
,
646 .invert_tuple
= sctp_invert_tuple
,
647 .print_tuple
= sctp_print_tuple
,
648 .print_conntrack
= sctp_print_conntrack
,
649 .packet
= sctp_packet
,
653 .ctl_table_users
= &sctp_sysctl_table_users
,
654 .ctl_table_header
= &sctp_sysctl_header
,
655 .ctl_table
= sctp_sysctl_table
,
656 #ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
657 .ctl_compat_table
= sctp_compat_sysctl_table
,
662 struct nf_conntrack_l4proto nf_conntrack_l4proto_sctp6
= {
664 .l4proto
= IPPROTO_SCTP
,
666 .pkt_to_tuple
= sctp_pkt_to_tuple
,
667 .invert_tuple
= sctp_invert_tuple
,
668 .print_tuple
= sctp_print_tuple
,
669 .print_conntrack
= sctp_print_conntrack
,
670 .packet
= sctp_packet
,
674 .ctl_table_users
= &sctp_sysctl_table_users
,
675 .ctl_table_header
= &sctp_sysctl_header
,
676 .ctl_table
= sctp_sysctl_table
,
680 int __init
nf_conntrack_proto_sctp_init(void)
684 ret
= nf_conntrack_l4proto_register(&nf_conntrack_l4proto_sctp4
);
686 printk("nf_conntrack_l4proto_sctp4: protocol register failed\n");
689 ret
= nf_conntrack_l4proto_register(&nf_conntrack_l4proto_sctp6
);
691 printk("nf_conntrack_l4proto_sctp6: protocol register failed\n");
698 nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_sctp4
);
700 DEBUGP("SCTP conntrack module loading %s\n",
701 ret
? "failed": "succeeded");
705 void __exit
nf_conntrack_proto_sctp_fini(void)
707 nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_sctp6
);
708 nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_sctp4
);
709 DEBUGP("SCTP conntrack module unloaded\n");
712 module_init(nf_conntrack_proto_sctp_init
);
713 module_exit(nf_conntrack_proto_sctp_fini
);
715 MODULE_LICENSE("GPL");
716 MODULE_AUTHOR("Kiran Kumar Immidi");
717 MODULE_DESCRIPTION("Netfilter connection tracking protocol helper for SCTP");
718 MODULE_ALIAS("ip_conntrack_proto_sctp");