@@ -27,12 +27,6 @@ MODULE_LICENSE("GPL");
2727MODULE_AUTHOR ("Martin Josefsson <gandalf@wlug.westbo.se>" );
2828MODULE_DESCRIPTION ("iptables special SNAT module for consistent sourceip" );
2929
30- #if 0
31- #define DEBUGP printk
32- #else
33- #define DEBUGP (format , args ...)
34- #endif
35-
3630static bool
3731same_check (const char * tablename ,
3832 const void * e ,
@@ -46,54 +40,52 @@ same_check(const char *tablename,
4640 mr -> ipnum = 0 ;
4741
4842 if (mr -> rangesize < 1 ) {
49- DEBUGP ("same_check: need at least one dest range.\n" );
43+ pr_debug ("same_check: need at least one dest range.\n" );
5044 return false;
5145 }
5246 if (mr -> rangesize > IPT_SAME_MAX_RANGE ) {
53- DEBUGP ("same_check: too many ranges specified, maximum "
54- "is %u ranges\n" ,
55- IPT_SAME_MAX_RANGE );
47+ pr_debug ("same_check: too many ranges specified, maximum "
48+ "is %u ranges\n" , IPT_SAME_MAX_RANGE );
5649 return false;
5750 }
5851 for (count = 0 ; count < mr -> rangesize ; count ++ ) {
5952 if (ntohl (mr -> range [count ].min_ip ) >
6053 ntohl (mr -> range [count ].max_ip )) {
61- DEBUGP ("same_check: min_ip is larger than max_ip in "
62- "range `%u.%u.%u.%u-%u.%u.%u.%u'.\n" ,
63- NIPQUAD (mr -> range [count ].min_ip ),
64- NIPQUAD (mr -> range [count ].max_ip ));
54+ pr_debug ("same_check: min_ip is larger than max_ip in "
55+ "range `%u.%u.%u.%u-%u.%u.%u.%u'.\n" ,
56+ NIPQUAD (mr -> range [count ].min_ip ),
57+ NIPQUAD (mr -> range [count ].max_ip ));
6558 return false;
6659 }
6760 if (!(mr -> range [count ].flags & IP_NAT_RANGE_MAP_IPS )) {
68- DEBUGP ("same_check: bad MAP_IPS.\n" );
61+ pr_debug ("same_check: bad MAP_IPS.\n" );
6962 return false;
7063 }
7164 rangeip = (ntohl (mr -> range [count ].max_ip ) -
7265 ntohl (mr -> range [count ].min_ip ) + 1 );
7366 mr -> ipnum += rangeip ;
7467
75- DEBUGP ("same_check: range %u, ipnum = %u\n" , count , rangeip );
68+ pr_debug ("same_check: range %u, ipnum = %u\n" , count , rangeip );
7669 }
77- DEBUGP ("same_check: total ipaddresses = %u\n" , mr -> ipnum );
70+ pr_debug ("same_check: total ipaddresses = %u\n" , mr -> ipnum );
7871
7972 mr -> iparray = kmalloc ((sizeof (u_int32_t ) * mr -> ipnum ), GFP_KERNEL );
8073 if (!mr -> iparray ) {
81- DEBUGP ("same_check: Couldn't allocate %u bytes "
82- "for %u ipaddresses!\n" ,
83- (sizeof (u_int32_t ) * mr -> ipnum ), mr -> ipnum );
74+ pr_debug ("same_check: Couldn't allocate %Zu bytes "
75+ "for %u ipaddresses!\n" ,
76+ (sizeof (u_int32_t ) * mr -> ipnum ), mr -> ipnum );
8477 return false;
8578 }
86- DEBUGP ("same_check: Allocated %u bytes for %u ipaddresses.\n" ,
87- (sizeof (u_int32_t ) * mr -> ipnum ), mr -> ipnum );
79+ pr_debug ("same_check: Allocated %Zu bytes for %u ipaddresses.\n" ,
80+ (sizeof (u_int32_t ) * mr -> ipnum ), mr -> ipnum );
8881
8982 for (count = 0 ; count < mr -> rangesize ; count ++ ) {
9083 for (countess = ntohl (mr -> range [count ].min_ip );
9184 countess <= ntohl (mr -> range [count ].max_ip );
9285 countess ++ ) {
9386 mr -> iparray [index ] = countess ;
94- DEBUGP ("same_check: Added ipaddress `%u.%u.%u.%u' "
95- "in index %u.\n" ,
96- HIPQUAD (countess ), index );
87+ pr_debug ("same_check: Added ipaddress `%u.%u.%u.%u' "
88+ "in index %u.\n" , HIPQUAD (countess ), index );
9789 index ++ ;
9890 }
9991 }
@@ -107,8 +99,8 @@ same_destroy(const struct xt_target *target, void *targinfo)
10799
108100 kfree (mr -> iparray );
109101
110- DEBUGP ("same_destroy: Deallocated %u bytes for %u ipaddresses.\n" ,
111- (sizeof (u_int32_t ) * mr -> ipnum ), mr -> ipnum );
102+ pr_debug ("same_destroy: Deallocated %Zu bytes for %u ipaddresses.\n" ,
103+ (sizeof (u_int32_t ) * mr -> ipnum ), mr -> ipnum );
112104}
113105
114106static unsigned int
@@ -146,10 +138,9 @@ same_target(struct sk_buff **pskb,
146138
147139 new_ip = htonl (same -> iparray [aindex ]);
148140
149- DEBUGP ("ipt_SAME: src=%u.%u.%u.%u dst=%u.%u.%u.%u, "
150- "new src=%u.%u.%u.%u\n" ,
151- NIPQUAD (t -> src .ip ), NIPQUAD (t -> dst .ip ),
152- NIPQUAD (new_ip ));
141+ pr_debug ("ipt_SAME: src=%u.%u.%u.%u dst=%u.%u.%u.%u, "
142+ "new src=%u.%u.%u.%u\n" ,
143+ NIPQUAD (t -> src .u3 .ip ), NIPQUAD (t -> dst .u3 .ip ), NIPQUAD (new_ip ));
153144
154145 /* Transfer from original range. */
155146 newrange = ((struct nf_nat_range )
0 commit comments