1+ #define pr_fmt (fmt ) KBUILD_MODNAME ": " fmt
12#include <linux/module.h>
23#include <linux/skbuff.h>
34#include <net/ip.h>
@@ -15,12 +16,6 @@ MODULE_DESCRIPTION("Xtables: SCTP protocol packet match");
1516MODULE_ALIAS ("ipt_sctp" );
1617MODULE_ALIAS ("ip6t_sctp" );
1718
18- #ifdef DEBUG_SCTP
19- #define duprintf (format , args ...) printk(format , ## args)
20- #else
21- #define duprintf (format , args ...)
22- #endif
23-
2419#define SCCHECK (cond , option , flag , invflag ) (!((flag) & (option)) \
2520 || (!!((invflag) & (option)) ^ (cond)))
2621
@@ -52,7 +47,7 @@ match_packet(const struct sk_buff *skb,
5247 const struct xt_sctp_flag_info * flag_info = info -> flag_info ;
5348 int flag_count = info -> flag_count ;
5449
55- #ifdef DEBUG_SCTP
50+ #ifdef DEBUG
5651 int i = 0 ;
5752#endif
5853
@@ -62,17 +57,19 @@ match_packet(const struct sk_buff *skb,
6257 do {
6358 sch = skb_header_pointer (skb , offset , sizeof (_sch ), & _sch );
6459 if (sch == NULL || sch -> length == 0 ) {
65- duprintf ("Dropping invalid SCTP packet.\n" );
60+ pr_debug ("Dropping invalid SCTP packet.\n" );
6661 * hotdrop = true;
6762 return false;
6863 }
69-
70- duprintf ("Chunk num: %d\toffset: %d\ttype: %d\tlength: %d\tflags: %x\n" ,
71- ++ i , offset , sch -> type , htons (sch -> length ), sch -> flags );
72-
64+ #ifdef DEBUG
65+ pr_debug ("Chunk num: %d\toffset: %d\ttype: %d\tlength: %d"
66+ "\tflags: %x\n" ,
67+ ++ i , offset , sch -> type , htons (sch -> length ),
68+ sch -> flags );
69+ #endif
7370 offset += (ntohs (sch -> length ) + 3 ) & ~3 ;
7471
75- duprintf ("skb->len: %d\toffset: %d\n" , skb -> len , offset );
72+ pr_debug ("skb->len: %d\toffset: %d\n" , skb -> len , offset );
7673
7774 if (SCTP_CHUNKMAP_IS_SET (info -> chunkmap , sch -> type )) {
7875 switch (chunk_match_type ) {
@@ -124,17 +121,17 @@ sctp_mt(const struct sk_buff *skb, const struct xt_match_param *par)
124121 sctp_sctphdr_t _sh ;
125122
126123 if (par -> fragoff != 0 ) {
127- duprintf ("Dropping non-first fragment.. FIXME\n" );
124+ pr_debug ("Dropping non-first fragment.. FIXME\n" );
128125 return false;
129126 }
130127
131128 sh = skb_header_pointer (skb , par -> thoff , sizeof (_sh ), & _sh );
132129 if (sh == NULL ) {
133- duprintf ("Dropping evil TCP offset=0 tinygram.\n" );
130+ pr_debug ("Dropping evil TCP offset=0 tinygram.\n" );
134131 * par -> hotdrop = true;
135132 return false;
136133 }
137- duprintf ("spt: %d\tdpt: %d\n" , ntohs (sh -> source ), ntohs (sh -> dest ));
134+ pr_debug ("spt: %d\tdpt: %d\n" , ntohs (sh -> source ), ntohs (sh -> dest ));
138135
139136 return SCCHECK (ntohs (sh -> source ) >= info -> spts [0 ]
140137 && ntohs (sh -> source ) <= info -> spts [1 ],
0 commit comments