Skip to content

Commit 0d53778

Browse files
kaberDavid S. Miller
authored andcommitted
[NETFILTER]: Convert DEBUGP to pr_debug
Convert DEBUGP to pr_debug and fix lots of non-compiling debug statements. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 342b7e3 commit 0d53778

48 files changed

Lines changed: 662 additions & 970 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎include/linux/netfilter/nf_conntrack_pptp.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include <linux/netfilter/nf_conntrack_common.h>
66

7+
extern const char *pptp_msg_name[];
8+
79
/* state of the control session */
810
enum pptp_ctrlsess_state {
911
PPTP_SESSION_NONE, /* no session present */

‎include/net/netfilter/nf_conntrack_tuple.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ struct nf_conntrack_tuple_mask
120120

121121
#ifdef __KERNEL__
122122

123-
#define NF_CT_DUMP_TUPLE(tp) \
124-
DEBUGP("tuple %p: %u %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", \
125-
(tp), (tp)->src.l3num, (tp)->dst.protonum, \
126-
NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \
127-
NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all))
123+
#define NF_CT_DUMP_TUPLE(tp) \
124+
pr_debug("tuple %p: %u %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", \
125+
(tp), (tp)->src.l3num, (tp)->dst.protonum, \
126+
NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \
127+
NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all))
128128

129129
/* If we're the first tuple, it's the original dir. */
130130
#define NF_CT_DIRECTION(h) \

‎net/ipv4/netfilter/ipt_CLUSTERIP.c‎

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@
3030

3131
#define CLUSTERIP_VERSION "0.8"
3232

33-
#define DEBUG_CLUSTERIP
34-
35-
#ifdef DEBUG_CLUSTERIP
36-
#define DEBUGP printk
37-
#else
38-
#define DEBUGP
39-
#endif
40-
4133
MODULE_LICENSE("GPL");
4234
MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
4335
MODULE_DESCRIPTION("iptables target for CLUSTERIP");
@@ -351,15 +343,15 @@ target(struct sk_buff **pskb,
351343
break;
352344
}
353345

354-
#ifdef DEBUG_CLUSTERP
346+
#ifdef DEBUG
355347
DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
356348
#endif
357-
DEBUGP("hash=%u ct_hash=%u ", hash, ct->mark);
349+
pr_debug("hash=%u ct_hash=%u ", hash, ct->mark);
358350
if (!clusterip_responsible(cipinfo->config, hash)) {
359-
DEBUGP("not responsible\n");
351+
pr_debug("not responsible\n");
360352
return NF_DROP;
361353
}
362-
DEBUGP("responsible\n");
354+
pr_debug("responsible\n");
363355

364356
/* despite being received via linklayer multicast, this is
365357
* actually a unicast IP packet. TCP doesn't like PACKET_MULTICAST */
@@ -490,7 +482,7 @@ struct arp_payload {
490482
__be32 dst_ip;
491483
} __attribute__ ((packed));
492484

493-
#ifdef CLUSTERIP_DEBUG
485+
#ifdef DEBUG
494486
static void arp_print(struct arp_payload *payload)
495487
{
496488
#define HBUFFERLEN 30
@@ -546,17 +538,18 @@ arp_mangle(unsigned int hook,
546538
* this wouldn't work, since we didn't subscribe the mcast group on
547539
* other interfaces */
548540
if (c->dev != out) {
549-
DEBUGP("CLUSTERIP: not mangling arp reply on different "
550-
"interface: cip'%s'-skb'%s'\n", c->dev->name, out->name);
541+
pr_debug("CLUSTERIP: not mangling arp reply on different "
542+
"interface: cip'%s'-skb'%s'\n",
543+
c->dev->name, out->name);
551544
clusterip_config_put(c);
552545
return NF_ACCEPT;
553546
}
554547

555548
/* mangle reply hardware address */
556549
memcpy(payload->src_hw, c->clustermac, arp->ar_hln);
557550

558-
#ifdef CLUSTERIP_DEBUG
559-
DEBUGP(KERN_DEBUG "CLUSTERIP mangled arp reply: ");
551+
#ifdef DEBUG
552+
pr_debug(KERN_DEBUG "CLUSTERIP mangled arp reply: ");
560553
arp_print(payload);
561554
#endif
562555

‎net/ipv4/netfilter/ipt_LOG.c‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ MODULE_LICENSE("GPL");
2727
MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
2828
MODULE_DESCRIPTION("iptables syslog logging module");
2929

30-
#if 0
31-
#define DEBUGP printk
32-
#else
33-
#define DEBUGP(format, args...)
34-
#endif
35-
3630
/* Use lock to serialize, so printks don't overlap */
3731
static DEFINE_SPINLOCK(log_lock);
3832

@@ -452,12 +446,12 @@ static bool ipt_log_checkentry(const char *tablename,
452446
const struct ipt_log_info *loginfo = targinfo;
453447

454448
if (loginfo->level >= 8) {
455-
DEBUGP("LOG: level %u >= 8\n", loginfo->level);
449+
pr_debug("LOG: level %u >= 8\n", loginfo->level);
456450
return false;
457451
}
458452
if (loginfo->prefix[sizeof(loginfo->prefix)-1] != '\0') {
459-
DEBUGP("LOG: prefix term %i\n",
460-
loginfo->prefix[sizeof(loginfo->prefix)-1]);
453+
pr_debug("LOG: prefix term %i\n",
454+
loginfo->prefix[sizeof(loginfo->prefix)-1]);
461455
return false;
462456
}
463457
return true;

‎net/ipv4/netfilter/ipt_MASQUERADE.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ MODULE_LICENSE("GPL");
2727
MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
2828
MODULE_DESCRIPTION("iptables MASQUERADE target module");
2929

30-
#if 0
31-
#define DEBUGP printk
32-
#else
33-
#define DEBUGP(format, args...)
34-
#endif
35-
3630
/* Lock protects masq region inside conntrack */
3731
static DEFINE_RWLOCK(masq_lock);
3832

@@ -47,11 +41,11 @@ masquerade_check(const char *tablename,
4741
const struct nf_nat_multi_range_compat *mr = targinfo;
4842

4943
if (mr->range[0].flags & IP_NAT_RANGE_MAP_IPS) {
50-
DEBUGP("masquerade_check: bad MAP_IPS.\n");
44+
pr_debug("masquerade_check: bad MAP_IPS.\n");
5145
return false;
5246
}
5347
if (mr->rangesize != 1) {
54-
DEBUGP("masquerade_check: bad rangesize %u.\n", mr->rangesize);
48+
pr_debug("masquerade_check: bad rangesize %u\n", mr->rangesize);
5549
return false;
5650
}
5751
return true;

‎net/ipv4/netfilter/ipt_NETMAP.c‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,10 @@
1818
#include <linux/netfilter/x_tables.h>
1919
#include <net/netfilter/nf_nat_rule.h>
2020

21-
#define MODULENAME "NETMAP"
2221
MODULE_LICENSE("GPL");
2322
MODULE_AUTHOR("Svenning Soerensen <svenning@post5.tele.dk>");
2423
MODULE_DESCRIPTION("iptables 1:1 NAT mapping of IP networks target");
2524

26-
#if 0
27-
#define DEBUGP printk
28-
#else
29-
#define DEBUGP(format, args...)
30-
#endif
31-
3225
static bool
3326
check(const char *tablename,
3427
const void *e,
@@ -39,11 +32,11 @@ check(const char *tablename,
3932
const struct nf_nat_multi_range_compat *mr = targinfo;
4033

4134
if (!(mr->range[0].flags & IP_NAT_RANGE_MAP_IPS)) {
42-
DEBUGP(MODULENAME":check: bad MAP_IPS.\n");
35+
pr_debug("NETMAP:check: bad MAP_IPS.\n");
4336
return false;
4437
}
4538
if (mr->rangesize != 1) {
46-
DEBUGP(MODULENAME":check: bad rangesize %u.\n", mr->rangesize);
39+
pr_debug("NETMAP:check: bad rangesize %u.\n", mr->rangesize);
4740
return false;
4841
}
4942
return true;
@@ -86,7 +79,7 @@ target(struct sk_buff **pskb,
8679
}
8780

8881
static struct xt_target target_module __read_mostly = {
89-
.name = MODULENAME,
82+
.name = "NETMAP",
9083
.family = AF_INET,
9184
.target = target,
9285
.targetsize = sizeof(struct nf_nat_multi_range_compat),

‎net/ipv4/netfilter/ipt_REDIRECT.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ MODULE_LICENSE("GPL");
2525
MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
2626
MODULE_DESCRIPTION("iptables REDIRECT target module");
2727

28-
#if 0
29-
#define DEBUGP printk
30-
#else
31-
#define DEBUGP(format, args...)
32-
#endif
33-
3428
/* FIXME: Take multiple ranges --RR */
3529
static bool
3630
redirect_check(const char *tablename,
@@ -42,11 +36,11 @@ redirect_check(const char *tablename,
4236
const struct nf_nat_multi_range_compat *mr = targinfo;
4337

4438
if (mr->range[0].flags & IP_NAT_RANGE_MAP_IPS) {
45-
DEBUGP("redirect_check: bad MAP_IPS.\n");
39+
pr_debug("redirect_check: bad MAP_IPS.\n");
4640
return false;
4741
}
4842
if (mr->rangesize != 1) {
49-
DEBUGP("redirect_check: bad rangesize %u.\n", mr->rangesize);
43+
pr_debug("redirect_check: bad rangesize %u.\n", mr->rangesize);
5044
return false;
5145
}
5246
return true;

‎net/ipv4/netfilter/ipt_REJECT.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ MODULE_LICENSE("GPL");
3131
MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
3232
MODULE_DESCRIPTION("iptables REJECT target module");
3333

34-
#if 0
35-
#define DEBUGP printk
36-
#else
37-
#define DEBUGP(format, args...)
38-
#endif
39-
4034
/* Send RST reply */
4135
static void send_reset(struct sk_buff *oldskb, int hook)
4236
{
@@ -227,13 +221,13 @@ static bool check(const char *tablename,
227221
const struct ipt_entry *e = e_void;
228222

229223
if (rejinfo->with == IPT_ICMP_ECHOREPLY) {
230-
printk("REJECT: ECHOREPLY no longer supported.\n");
224+
printk("ipt_REJECT: ECHOREPLY no longer supported.\n");
231225
return false;
232226
} else if (rejinfo->with == IPT_TCP_RESET) {
233227
/* Must specify that it's a TCP packet */
234228
if (e->ip.proto != IPPROTO_TCP
235229
|| (e->ip.invflags & XT_INV_PROTO)) {
236-
DEBUGP("REJECT: TCP_RESET invalid for non-tcp\n");
230+
printk("ipt_REJECT: TCP_RESET invalid for non-tcp\n");
237231
return false;
238232
}
239233
}

‎net/ipv4/netfilter/ipt_SAME.c‎

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ MODULE_LICENSE("GPL");
2727
MODULE_AUTHOR("Martin Josefsson <gandalf@wlug.westbo.se>");
2828
MODULE_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-
3630
static bool
3731
same_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

114106
static 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

Comments
 (0)