diff options
48 files changed, 662 insertions, 970 deletions
diff --git a/include/linux/netfilter/nf_conntrack_pptp.h b/include/linux/netfilter/nf_conntrack_pptp.h index 9d8144a488cd..c93061f33144 100644 --- a/include/linux/netfilter/nf_conntrack_pptp.h +++ b/include/linux/netfilter/nf_conntrack_pptp.h | |||
@@ -4,6 +4,8 @@ | |||
4 | 4 | ||
5 | #include <linux/netfilter/nf_conntrack_common.h> | 5 | #include <linux/netfilter/nf_conntrack_common.h> |
6 | 6 | ||
7 | extern const char *pptp_msg_name[]; | ||
8 | |||
7 | /* state of the control session */ | 9 | /* state of the control session */ |
8 | enum pptp_ctrlsess_state { | 10 | enum pptp_ctrlsess_state { |
9 | PPTP_SESSION_NONE, /* no session present */ | 11 | PPTP_SESSION_NONE, /* no session present */ |
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index 99934ab538e6..040dae5f0c9e 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h | |||
@@ -120,11 +120,11 @@ struct nf_conntrack_tuple_mask | |||
120 | 120 | ||
121 | #ifdef __KERNEL__ | 121 | #ifdef __KERNEL__ |
122 | 122 | ||
123 | #define NF_CT_DUMP_TUPLE(tp) \ | 123 | #define NF_CT_DUMP_TUPLE(tp) \ |
124 | DEBUGP("tuple %p: %u %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", \ | 124 | pr_debug("tuple %p: %u %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", \ |
125 | (tp), (tp)->src.l3num, (tp)->dst.protonum, \ | 125 | (tp), (tp)->src.l3num, (tp)->dst.protonum, \ |
126 | NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \ | 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)) | 127 | NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all)) |
128 | 128 | ||
129 | /* If we're the first tuple, it's the original dir. */ | 129 | /* If we're the first tuple, it's the original dir. */ |
130 | #define NF_CT_DIRECTION(h) \ | 130 | #define NF_CT_DIRECTION(h) \ |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 1981acedbfe8..8bacda3f6f6c 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -30,14 +30,6 @@ | |||
30 | 30 | ||
31 | #define CLUSTERIP_VERSION "0.8" | 31 | #define CLUSTERIP_VERSION "0.8" |
32 | 32 | ||
33 | #define DEBUG_CLUSTERIP | ||
34 | |||
35 | #ifdef DEBUG_CLUSTERIP | ||
36 | #define DEBUGP printk | ||
37 | #else | ||
38 | #define DEBUGP | ||
39 | #endif | ||
40 | |||
41 | MODULE_LICENSE("GPL"); | 33 | MODULE_LICENSE("GPL"); |
42 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); | 34 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); |
43 | MODULE_DESCRIPTION("iptables target for CLUSTERIP"); | 35 | MODULE_DESCRIPTION("iptables target for CLUSTERIP"); |
@@ -351,15 +343,15 @@ target(struct sk_buff **pskb, | |||
351 | break; | 343 | break; |
352 | } | 344 | } |
353 | 345 | ||
354 | #ifdef DEBUG_CLUSTERP | 346 | #ifdef DEBUG |
355 | DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); | 347 | DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); |
356 | #endif | 348 | #endif |
357 | DEBUGP("hash=%u ct_hash=%u ", hash, ct->mark); | 349 | pr_debug("hash=%u ct_hash=%u ", hash, ct->mark); |
358 | if (!clusterip_responsible(cipinfo->config, hash)) { | 350 | if (!clusterip_responsible(cipinfo->config, hash)) { |
359 | DEBUGP("not responsible\n"); | 351 | pr_debug("not responsible\n"); |
360 | return NF_DROP; | 352 | return NF_DROP; |
361 | } | 353 | } |
362 | DEBUGP("responsible\n"); | 354 | pr_debug("responsible\n"); |
363 | 355 | ||
364 | /* despite being received via linklayer multicast, this is | 356 | /* despite being received via linklayer multicast, this is |
365 | * actually a unicast IP packet. TCP doesn't like PACKET_MULTICAST */ | 357 | * actually a unicast IP packet. TCP doesn't like PACKET_MULTICAST */ |
@@ -490,7 +482,7 @@ struct arp_payload { | |||
490 | __be32 dst_ip; | 482 | __be32 dst_ip; |
491 | } __attribute__ ((packed)); | 483 | } __attribute__ ((packed)); |
492 | 484 | ||
493 | #ifdef CLUSTERIP_DEBUG | 485 | #ifdef DEBUG |
494 | static void arp_print(struct arp_payload *payload) | 486 | static void arp_print(struct arp_payload *payload) |
495 | { | 487 | { |
496 | #define HBUFFERLEN 30 | 488 | #define HBUFFERLEN 30 |
@@ -546,8 +538,9 @@ arp_mangle(unsigned int hook, | |||
546 | * this wouldn't work, since we didn't subscribe the mcast group on | 538 | * this wouldn't work, since we didn't subscribe the mcast group on |
547 | * other interfaces */ | 539 | * other interfaces */ |
548 | if (c->dev != out) { | 540 | if (c->dev != out) { |
549 | DEBUGP("CLUSTERIP: not mangling arp reply on different " | 541 | pr_debug("CLUSTERIP: not mangling arp reply on different " |
550 | "interface: cip'%s'-skb'%s'\n", c->dev->name, out->name); | 542 | "interface: cip'%s'-skb'%s'\n", |
543 | c->dev->name, out->name); | ||
551 | clusterip_config_put(c); | 544 | clusterip_config_put(c); |
552 | return NF_ACCEPT; | 545 | return NF_ACCEPT; |
553 | } | 546 | } |
@@ -555,8 +548,8 @@ arp_mangle(unsigned int hook, | |||
555 | /* mangle reply hardware address */ | 548 | /* mangle reply hardware address */ |
556 | memcpy(payload->src_hw, c->clustermac, arp->ar_hln); | 549 | memcpy(payload->src_hw, c->clustermac, arp->ar_hln); |
557 | 550 | ||
558 | #ifdef CLUSTERIP_DEBUG | 551 | #ifdef DEBUG |
559 | DEBUGP(KERN_DEBUG "CLUSTERIP mangled arp reply: "); | 552 | pr_debug(KERN_DEBUG "CLUSTERIP mangled arp reply: "); |
560 | arp_print(payload); | 553 | arp_print(payload); |
561 | #endif | 554 | #endif |
562 | 555 | ||
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c index 9bfce614ec28..5937ad150b9f 100644 --- a/net/ipv4/netfilter/ipt_LOG.c +++ b/net/ipv4/netfilter/ipt_LOG.c | |||
@@ -27,12 +27,6 @@ MODULE_LICENSE("GPL"); | |||
27 | MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>"); | 27 | MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>"); |
28 | MODULE_DESCRIPTION("iptables syslog logging module"); | 28 | MODULE_DESCRIPTION("iptables syslog logging module"); |
29 | 29 | ||
30 | #if 0 | ||
31 | #define DEBUGP printk | ||
32 | #else | ||
33 | #define DEBUGP(format, args...) | ||
34 | #endif | ||
35 | |||
36 | /* Use lock to serialize, so printks don't overlap */ | 30 | /* Use lock to serialize, so printks don't overlap */ |
37 | static DEFINE_SPINLOCK(log_lock); | 31 | static DEFINE_SPINLOCK(log_lock); |
38 | 32 | ||
@@ -452,12 +446,12 @@ static bool ipt_log_checkentry(const char *tablename, | |||
452 | const struct ipt_log_info *loginfo = targinfo; | 446 | const struct ipt_log_info *loginfo = targinfo; |
453 | 447 | ||
454 | if (loginfo->level >= 8) { | 448 | if (loginfo->level >= 8) { |
455 | DEBUGP("LOG: level %u >= 8\n", loginfo->level); | 449 | pr_debug("LOG: level %u >= 8\n", loginfo->level); |
456 | return false; | 450 | return false; |
457 | } | 451 | } |
458 | if (loginfo->prefix[sizeof(loginfo->prefix)-1] != '\0') { | 452 | if (loginfo->prefix[sizeof(loginfo->prefix)-1] != '\0') { |
459 | DEBUGP("LOG: prefix term %i\n", | 453 | pr_debug("LOG: prefix term %i\n", |
460 | loginfo->prefix[sizeof(loginfo->prefix)-1]); | 454 | loginfo->prefix[sizeof(loginfo->prefix)-1]); |
461 | return false; | 455 | return false; |
462 | } | 456 | } |
463 | return true; | 457 | return true; |
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c index bc033e0f424d..7c4e4be7c8b3 100644 --- a/net/ipv4/netfilter/ipt_MASQUERADE.c +++ b/net/ipv4/netfilter/ipt_MASQUERADE.c | |||
@@ -27,12 +27,6 @@ MODULE_LICENSE("GPL"); | |||
27 | MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>"); | 27 | MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>"); |
28 | MODULE_DESCRIPTION("iptables MASQUERADE target module"); | 28 | MODULE_DESCRIPTION("iptables MASQUERADE target module"); |
29 | 29 | ||
30 | #if 0 | ||
31 | #define DEBUGP printk | ||
32 | #else | ||
33 | #define DEBUGP(format, args...) | ||
34 | #endif | ||
35 | |||
36 | /* Lock protects masq region inside conntrack */ | 30 | /* Lock protects masq region inside conntrack */ |
37 | static DEFINE_RWLOCK(masq_lock); | 31 | static DEFINE_RWLOCK(masq_lock); |
38 | 32 | ||
@@ -47,11 +41,11 @@ masquerade_check(const char *tablename, | |||
47 | const struct nf_nat_multi_range_compat *mr = targinfo; | 41 | const struct nf_nat_multi_range_compat *mr = targinfo; |
48 | 42 | ||
49 | if (mr->range[0].flags & IP_NAT_RANGE_MAP_IPS) { | 43 | 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"); |
51 | return false; | 45 | return false; |
52 | } | 46 | } |
53 | if (mr->rangesize != 1) { | 47 | 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); |
55 | return false; | 49 | return false; |
56 | } | 50 | } |
57 | return true; | 51 | return true; |
diff --git a/net/ipv4/netfilter/ipt_NETMAP.c b/net/ipv4/netfilter/ipt_NETMAP.c index 0a7ce15bbdd0..41a011d5a065 100644 --- a/net/ipv4/netfilter/ipt_NETMAP.c +++ b/net/ipv4/netfilter/ipt_NETMAP.c | |||
@@ -18,17 +18,10 @@ | |||
18 | #include <linux/netfilter/x_tables.h> | 18 | #include <linux/netfilter/x_tables.h> |
19 | #include <net/netfilter/nf_nat_rule.h> | 19 | #include <net/netfilter/nf_nat_rule.h> |
20 | 20 | ||
21 | #define MODULENAME "NETMAP" | ||
22 | MODULE_LICENSE("GPL"); | 21 | MODULE_LICENSE("GPL"); |
23 | MODULE_AUTHOR("Svenning Soerensen <svenning@post5.tele.dk>"); | 22 | MODULE_AUTHOR("Svenning Soerensen <svenning@post5.tele.dk>"); |
24 | MODULE_DESCRIPTION("iptables 1:1 NAT mapping of IP networks target"); | 23 | MODULE_DESCRIPTION("iptables 1:1 NAT mapping of IP networks target"); |
25 | 24 | ||
26 | #if 0 | ||
27 | #define DEBUGP printk | ||
28 | #else | ||
29 | #define DEBUGP(format, args...) | ||
30 | #endif | ||
31 | |||
32 | static bool | 25 | static bool |
33 | check(const char *tablename, | 26 | check(const char *tablename, |
34 | const void *e, | 27 | const void *e, |
@@ -39,11 +32,11 @@ check(const char *tablename, | |||
39 | const struct nf_nat_multi_range_compat *mr = targinfo; | 32 | const struct nf_nat_multi_range_compat *mr = targinfo; |
40 | 33 | ||
41 | if (!(mr->range[0].flags & IP_NAT_RANGE_MAP_IPS)) { | 34 | 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"); |
43 | return false; | 36 | return false; |
44 | } | 37 | } |
45 | if (mr->rangesize != 1) { | 38 | 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); |
47 | return false; | 40 | return false; |
48 | } | 41 | } |
49 | return true; | 42 | return true; |
@@ -86,7 +79,7 @@ target(struct sk_buff **pskb, | |||
86 | } | 79 | } |
87 | 80 | ||
88 | static struct xt_target target_module __read_mostly = { | 81 | static struct xt_target target_module __read_mostly = { |
89 | .name = MODULENAME, | 82 | .name = "NETMAP", |
90 | .family = AF_INET, | 83 | .family = AF_INET, |
91 | .target = target, | 84 | .target = target, |
92 | .targetsize = sizeof(struct nf_nat_multi_range_compat), | 85 | .targetsize = sizeof(struct nf_nat_multi_range_compat), |
diff --git a/net/ipv4/netfilter/ipt_REDIRECT.c b/net/ipv4/netfilter/ipt_REDIRECT.c index 61e1e4772e37..6ac7a2373316 100644 --- a/net/ipv4/netfilter/ipt_REDIRECT.c +++ b/net/ipv4/netfilter/ipt_REDIRECT.c | |||
@@ -25,12 +25,6 @@ MODULE_LICENSE("GPL"); | |||
25 | MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>"); | 25 | MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>"); |
26 | MODULE_DESCRIPTION("iptables REDIRECT target module"); | 26 | MODULE_DESCRIPTION("iptables REDIRECT target module"); |
27 | 27 | ||
28 | #if 0 | ||
29 | #define DEBUGP printk | ||
30 | #else | ||
31 | #define DEBUGP(format, args...) | ||
32 | #endif | ||
33 | |||
34 | /* FIXME: Take multiple ranges --RR */ | 28 | /* FIXME: Take multiple ranges --RR */ |
35 | static bool | 29 | static bool |
36 | redirect_check(const char *tablename, | 30 | redirect_check(const char *tablename, |
@@ -42,11 +36,11 @@ redirect_check(const char *tablename, | |||
42 | const struct nf_nat_multi_range_compat *mr = targinfo; | 36 | const struct nf_nat_multi_range_compat *mr = targinfo; |
43 | 37 | ||
44 | if (mr->range[0].flags & IP_NAT_RANGE_MAP_IPS) { | 38 | 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"); |
46 | return false; | 40 | return false; |
47 | } | 41 | } |
48 | if (mr->rangesize != 1) { | 42 | 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); |
50 | return false; | 44 | return false; |
51 | } | 45 | } |
52 | return true; | 46 | return true; |
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c index dd5432c3f365..cb038c8fbc9d 100644 --- a/net/ipv4/netfilter/ipt_REJECT.c +++ b/net/ipv4/netfilter/ipt_REJECT.c | |||
@@ -31,12 +31,6 @@ MODULE_LICENSE("GPL"); | |||
31 | MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>"); | 31 | MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>"); |
32 | MODULE_DESCRIPTION("iptables REJECT target module"); | 32 | MODULE_DESCRIPTION("iptables REJECT target module"); |
33 | 33 | ||
34 | #if 0 | ||
35 | #define DEBUGP printk | ||
36 | #else | ||
37 | #define DEBUGP(format, args...) | ||
38 | #endif | ||
39 | |||
40 | /* Send RST reply */ | 34 | /* Send RST reply */ |
41 | static void send_reset(struct sk_buff *oldskb, int hook) | 35 | static void send_reset(struct sk_buff *oldskb, int hook) |
42 | { | 36 | { |
@@ -227,13 +221,13 @@ static bool check(const char *tablename, | |||
227 | const struct ipt_entry *e = e_void; | 221 | const struct ipt_entry *e = e_void; |
228 | 222 | ||
229 | if (rejinfo->with == IPT_ICMP_ECHOREPLY) { | 223 | if (rejinfo->with == IPT_ICMP_ECHOREPLY) { |
230 | printk("REJECT: ECHOREPLY no longer supported.\n"); | 224 | printk("ipt_REJECT: ECHOREPLY no longer supported.\n"); |
231 | return false; | 225 | return false; |
232 | } else if (rejinfo->with == IPT_TCP_RESET) { | 226 | } else if (rejinfo->with == IPT_TCP_RESET) { |
233 | /* Must specify that it's a TCP packet */ | 227 | /* Must specify that it's a TCP packet */ |
234 | if (e->ip.proto != IPPROTO_TCP | 228 | if (e->ip.proto != IPPROTO_TCP |
235 | || (e->ip.invflags & XT_INV_PROTO)) { | 229 | || (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"); |
237 | return false; | 231 | return false; |
238 | } | 232 | } |
239 | } | 233 | } |
diff --git a/net/ipv4/netfilter/ipt_SAME.c b/net/ipv4/netfilter/ipt_SAME.c index 3a0d7dac0af8..97641f1a97f6 100644 --- a/net/ipv4/netfilter/ipt_SAME.c +++ b/net/ipv4/netfilter/ipt_SAME.c | |||
@@ -27,12 +27,6 @@ MODULE_LICENSE("GPL"); | |||
27 | MODULE_AUTHOR("Martin Josefsson <gandalf@wlug.westbo.se>"); | 27 | MODULE_AUTHOR("Martin Josefsson <gandalf@wlug.westbo.se>"); |
28 | MODULE_DESCRIPTION("iptables special SNAT module for consistent sourceip"); | 28 | MODULE_DESCRIPTION("iptables special SNAT module for consistent sourceip"); |
29 | 29 | ||
30 | #if 0 | ||
31 | #define DEBUGP printk | ||
32 | #else | ||
33 | #define DEBUGP(format, args...) | ||
34 | #endif | ||
35 | |||
36 | static bool | 30 | static bool |
37 | same_check(const char *tablename, | 31 | same_check(const char *tablename, |
38 | const void *e, | 32 | const void *e, |
@@ -46,54 +40,52 @@ same_check(const char *tablename, | |||
46 | mr->ipnum = 0; | 40 | mr->ipnum = 0; |
47 | 41 | ||
48 | if (mr->rangesize < 1) { | 42 | 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"); |
50 | return false; | 44 | return false; |
51 | } | 45 | } |
52 | if (mr->rangesize > IPT_SAME_MAX_RANGE) { | 46 | if (mr->rangesize > IPT_SAME_MAX_RANGE) { |
53 | DEBUGP("same_check: too many ranges specified, maximum " | 47 | pr_debug("same_check: too many ranges specified, maximum " |
54 | "is %u ranges\n", | 48 | "is %u ranges\n", IPT_SAME_MAX_RANGE); |
55 | IPT_SAME_MAX_RANGE); | ||
56 | return false; | 49 | return false; |
57 | } | 50 | } |
58 | for (count = 0; count < mr->rangesize; count++) { | 51 | for (count = 0; count < mr->rangesize; count++) { |
59 | if (ntohl(mr->range[count].min_ip) > | 52 | if (ntohl(mr->range[count].min_ip) > |
60 | ntohl(mr->range[count].max_ip)) { | 53 | ntohl(mr->range[count].max_ip)) { |
61 | DEBUGP("same_check: min_ip is larger than max_ip in " | 54 | pr_debug("same_check: min_ip is larger than max_ip in " |
62 | "range `%u.%u.%u.%u-%u.%u.%u.%u'.\n", | 55 | "range `%u.%u.%u.%u-%u.%u.%u.%u'.\n", |
63 | NIPQUAD(mr->range[count].min_ip), | 56 | NIPQUAD(mr->range[count].min_ip), |
64 | NIPQUAD(mr->range[count].max_ip)); | 57 | NIPQUAD(mr->range[count].max_ip)); |
65 | return false; | 58 | return false; |
66 | } | 59 | } |
67 | if (!(mr->range[count].flags & IP_NAT_RANGE_MAP_IPS)) { | 60 | 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"); |
69 | return false; | 62 | return false; |
70 | } | 63 | } |
71 | rangeip = (ntohl(mr->range[count].max_ip) - | 64 | rangeip = (ntohl(mr->range[count].max_ip) - |
72 | ntohl(mr->range[count].min_ip) + 1); | 65 | ntohl(mr->range[count].min_ip) + 1); |
73 | mr->ipnum += rangeip; | 66 | mr->ipnum += rangeip; |
74 | 67 | ||
75 | DEBUGP("same_check: range %u, ipnum = %u\n", count, rangeip); | 68 | pr_debug("same_check: range %u, ipnum = %u\n", count, rangeip); |
76 | } | 69 | } |
77 | DEBUGP("same_check: total ipaddresses = %u\n", mr->ipnum); | 70 | pr_debug("same_check: total ipaddresses = %u\n", mr->ipnum); |
78 | 71 | ||
79 | mr->iparray = kmalloc((sizeof(u_int32_t) * mr->ipnum), GFP_KERNEL); | 72 | mr->iparray = kmalloc((sizeof(u_int32_t) * mr->ipnum), GFP_KERNEL); |
80 | if (!mr->iparray) { | 73 | if (!mr->iparray) { |
81 | DEBUGP("same_check: Couldn't allocate %u bytes " | 74 | pr_debug("same_check: Couldn't allocate %Zu bytes " |
82 | "for %u ipaddresses!\n", | 75 | "for %u ipaddresses!\n", |
83 | (sizeof(u_int32_t) * mr->ipnum), mr->ipnum); | 76 | (sizeof(u_int32_t) * mr->ipnum), mr->ipnum); |
84 | return false; | 77 | return false; |
85 | } | 78 | } |
86 | DEBUGP("same_check: Allocated %u bytes for %u ipaddresses.\n", | 79 | pr_debug("same_check: Allocated %Zu bytes for %u ipaddresses.\n", |
87 | (sizeof(u_int32_t) * mr->ipnum), mr->ipnum); | 80 | (sizeof(u_int32_t) * mr->ipnum), mr->ipnum); |
88 | 81 | ||
89 | for (count = 0; count < mr->rangesize; count++) { | 82 | for (count = 0; count < mr->rangesize; count++) { |
90 | for (countess = ntohl(mr->range[count].min_ip); | 83 | for (countess = ntohl(mr->range[count].min_ip); |
91 | countess <= ntohl(mr->range[count].max_ip); | 84 | countess <= ntohl(mr->range[count].max_ip); |
92 | countess++) { | 85 | countess++) { |
93 | mr->iparray[index] = countess; | 86 | mr->iparray[index] = countess; |
94 | DEBUGP("same_check: Added ipaddress `%u.%u.%u.%u' " | 87 | pr_debug("same_check: Added ipaddress `%u.%u.%u.%u' " |
95 | "in index %u.\n", | 88 | "in index %u.\n", HIPQUAD(countess), index); |
96 | HIPQUAD(countess), index); | ||
97 | index++; | 89 | index++; |
98 | } | 90 | } |
99 | } | 91 | } |
@@ -107,8 +99,8 @@ same_destroy(const struct xt_target *target, void *targinfo) | |||
107 | 99 | ||
108 | kfree(mr->iparray); | 100 | kfree(mr->iparray); |
109 | 101 | ||
110 | DEBUGP("same_destroy: Deallocated %u bytes for %u ipaddresses.\n", | 102 | pr_debug("same_destroy: Deallocated %Zu bytes for %u ipaddresses.\n", |
111 | (sizeof(u_int32_t) * mr->ipnum), mr->ipnum); | 103 | (sizeof(u_int32_t) * mr->ipnum), mr->ipnum); |
112 | } | 104 | } |
113 | 105 | ||
114 | static unsigned int | 106 | static unsigned int |
@@ -146,10 +138,9 @@ same_target(struct sk_buff **pskb, | |||
146 | 138 | ||
147 | new_ip = htonl(same->iparray[aindex]); | 139 | new_ip = htonl(same->iparray[aindex]); |
148 | 140 | ||
149 | DEBUGP("ipt_SAME: src=%u.%u.%u.%u dst=%u.%u.%u.%u, " | 141 | pr_debug("ipt_SAME: src=%u.%u.%u.%u dst=%u.%u.%u.%u, " |
150 | "new src=%u.%u.%u.%u\n", | 142 | "new src=%u.%u.%u.%u\n", |
151 | NIPQUAD(t->src.ip), NIPQUAD(t->dst.ip), | 143 | NIPQUAD(t->src.u3.ip), NIPQUAD(t->dst.u3.ip), NIPQUAD(new_ip)); |
152 | NIPQUAD(new_ip)); | ||
153 | 144 | ||
154 | /* Transfer from original range. */ | 145 | /* Transfer from original range. */ |
155 | newrange = ((struct nf_nat_range) | 146 | newrange = ((struct nf_nat_range) |
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c index 226750d1f89b..6ca43e4ca7e3 100644 --- a/net/ipv4/netfilter/ipt_ULOG.c +++ b/net/ipv4/netfilter/ipt_ULOG.c | |||
@@ -55,13 +55,6 @@ MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_NFLOG); | |||
55 | #define ULOG_NL_EVENT 111 /* Harald's favorite number */ | 55 | #define ULOG_NL_EVENT 111 /* Harald's favorite number */ |
56 | #define ULOG_MAXNLGROUPS 32 /* numer of nlgroups */ | 56 | #define ULOG_MAXNLGROUPS 32 /* numer of nlgroups */ |
57 | 57 | ||
58 | #if 0 | ||
59 | #define DEBUGP(format, args...) printk("%s:%s:" format, \ | ||
60 | __FILE__, __FUNCTION__ , ## args) | ||
61 | #else | ||
62 | #define DEBUGP(format, args...) | ||
63 | #endif | ||
64 | |||
65 | #define PRINTR(format, args...) do { if (net_ratelimit()) printk(format , ## args); } while (0) | 58 | #define PRINTR(format, args...) do { if (net_ratelimit()) printk(format , ## args); } while (0) |
66 | 59 | ||
67 | static unsigned int nlbufsiz = NLMSG_GOODSIZE; | 60 | static unsigned int nlbufsiz = NLMSG_GOODSIZE; |
@@ -96,12 +89,12 @@ static void ulog_send(unsigned int nlgroupnum) | |||
96 | ulog_buff_t *ub = &ulog_buffers[nlgroupnum]; | 89 | ulog_buff_t *ub = &ulog_buffers[nlgroupnum]; |
97 | 90 | ||
98 | if (timer_pending(&ub->timer)) { | 91 | if (timer_pending(&ub->timer)) { |
99 | DEBUGP("ipt_ULOG: ulog_send: timer was pending, deleting\n"); | 92 | pr_debug("ipt_ULOG: ulog_send: timer was pending, deleting\n"); |
100 | del_timer(&ub->timer); | 93 | del_timer(&ub->timer); |
101 | } | 94 | } |
102 | 95 | ||
103 | if (!ub->skb) { | 96 | if (!ub->skb) { |
104 | DEBUGP("ipt_ULOG: ulog_send: nothing to send\n"); | 97 | pr_debug("ipt_ULOG: ulog_send: nothing to send\n"); |
105 | return; | 98 | return; |
106 | } | 99 | } |
107 | 100 | ||
@@ -110,8 +103,8 @@ static void ulog_send(unsigned int nlgroupnum) | |||
110 | ub->lastnlh->nlmsg_type = NLMSG_DONE; | 103 | ub->lastnlh->nlmsg_type = NLMSG_DONE; |
111 | 104 | ||
112 | NETLINK_CB(ub->skb).dst_group = nlgroupnum + 1; | 105 | NETLINK_CB(ub->skb).dst_group = nlgroupnum + 1; |
113 | DEBUGP("ipt_ULOG: throwing %d packets to netlink group %u\n", | 106 | pr_debug("ipt_ULOG: throwing %d packets to netlink group %u\n", |
114 | ub->qlen, nlgroupnum + 1); | 107 | ub->qlen, nlgroupnum + 1); |
115 | netlink_broadcast(nflognl, ub->skb, 0, nlgroupnum + 1, GFP_ATOMIC); | 108 | netlink_broadcast(nflognl, ub->skb, 0, nlgroupnum + 1, GFP_ATOMIC); |
116 | 109 | ||
117 | ub->qlen = 0; | 110 | ub->qlen = 0; |
@@ -123,7 +116,7 @@ static void ulog_send(unsigned int nlgroupnum) | |||
123 | /* timer function to flush queue in flushtimeout time */ | 116 | /* timer function to flush queue in flushtimeout time */ |
124 | static void ulog_timer(unsigned long data) | 117 | static void ulog_timer(unsigned long data) |
125 | { | 118 | { |
126 | DEBUGP("ipt_ULOG: timer function called, calling ulog_send\n"); | 119 | pr_debug("ipt_ULOG: timer function called, calling ulog_send\n"); |
127 | 120 | ||
128 | /* lock to protect against somebody modifying our structure | 121 | /* lock to protect against somebody modifying our structure |
129 | * from ipt_ulog_target at the same time */ | 122 | * from ipt_ulog_target at the same time */ |
@@ -204,8 +197,8 @@ static void ipt_ulog_packet(unsigned int hooknum, | |||
204 | goto alloc_failure; | 197 | goto alloc_failure; |
205 | } | 198 | } |
206 | 199 | ||
207 | DEBUGP("ipt_ULOG: qlen %d, qthreshold %d\n", ub->qlen, | 200 | pr_debug("ipt_ULOG: qlen %d, qthreshold %Zu\n", ub->qlen, |
208 | loginfo->qthreshold); | 201 | loginfo->qthreshold); |
209 | 202 | ||
210 | /* NLMSG_PUT contains a hidden goto nlmsg_failure !!! */ | 203 | /* NLMSG_PUT contains a hidden goto nlmsg_failure !!! */ |
211 | nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, ULOG_NL_EVENT, | 204 | nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, ULOG_NL_EVENT, |
@@ -334,13 +327,13 @@ static bool ipt_ulog_checkentry(const char *tablename, | |||
334 | const struct ipt_ulog_info *loginfo = targinfo; | 327 | const struct ipt_ulog_info *loginfo = targinfo; |
335 | 328 | ||
336 | if (loginfo->prefix[sizeof(loginfo->prefix) - 1] != '\0') { | 329 | if (loginfo->prefix[sizeof(loginfo->prefix) - 1] != '\0') { |
337 | DEBUGP("ipt_ULOG: prefix term %i\n", | 330 | pr_debug("ipt_ULOG: prefix term %i\n", |
338 | loginfo->prefix[sizeof(loginfo->prefix) - 1]); | 331 | loginfo->prefix[sizeof(loginfo->prefix) - 1]); |
339 | return false; | 332 | return false; |
340 | } | 333 | } |
341 | if (loginfo->qthreshold > ULOG_MAX_QLEN) { | 334 | if (loginfo->qthreshold > ULOG_MAX_QLEN) { |
342 | DEBUGP("ipt_ULOG: queue threshold %i > MAX_QLEN\n", | 335 | pr_debug("ipt_ULOG: queue threshold %Zu > MAX_QLEN\n", |
343 | loginfo->qthreshold); | 336 | loginfo->qthreshold); |
344 | return false; | 337 | return false; |
345 | } | 338 | } |
346 | return true; | 339 | return true; |
@@ -405,7 +398,7 @@ static int __init ipt_ulog_init(void) | |||
405 | { | 398 | { |
406 | int ret, i; | 399 | int ret, i; |
407 | 400 | ||
408 | DEBUGP("ipt_ULOG: init module\n"); | 401 | pr_debug("ipt_ULOG: init module\n"); |
409 | 402 | ||
410 | if (nlbufsiz > 128*1024) { | 403 | if (nlbufsiz > 128*1024) { |
411 | printk("Netlink buffer has to be <= 128kB\n"); | 404 | printk("Netlink buffer has to be <= 128kB\n"); |
@@ -437,7 +430,7 @@ static void __exit ipt_ulog_fini(void) | |||
437 | ulog_buff_t *ub; | 430 | ulog_buff_t *ub; |
438 | int i; | 431 | int i; |
439 | 432 | ||
440 | DEBUGP("ipt_ULOG: cleanup_module\n"); | 433 | pr_debug("ipt_ULOG: cleanup_module\n"); |
441 | 434 | ||
442 | if (nflog) | 435 | if (nflog) |
443 | nf_log_unregister(&ipt_ulog_logger); | 436 | nf_log_unregister(&ipt_ulog_logger); |
@@ -448,7 +441,7 @@ static void __exit ipt_ulog_fini(void) | |||
448 | for (i = 0; i < ULOG_MAXNLGROUPS; i++) { | 441 | for (i = 0; i < ULOG_MAXNLGROUPS; i++) { |
449 | ub = &ulog_buffers[i]; | 442 | ub = &ulog_buffers[i]; |
450 | if (timer_pending(&ub->timer)) { | 443 | if (timer_pending(&ub->timer)) { |
451 | DEBUGP("timer was pending, deleting\n"); | 444 | pr_debug("timer was pending, deleting\n"); |
452 | del_timer(&ub->timer); | 445 | del_timer(&ub->timer); |
453 | } | 446 | } |
454 | 447 | ||
diff --git a/net/ipv4/netfilter/ipt_iprange.c b/net/ipv4/netfilter/ipt_iprange.c index 6a3a033a6808..0106dc955a69 100644 --- a/net/ipv4/netfilter/ipt_iprange.c +++ b/net/ipv4/netfilter/ipt_iprange.c | |||
@@ -17,12 +17,6 @@ MODULE_LICENSE("GPL"); | |||
17 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 17 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); |
18 | MODULE_DESCRIPTION("iptables arbitrary IP range match module"); | 18 | MODULE_DESCRIPTION("iptables arbitrary IP range match module"); |
19 | 19 | ||
20 | #if 0 | ||
21 | #define DEBUGP printk | ||
22 | #else | ||
23 | #define DEBUGP(format, args...) | ||
24 | #endif | ||
25 | |||
26 | static bool | 20 | static bool |
27 | match(const struct sk_buff *skb, | 21 | match(const struct sk_buff *skb, |
28 | const struct net_device *in, | 22 | const struct net_device *in, |
@@ -38,12 +32,12 @@ match(const struct sk_buff *skb, | |||
38 | if ((ntohl(iph->saddr) < ntohl(info->src.min_ip) | 32 | if ((ntohl(iph->saddr) < ntohl(info->src.min_ip) |
39 | || ntohl(iph->saddr) > ntohl(info->src.max_ip)) | 33 | || ntohl(iph->saddr) > ntohl(info->src.max_ip)) |
40 | ^ !!(info->flags & IPRANGE_SRC_INV)) { | 34 | ^ !!(info->flags & IPRANGE_SRC_INV)) { |
41 | DEBUGP("src IP %u.%u.%u.%u NOT in range %s" | 35 | pr_debug("src IP %u.%u.%u.%u NOT in range %s" |
42 | "%u.%u.%u.%u-%u.%u.%u.%u\n", | 36 | "%u.%u.%u.%u-%u.%u.%u.%u\n", |
43 | NIPQUAD(iph->saddr), | 37 | NIPQUAD(iph->saddr), |
44 | info->flags & IPRANGE_SRC_INV ? "(INV) " : "", | 38 | info->flags & IPRANGE_SRC_INV ? "(INV) " : "", |
45 | NIPQUAD(info->src.min_ip), | 39 | NIPQUAD(info->src.min_ip), |
46 | NIPQUAD(info->src.max_ip)); | 40 | NIPQUAD(info->src.max_ip)); |
47 | return false; | 41 | return false; |
48 | } | 42 | } |
49 | } | 43 | } |
@@ -51,12 +45,12 @@ match(const struct sk_buff *skb, | |||
51 | if ((ntohl(iph->daddr) < ntohl(info->dst.min_ip) | 45 | if ((ntohl(iph->daddr) < ntohl(info->dst.min_ip) |
52 | || ntohl(iph->daddr) > ntohl(info->dst.max_ip)) | 46 | || ntohl(iph->daddr) > ntohl(info->dst.max_ip)) |
53 | ^ !!(info->flags & IPRANGE_DST_INV)) { | 47 | ^ !!(info->flags & IPRANGE_DST_INV)) { |
54 | DEBUGP("dst IP %u.%u.%u.%u NOT in range %s" | 48 | pr_debug("dst IP %u.%u.%u.%u NOT in range %s" |
55 | "%u.%u.%u.%u-%u.%u.%u.%u\n", | 49 | "%u.%u.%u.%u-%u.%u.%u.%u\n", |
56 | NIPQUAD(iph->daddr), | 50 | NIPQUAD(iph->daddr), |
57 | info->flags & IPRANGE_DST_INV ? "(INV) " : "", | 51 | info->flags & IPRANGE_DST_INV ? "(INV) " : "", |
58 | NIPQUAD(info->dst.min_ip), | 52 | NIPQUAD(info->dst.min_ip), |
59 | NIPQUAD(info->dst.max_ip)); | 53 | NIPQUAD(info->dst.max_ip)); |
60 | return false; | 54 | return false; |
61 | } | 55 | } |
62 | } | 56 | } |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index a103f597d446..3c5629938487 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -24,12 +24,6 @@ | |||
24 | #include <net/netfilter/nf_conntrack_core.h> | 24 | #include <net/netfilter/nf_conntrack_core.h> |
25 | #include <net/netfilter/ipv4/nf_conntrack_ipv4.h> | 25 | #include <net/netfilter/ipv4/nf_conntrack_ipv4.h> |
26 | 26 | ||
27 | #if 0 | ||
28 | #define DEBUGP printk | ||
29 | #else | ||
30 | #define DEBUGP(format, args...) | ||
31 | #endif | ||
32 | |||
33 | static int ipv4_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, | 27 | static int ipv4_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, |
34 | struct nf_conntrack_tuple *tuple) | 28 | struct nf_conntrack_tuple *tuple) |
35 | { | 29 | { |
@@ -324,13 +318,13 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len) | |||
324 | 318 | ||
325 | /* We only do TCP at the moment: is there a better way? */ | 319 | /* We only do TCP at the moment: is there a better way? */ |
326 | if (strcmp(sk->sk_prot->name, "TCP")) { | 320 | if (strcmp(sk->sk_prot->name, "TCP")) { |
327 | DEBUGP("SO_ORIGINAL_DST: Not a TCP socket\n"); | 321 | pr_debug("SO_ORIGINAL_DST: Not a TCP socket\n"); |
328 | return -ENOPROTOOPT; | 322 | return -ENOPROTOOPT; |
329 | } | 323 | } |
330 | 324 | ||
331 | if ((unsigned int) *len < sizeof(struct sockaddr_in)) { | 325 | if ((unsigned int) *len < sizeof(struct sockaddr_in)) { |
332 | DEBUGP("SO_ORIGINAL_DST: len %u not %u\n", | 326 | pr_debug("SO_ORIGINAL_DST: len %d not %Zu\n", |
333 | *len, sizeof(struct sockaddr_in)); | 327 | *len, sizeof(struct sockaddr_in)); |
334 | return -EINVAL; | 328 | return -EINVAL; |
335 | } | 329 | } |
336 | 330 | ||
@@ -346,17 +340,17 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len) | |||
346 | .tuple.dst.u3.ip; | 340 | .tuple.dst.u3.ip; |
347 | memset(sin.sin_zero, 0, sizeof(sin.sin_zero)); | 341 | memset(sin.sin_zero, 0, sizeof(sin.sin_zero)); |
348 | 342 | ||
349 | DEBUGP("SO_ORIGINAL_DST: %u.%u.%u.%u %u\n", | 343 | pr_debug("SO_ORIGINAL_DST: %u.%u.%u.%u %u\n", |
350 | NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port)); | 344 | NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port)); |
351 | nf_ct_put(ct); | 345 | nf_ct_put(ct); |
352 | if (copy_to_user(user, &sin, sizeof(sin)) != 0) | 346 | if (copy_to_user(user, &sin, sizeof(sin)) != 0) |
353 | return -EFAULT; | 347 | return -EFAULT; |
354 | else | 348 | else |
355 | return 0; | 349 | return 0; |
356 | } | 350 | } |
357 | DEBUGP("SO_ORIGINAL_DST: Can't find %u.%u.%u.%u/%u-%u.%u.%u.%u/%u.\n", | 351 | pr_debug("SO_ORIGINAL_DST: Can't find %u.%u.%u.%u/%u-%u.%u.%u.%u/%u.\n", |
358 | NIPQUAD(tuple.src.u3.ip), ntohs(tuple.src.u.tcp.port), | 352 | NIPQUAD(tuple.src.u3.ip), ntohs(tuple.src.u.tcp.port), |
359 | NIPQUAD(tuple.dst.u3.ip), ntohs(tuple.dst.u.tcp.port)); | 353 | NIPQUAD(tuple.dst.u3.ip), ntohs(tuple.dst.u.tcp.port)); |
360 | return -ENOENT; | 354 | return -ENOENT; |
361 | } | 355 | } |
362 | 356 | ||
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c index ab8e4c607b7a..434e08410879 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | |||
@@ -18,12 +18,6 @@ | |||
18 | #include <net/netfilter/nf_conntrack_l4proto.h> | 18 | #include <net/netfilter/nf_conntrack_l4proto.h> |
19 | #include <net/netfilter/nf_conntrack_expect.h> | 19 | #include <net/netfilter/nf_conntrack_expect.h> |
20 | 20 | ||
21 | #if 0 | ||
22 | #define DEBUGP printk | ||
23 | #else | ||
24 | #define DEBUGP(format, args...) | ||
25 | #endif | ||
26 | |||
27 | #ifdef CONFIG_NF_CT_ACCT | 21 | #ifdef CONFIG_NF_CT_ACCT |
28 | static unsigned int | 22 | static unsigned int |
29 | seq_print_counters(struct seq_file *s, | 23 | seq_print_counters(struct seq_file *s, |
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index 91fb277045ef..0fe8fb0466ef 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c | |||
@@ -21,12 +21,6 @@ | |||
21 | 21 | ||
22 | static unsigned long nf_ct_icmp_timeout __read_mostly = 30*HZ; | 22 | static unsigned long nf_ct_icmp_timeout __read_mostly = 30*HZ; |
23 | 23 | ||
24 | #if 0 | ||
25 | #define DEBUGP printk | ||
26 | #else | ||
27 | #define DEBUGP(format, args...) | ||
28 | #endif | ||
29 | |||
30 | static int icmp_pkt_to_tuple(const struct sk_buff *skb, | 24 | static int icmp_pkt_to_tuple(const struct sk_buff *skb, |
31 | unsigned int dataoff, | 25 | unsigned int dataoff, |
32 | struct nf_conntrack_tuple *tuple) | 26 | struct nf_conntrack_tuple *tuple) |
@@ -125,8 +119,8 @@ static int icmp_new(struct nf_conn *conntrack, | |||
125 | if (conntrack->tuplehash[0].tuple.dst.u.icmp.type >= sizeof(valid_new) | 119 | if (conntrack->tuplehash[0].tuple.dst.u.icmp.type >= sizeof(valid_new) |
126 | || !valid_new[conntrack->tuplehash[0].tuple.dst.u.icmp.type]) { | 120 | || !valid_new[conntrack->tuplehash[0].tuple.dst.u.icmp.type]) { |
127 | /* Can't create a new ICMP `conn' with this. */ | 121 | /* Can't create a new ICMP `conn' with this. */ |
128 | DEBUGP("icmp: can't create new conn with type %u\n", | 122 | pr_debug("icmp: can't create new conn with type %u\n", |
129 | conntrack->tuplehash[0].tuple.dst.u.icmp.type); | 123 | conntrack->tuplehash[0].tuple.dst.u.icmp.type); |
130 | NF_CT_DUMP_TUPLE(&conntrack->tuplehash[0].tuple); | 124 | NF_CT_DUMP_TUPLE(&conntrack->tuplehash[0].tuple); |
131 | return 0; | 125 | return 0; |
132 | } | 126 | } |
@@ -159,8 +153,8 @@ icmp_error_message(struct sk_buff *skb, | |||
159 | 153 | ||
160 | /* Ignore ICMP's containing fragments (shouldn't happen) */ | 154 | /* Ignore ICMP's containing fragments (shouldn't happen) */ |
161 | if (inside->ip.frag_off & htons(IP_OFFSET)) { | 155 | if (inside->ip.frag_off & htons(IP_OFFSET)) { |
162 | DEBUGP("icmp_error_message: fragment of proto %u\n", | 156 | pr_debug("icmp_error_message: fragment of proto %u\n", |
163 | inside->ip.protocol); | 157 | inside->ip.protocol); |
164 | return -NF_ACCEPT; | 158 | return -NF_ACCEPT; |
165 | } | 159 | } |
166 | 160 | ||
@@ -172,8 +166,8 @@ icmp_error_message(struct sk_buff *skb, | |||
172 | if (!nf_ct_get_tuple(skb, dataoff, dataoff + inside->ip.ihl*4, PF_INET, | 166 | if (!nf_ct_get_tuple(skb, dataoff, dataoff + inside->ip.ihl*4, PF_INET, |
173 | inside->ip.protocol, &origtuple, | 167 | inside->ip.protocol, &origtuple, |
174 | &nf_conntrack_l3proto_ipv4, innerproto)) { | 168 | &nf_conntrack_l3proto_ipv4, innerproto)) { |
175 | DEBUGP("icmp_error_message: ! get_tuple p=%u", | 169 | pr_debug("icmp_error_message: ! get_tuple p=%u", |
176 | inside->ip.protocol); | 170 | inside->ip.protocol); |
177 | return -NF_ACCEPT; | 171 | return -NF_ACCEPT; |
178 | } | 172 | } |
179 | 173 | ||
@@ -181,7 +175,7 @@ icmp_error_message(struct sk_buff *skb, | |||
181 | been preserved inside the ICMP. */ | 175 | been preserved inside the ICMP. */ |
182 | if (!nf_ct_invert_tuple(&innertuple, &origtuple, | 176 | if (!nf_ct_invert_tuple(&innertuple, &origtuple, |
183 | &nf_conntrack_l3proto_ipv4, innerproto)) { | 177 | &nf_conntrack_l3proto_ipv4, innerproto)) { |
184 | DEBUGP("icmp_error_message: no match\n"); | 178 | pr_debug("icmp_error_message: no match\n"); |
185 | return -NF_ACCEPT; | 179 | return -NF_ACCEPT; |
186 | } | 180 | } |
187 | 181 | ||
@@ -196,7 +190,7 @@ icmp_error_message(struct sk_buff *skb, | |||
196 | h = nf_conntrack_find_get(&origtuple); | 190 | h = nf_conntrack_find_get(&origtuple); |
197 | 191 | ||
198 | if (!h) { | 192 | if (!h) { |
199 | DEBUGP("icmp_error_message: no match\n"); | 193 | pr_debug("icmp_error_message: no match\n"); |
200 | return -NF_ACCEPT; | 194 | return -NF_ACCEPT; |
201 | } | 195 | } |
202 | 196 | ||
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index f242ac61b3eb..e848d8d6292f 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
@@ -31,12 +31,6 @@ | |||
31 | #include <net/netfilter/nf_conntrack_l3proto.h> | 31 | #include <net/netfilter/nf_conntrack_l3proto.h> |
32 | #include <net/netfilter/nf_conntrack_l4proto.h> | 32 | #include <net/netfilter/nf_conntrack_l4proto.h> |
33 | 33 | ||
34 | #if 0 | ||
35 | #define DEBUGP printk | ||
36 | #else | ||
37 | #define DEBUGP(format, args...) | ||
38 | #endif | ||
39 | |||
40 | static DEFINE_RWLOCK(nf_nat_lock); | 34 | static DEFINE_RWLOCK(nf_nat_lock); |
41 | 35 | ||
42 | static struct nf_conntrack_l3proto *l3proto = NULL; | 36 | static struct nf_conntrack_l3proto *l3proto = NULL; |
@@ -242,7 +236,7 @@ get_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
242 | manips not an issue. */ | 236 | manips not an issue. */ |
243 | if (maniptype == IP_NAT_MANIP_SRC) { | 237 | if (maniptype == IP_NAT_MANIP_SRC) { |
244 | if (find_appropriate_src(orig_tuple, tuple, range)) { | 238 | if (find_appropriate_src(orig_tuple, tuple, range)) { |
245 | DEBUGP("get_unique_tuple: Found current src map\n"); | 239 | pr_debug("get_unique_tuple: Found current src map\n"); |
246 | if (!(range->flags & IP_NAT_RANGE_PROTO_RANDOM)) | 240 | if (!(range->flags & IP_NAT_RANGE_PROTO_RANDOM)) |
247 | if (!nf_nat_used_tuple(tuple, ct)) | 241 | if (!nf_nat_used_tuple(tuple, ct)) |
248 | return; | 242 | return; |
@@ -293,7 +287,7 @@ nf_nat_setup_info(struct nf_conn *ct, | |||
293 | if (!nat) { | 287 | if (!nat) { |
294 | nat = nf_ct_ext_add(ct, NF_CT_EXT_NAT, GFP_ATOMIC); | 288 | nat = nf_ct_ext_add(ct, NF_CT_EXT_NAT, GFP_ATOMIC); |
295 | if (nat == NULL) { | 289 | if (nat == NULL) { |
296 | DEBUGP("failed to add NAT extension\n"); | 290 | pr_debug("failed to add NAT extension\n"); |
297 | return NF_ACCEPT; | 291 | return NF_ACCEPT; |
298 | } | 292 | } |
299 | } | 293 | } |
@@ -462,8 +456,9 @@ int nf_nat_icmp_reply_translation(struct nf_conn *ct, | |||
462 | return 0; | 456 | return 0; |
463 | } | 457 | } |
464 | 458 | ||
465 | DEBUGP("icmp_reply_translation: translating error %p manp %u dir %s\n", | 459 | pr_debug("icmp_reply_translation: translating error %p manip %u " |
466 | *pskb, manip, dir == IP_CT_DIR_ORIGINAL ? "ORIG" : "REPLY"); | 460 | "dir %s\n", *pskb, manip, |
461 | dir == IP_CT_DIR_ORIGINAL ? "ORIG" : "REPLY"); | ||
467 | 462 | ||
468 | /* rcu_read_lock()ed by nf_hook_slow */ | 463 | /* rcu_read_lock()ed by nf_hook_slow */ |
469 | l4proto = __nf_ct_l4proto_find(PF_INET, inside->ip.protocol); | 464 | l4proto = __nf_ct_l4proto_find(PF_INET, inside->ip.protocol); |
diff --git a/net/ipv4/netfilter/nf_nat_ftp.c b/net/ipv4/netfilter/nf_nat_ftp.c index cae4b460aee1..3663bd879c39 100644 --- a/net/ipv4/netfilter/nf_nat_ftp.c +++ b/net/ipv4/netfilter/nf_nat_ftp.c | |||
@@ -25,12 +25,6 @@ MODULE_AUTHOR("Rusty Russell <rusty@rustcorp.com.au>"); | |||
25 | MODULE_DESCRIPTION("ftp NAT helper"); | 25 | MODULE_DESCRIPTION("ftp NAT helper"); |
26 | MODULE_ALIAS("ip_nat_ftp"); | 26 | MODULE_ALIAS("ip_nat_ftp"); |
27 | 27 | ||
28 | #if 0 | ||
29 | #define DEBUGP printk | ||
30 | #else | ||
31 | #define DEBUGP(format, args...) | ||
32 | #endif | ||
33 | |||
34 | /* FIXME: Time out? --RR */ | 28 | /* FIXME: Time out? --RR */ |
35 | 29 | ||
36 | static int | 30 | static int |
@@ -47,7 +41,7 @@ mangle_rfc959_packet(struct sk_buff **pskb, | |||
47 | sprintf(buffer, "%u,%u,%u,%u,%u,%u", | 41 | sprintf(buffer, "%u,%u,%u,%u,%u,%u", |
48 | NIPQUAD(newip), port>>8, port&0xFF); | 42 | NIPQUAD(newip), port>>8, port&0xFF); |
49 | 43 | ||
50 | DEBUGP("calling nf_nat_mangle_tcp_packet\n"); | 44 | pr_debug("calling nf_nat_mangle_tcp_packet\n"); |
51 | 45 | ||
52 | return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, | 46 | return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, |
53 | matchlen, buffer, strlen(buffer)); | 47 | matchlen, buffer, strlen(buffer)); |
@@ -67,7 +61,7 @@ mangle_eprt_packet(struct sk_buff **pskb, | |||
67 | 61 | ||
68 | sprintf(buffer, "|1|%u.%u.%u.%u|%u|", NIPQUAD(newip), port); | 62 | sprintf(buffer, "|1|%u.%u.%u.%u|%u|", NIPQUAD(newip), port); |
69 | 63 | ||
70 | DEBUGP("calling nf_nat_mangle_tcp_packet\n"); | 64 | pr_debug("calling nf_nat_mangle_tcp_packet\n"); |
71 | 65 | ||
72 | return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, | 66 | return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, |
73 | matchlen, buffer, strlen(buffer)); | 67 | matchlen, buffer, strlen(buffer)); |
@@ -87,7 +81,7 @@ mangle_epsv_packet(struct sk_buff **pskb, | |||
87 | 81 | ||
88 | sprintf(buffer, "|||%u|", port); | 82 | sprintf(buffer, "|||%u|", port); |
89 | 83 | ||
90 | DEBUGP("calling nf_nat_mangle_tcp_packet\n"); | 84 | pr_debug("calling nf_nat_mangle_tcp_packet\n"); |
91 | 85 | ||
92 | return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, | 86 | return nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, matchoff, |
93 | matchlen, buffer, strlen(buffer)); | 87 | matchlen, buffer, strlen(buffer)); |
@@ -117,7 +111,7 @@ static unsigned int nf_nat_ftp(struct sk_buff **pskb, | |||
117 | int dir = CTINFO2DIR(ctinfo); | 111 | int dir = CTINFO2DIR(ctinfo); |
118 | struct nf_conn *ct = exp->master; | 112 | struct nf_conn *ct = exp->master; |
119 | 113 | ||
120 | DEBUGP("FTP_NAT: type %i, off %u len %u\n", type, matchoff, matchlen); | 114 | pr_debug("FTP_NAT: type %i, off %u len %u\n", type, matchoff, matchlen); |
121 | 115 | ||
122 | /* Connection will come from wherever this packet goes, hence !dir */ | 116 | /* Connection will come from wherever this packet goes, hence !dir */ |
123 | newip = ct->tuplehash[!dir].tuple.dst.u3.ip; | 117 | newip = ct->tuplehash[!dir].tuple.dst.u3.ip; |
diff --git a/net/ipv4/netfilter/nf_nat_h323.c b/net/ipv4/netfilter/nf_nat_h323.c index 3d760dd657c7..c1b059a73708 100644 --- a/net/ipv4/netfilter/nf_nat_h323.c +++ b/net/ipv4/netfilter/nf_nat_h323.c | |||
@@ -21,12 +21,6 @@ | |||
21 | #include <net/netfilter/nf_conntrack_expect.h> | 21 | #include <net/netfilter/nf_conntrack_expect.h> |
22 | #include <linux/netfilter/nf_conntrack_h323.h> | 22 | #include <linux/netfilter/nf_conntrack_h323.h> |
23 | 23 | ||
24 | #if 0 | ||
25 | #define DEBUGP printk | ||
26 | #else | ||
27 | #define DEBUGP(format, args...) | ||
28 | #endif | ||
29 | |||
30 | /****************************************************************************/ | 24 | /****************************************************************************/ |
31 | static int set_addr(struct sk_buff **pskb, | 25 | static int set_addr(struct sk_buff **pskb, |
32 | unsigned char **data, int dataoff, | 26 | unsigned char **data, int dataoff, |
@@ -126,12 +120,11 @@ static int set_sig_addr(struct sk_buff **pskb, struct nf_conn *ct, | |||
126 | (ntohl(addr.ip) & 0xff000000) == 0x7f000000) | 120 | (ntohl(addr.ip) & 0xff000000) == 0x7f000000) |
127 | i = 0; | 121 | i = 0; |
128 | 122 | ||
129 | DEBUGP | 123 | pr_debug("nf_nat_ras: set signal address " |
130 | ("nf_nat_ras: set signal address " | 124 | "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", |
131 | "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 125 | NIPQUAD(addr.ip), port, |
132 | NIPQUAD(ip), port, | 126 | NIPQUAD(ct->tuplehash[!dir].tuple.dst.u3.ip), |
133 | NIPQUAD(ct->tuplehash[!dir].tuple.dst. | 127 | info->sig_port[!dir]); |
134 | ip), info->sig_port[!dir]); | ||
135 | return set_h225_addr(pskb, data, 0, &taddr[i], | 128 | return set_h225_addr(pskb, data, 0, &taddr[i], |
136 | &ct->tuplehash[!dir]. | 129 | &ct->tuplehash[!dir]. |
137 | tuple.dst.u3, | 130 | tuple.dst.u3, |
@@ -139,12 +132,11 @@ static int set_sig_addr(struct sk_buff **pskb, struct nf_conn *ct, | |||
139 | } else if (addr.ip == ct->tuplehash[dir].tuple.dst.u3.ip && | 132 | } else if (addr.ip == ct->tuplehash[dir].tuple.dst.u3.ip && |
140 | port == info->sig_port[dir]) { | 133 | port == info->sig_port[dir]) { |
141 | /* GK->GW */ | 134 | /* GK->GW */ |
142 | DEBUGP | 135 | pr_debug("nf_nat_ras: set signal address " |
143 | ("nf_nat_ras: set signal address " | 136 | "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", |
144 | "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 137 | NIPQUAD(addr.ip), port, |
145 | NIPQUAD(ip), port, | 138 | NIPQUAD(ct->tuplehash[!dir].tuple.src.u3.ip), |
146 | NIPQUAD(ct->tuplehash[!dir].tuple.src. | 139 | info->sig_port[!dir]); |
147 | ip), info->sig_port[!dir]); | ||
148 | return set_h225_addr(pskb, data, 0, &taddr[i], | 140 | return set_h225_addr(pskb, data, 0, &taddr[i], |
149 | &ct->tuplehash[!dir]. | 141 | &ct->tuplehash[!dir]. |
150 | tuple.src.u3, | 142 | tuple.src.u3, |
@@ -171,12 +163,11 @@ static int set_ras_addr(struct sk_buff **pskb, struct nf_conn *ct, | |||
171 | if (get_h225_addr(ct, *data, &taddr[i], &addr, &port) && | 163 | if (get_h225_addr(ct, *data, &taddr[i], &addr, &port) && |
172 | addr.ip == ct->tuplehash[dir].tuple.src.u3.ip && | 164 | addr.ip == ct->tuplehash[dir].tuple.src.u3.ip && |
173 | port == ct->tuplehash[dir].tuple.src.u.udp.port) { | 165 | port == ct->tuplehash[dir].tuple.src.u.udp.port) { |
174 | DEBUGP("nf_nat_ras: set rasAddress " | 166 | pr_debug("nf_nat_ras: set rasAddress " |
175 | "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 167 | "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", |
176 | NIPQUAD(ip), ntohs(port), | 168 | NIPQUAD(addr.ip), ntohs(port), |
177 | NIPQUAD(ct->tuplehash[!dir].tuple.dst.u3.ip), | 169 | NIPQUAD(ct->tuplehash[!dir].tuple.dst.u3.ip), |
178 | ntohs(ct->tuplehash[!dir].tuple.dst.u.udp. | 170 | ntohs(ct->tuplehash[!dir].tuple.dst.u.udp.port)); |
179 | port)); | ||
180 | return set_h225_addr(pskb, data, 0, &taddr[i], | 171 | return set_h225_addr(pskb, data, 0, &taddr[i], |
181 | &ct->tuplehash[!dir].tuple.dst.u3, | 172 | &ct->tuplehash[!dir].tuple.dst.u3, |
182 | ct->tuplehash[!dir].tuple. | 173 | ct->tuplehash[!dir].tuple. |
@@ -267,16 +258,16 @@ static int nat_rtp_rtcp(struct sk_buff **pskb, struct nf_conn *ct, | |||
267 | } | 258 | } |
268 | 259 | ||
269 | /* Success */ | 260 | /* Success */ |
270 | DEBUGP("nf_nat_h323: expect RTP %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 261 | pr_debug("nf_nat_h323: expect RTP %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", |
271 | NIPQUAD(rtp_exp->tuple.src.ip), | 262 | NIPQUAD(rtp_exp->tuple.src.u3.ip), |
272 | ntohs(rtp_exp->tuple.src.u.udp.port), | 263 | ntohs(rtp_exp->tuple.src.u.udp.port), |
273 | NIPQUAD(rtp_exp->tuple.dst.ip), | 264 | NIPQUAD(rtp_exp->tuple.dst.u3.ip), |
274 | ntohs(rtp_exp->tuple.dst.u.udp.port)); | 265 | ntohs(rtp_exp->tuple.dst.u.udp.port)); |
275 | DEBUGP("nf_nat_h323: expect RTCP %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 266 | pr_debug("nf_nat_h323: expect RTCP %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", |
276 | NIPQUAD(rtcp_exp->tuple.src.ip), | 267 | NIPQUAD(rtcp_exp->tuple.src.u3.ip), |
277 | ntohs(rtcp_exp->tuple.src.u.udp.port), | 268 | ntohs(rtcp_exp->tuple.src.u.udp.port), |
278 | NIPQUAD(rtcp_exp->tuple.dst.ip), | 269 | NIPQUAD(rtcp_exp->tuple.dst.u3.ip), |
279 | ntohs(rtcp_exp->tuple.dst.u.udp.port)); | 270 | ntohs(rtcp_exp->tuple.dst.u.udp.port)); |
280 | 271 | ||
281 | return 0; | 272 | return 0; |
282 | } | 273 | } |
@@ -317,9 +308,11 @@ static int nat_t120(struct sk_buff **pskb, struct nf_conn *ct, | |||
317 | return -1; | 308 | return -1; |
318 | } | 309 | } |
319 | 310 | ||
320 | DEBUGP("nf_nat_h323: expect T.120 %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 311 | pr_debug("nf_nat_h323: expect T.120 %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", |
321 | NIPQUAD(exp->tuple.src.ip), ntohs(exp->tuple.src.u.tcp.port), | 312 | NIPQUAD(exp->tuple.src.u3.ip), |
322 | NIPQUAD(exp->tuple.dst.ip), ntohs(exp->tuple.dst.u.tcp.port)); | 313 | ntohs(exp->tuple.src.u.tcp.port), |
314 | NIPQUAD(exp->tuple.dst.u3.ip), | ||
315 | ntohs(exp->tuple.dst.u.tcp.port)); | ||
323 | 316 | ||
324 | return 0; | 317 | return 0; |
325 | } | 318 | } |
@@ -369,9 +362,11 @@ static int nat_h245(struct sk_buff **pskb, struct nf_conn *ct, | |||
369 | return -1; | 362 | return -1; |
370 | } | 363 | } |
371 | 364 | ||
372 | DEBUGP("nf_nat_q931: expect H.245 %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 365 | pr_debug("nf_nat_q931: expect H.245 %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", |
373 | NIPQUAD(exp->tuple.src.ip), ntohs(exp->tuple.src.u.tcp.port), | 366 | NIPQUAD(exp->tuple.src.u3.ip), |
374 | NIPQUAD(exp->tuple.dst.ip), ntohs(exp->tuple.dst.u.tcp.port)); | 367 | ntohs(exp->tuple.src.u.tcp.port), |
368 | NIPQUAD(exp->tuple.dst.u3.ip), | ||
369 | ntohs(exp->tuple.dst.u.tcp.port)); | ||
375 | 370 | ||
376 | return 0; | 371 | return 0; |
377 | } | 372 | } |
@@ -465,9 +460,11 @@ static int nat_q931(struct sk_buff **pskb, struct nf_conn *ct, | |||
465 | } | 460 | } |
466 | 461 | ||
467 | /* Success */ | 462 | /* Success */ |
468 | DEBUGP("nf_nat_ras: expect Q.931 %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 463 | pr_debug("nf_nat_ras: expect Q.931 %u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", |
469 | NIPQUAD(exp->tuple.src.ip), ntohs(exp->tuple.src.u.tcp.port), | 464 | NIPQUAD(exp->tuple.src.u3.ip), |
470 | NIPQUAD(exp->tuple.dst.ip), ntohs(exp->tuple.dst.u.tcp.port)); | 465 | ntohs(exp->tuple.src.u.tcp.port), |
466 | NIPQUAD(exp->tuple.dst.u3.ip), | ||
467 | ntohs(exp->tuple.dst.u.tcp.port)); | ||
471 | 468 | ||
472 | return 0; | 469 | return 0; |
473 | } | 470 | } |
@@ -536,10 +533,12 @@ static int nat_callforwarding(struct sk_buff **pskb, struct nf_conn *ct, | |||
536 | } | 533 | } |
537 | 534 | ||
538 | /* Success */ | 535 | /* Success */ |
539 | DEBUGP("nf_nat_q931: expect Call Forwarding " | 536 | pr_debug("nf_nat_q931: expect Call Forwarding " |
540 | "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", | 537 | "%u.%u.%u.%u:%hu->%u.%u.%u.%u:%hu\n", |
541 | NIPQUAD(exp->tuple.src.ip), ntohs(exp->tuple.src.u.tcp.port), | 538 | NIPQUAD(exp->tuple.src.u3.ip), |
542 | NIPQUAD(exp->tuple.dst.ip), ntohs(exp->tuple.dst.u.tcp.port)); | 539 | ntohs(exp->tuple.src.u.tcp.port), |
540 | NIPQUAD(exp->tuple.dst.u3.ip), | ||
541 | ntohs(exp->tuple.dst.u.tcp.port)); | ||
543 | 542 | ||
544 | return 0; | 543 | return 0; |
545 | } | 544 | } |
@@ -566,8 +565,6 @@ static int __init init(void) | |||
566 | rcu_assign_pointer(nat_h245_hook, nat_h245); | 565 | rcu_assign_pointer(nat_h245_hook, nat_h245); |
567 | rcu_assign_pointer(nat_callforwarding_hook, nat_callforwarding); | 566 | rcu_assign_pointer(nat_callforwarding_hook, nat_callforwarding); |
568 | rcu_assign_pointer(nat_q931_hook, nat_q931); | 567 | rcu_assign_pointer(nat_q931_hook, nat_q931); |
569 | |||
570 | DEBUGP("nf_nat_h323: init success\n"); | ||
571 | return 0; | 568 | return 0; |
572 | } | 569 | } |
573 | 570 | ||
diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c index f3383fc14e1c..93d8a0a8f035 100644 --- a/net/ipv4/netfilter/nf_nat_helper.c +++ b/net/ipv4/netfilter/nf_nat_helper.c | |||
@@ -26,13 +26,9 @@ | |||
26 | #include <net/netfilter/nf_nat_core.h> | 26 | #include <net/netfilter/nf_nat_core.h> |
27 | #include <net/netfilter/nf_nat_helper.h> | 27 | #include <net/netfilter/nf_nat_helper.h> |
28 | 28 | ||
29 | #if 0 | 29 | #define DUMP_OFFSET(x) \ |
30 | #define DEBUGP printk | 30 | pr_debug("offset_before=%d, offset_after=%d, correction_pos=%u\n", \ |
31 | #define DUMP_OFFSET(x) printk("offset_before=%d, offset_after=%d, correction_pos=%u\n", x->offset_before, x->offset_after, x->correction_pos); | 31 | x->offset_before, x->offset_after, x->correction_pos); |
32 | #else | ||
33 | #define DEBUGP(format, args...) | ||
34 | #define DUMP_OFFSET(x) | ||
35 | #endif | ||
36 | 32 | ||
37 | static DEFINE_SPINLOCK(nf_nat_seqofs_lock); | 33 | static DEFINE_SPINLOCK(nf_nat_seqofs_lock); |
38 | 34 | ||
@@ -47,15 +43,15 @@ adjust_tcp_sequence(u32 seq, | |||
47 | struct nf_nat_seq *this_way, *other_way; | 43 | struct nf_nat_seq *this_way, *other_way; |
48 | struct nf_conn_nat *nat = nfct_nat(ct); | 44 | struct nf_conn_nat *nat = nfct_nat(ct); |
49 | 45 | ||
50 | DEBUGP("nf_nat_resize_packet: old_size = %u, new_size = %u\n", | 46 | pr_debug("adjust_tcp_sequence: seq = %u, sizediff = %d\n", |
51 | (*skb)->len, new_size); | 47 | ntohl(seq), seq); |
52 | 48 | ||
53 | dir = CTINFO2DIR(ctinfo); | 49 | dir = CTINFO2DIR(ctinfo); |
54 | 50 | ||
55 | this_way = &nat->seq[dir]; | 51 | this_way = &nat->seq[dir]; |
56 | other_way = &nat->seq[!dir]; | 52 | other_way = &nat->seq[!dir]; |
57 | 53 | ||
58 | DEBUGP("nf_nat_resize_packet: Seq_offset before: "); | 54 | pr_debug("nf_nat_resize_packet: Seq_offset before: "); |
59 | DUMP_OFFSET(this_way); | 55 | DUMP_OFFSET(this_way); |
60 | 56 | ||
61 | spin_lock_bh(&nf_nat_seqofs_lock); | 57 | spin_lock_bh(&nf_nat_seqofs_lock); |
@@ -72,7 +68,7 @@ adjust_tcp_sequence(u32 seq, | |||
72 | } | 68 | } |
73 | spin_unlock_bh(&nf_nat_seqofs_lock); | 69 | spin_unlock_bh(&nf_nat_seqofs_lock); |
74 | 70 | ||
75 | DEBUGP("nf_nat_resize_packet: Seq_offset after: "); | 71 | pr_debug("nf_nat_resize_packet: Seq_offset after: "); |
76 | DUMP_OFFSET(this_way); | 72 | DUMP_OFFSET(this_way); |
77 | } | 73 | } |
78 | 74 | ||
@@ -100,14 +96,12 @@ static void mangle_contents(struct sk_buff *skb, | |||
100 | 96 | ||
101 | /* update skb info */ | 97 | /* update skb info */ |
102 | if (rep_len > match_len) { | 98 | if (rep_len > match_len) { |
103 | DEBUGP("nf_nat_mangle_packet: Extending packet by " | 99 | pr_debug("nf_nat_mangle_packet: Extending packet by " |
104 | "%u from %u bytes\n", rep_len - match_len, | 100 | "%u from %u bytes\n", rep_len - match_len, skb->len); |
105 | skb->len); | ||
106 | skb_put(skb, rep_len - match_len); | 101 | skb_put(skb, rep_len - match_len); |
107 | } else { | 102 | } else { |
108 | DEBUGP("nf_nat_mangle_packet: Shrinking packet from " | 103 | pr_debug("nf_nat_mangle_packet: Shrinking packet from " |
109 | "%u from %u bytes\n", match_len - rep_len, | 104 | "%u from %u bytes\n", match_len - rep_len, skb->len); |
110 | skb->len); | ||
111 | __skb_trim(skb, skb->len + rep_len - match_len); | 105 | __skb_trim(skb, skb->len + rep_len - match_len); |
112 | } | 106 | } |
113 | 107 | ||
@@ -320,9 +314,9 @@ sack_adjust(struct sk_buff *skb, | |||
320 | new_end_seq = htonl(ntohl(sack->end_seq) | 314 | new_end_seq = htonl(ntohl(sack->end_seq) |
321 | - natseq->offset_before); | 315 | - natseq->offset_before); |
322 | 316 | ||
323 | DEBUGP("sack_adjust: start_seq: %d->%d, end_seq: %d->%d\n", | 317 | pr_debug("sack_adjust: start_seq: %d->%d, end_seq: %d->%d\n", |
324 | ntohl(sack->start_seq), new_start_seq, | 318 | ntohl(sack->start_seq), new_start_seq, |
325 | ntohl(sack->end_seq), new_end_seq); | 319 | ntohl(sack->end_seq), new_end_seq); |
326 | 320 | ||
327 | nf_proto_csum_replace4(&tcph->check, skb, | 321 | nf_proto_csum_replace4(&tcph->check, skb, |
328 | sack->start_seq, new_start_seq, 0); | 322 | sack->start_seq, new_start_seq, 0); |
@@ -414,9 +408,9 @@ nf_nat_seq_adjust(struct sk_buff **pskb, | |||
414 | nf_proto_csum_replace4(&tcph->check, *pskb, tcph->seq, newseq, 0); | 408 | nf_proto_csum_replace4(&tcph->check, *pskb, tcph->seq, newseq, 0); |
415 | nf_proto_csum_replace4(&tcph->check, *pskb, tcph->ack_seq, newack, 0); | 409 | nf_proto_csum_replace4(&tcph->check, *pskb, tcph->ack_seq, newack, 0); |
416 | 410 | ||
417 | DEBUGP("Adjusting sequence number from %u->%u, ack from %u->%u\n", | 411 | pr_debug("Adjusting sequence number from %u->%u, ack from %u->%u\n", |
418 | ntohl(tcph->seq), ntohl(newseq), ntohl(tcph->ack_seq), | 412 | ntohl(tcph->seq), ntohl(newseq), ntohl(tcph->ack_seq), |
419 | ntohl(newack)); | 413 | ntohl(newack)); |
420 | 414 | ||
421 | tcph->seq = newseq; | 415 | tcph->seq = newseq; |
422 | tcph->ack_seq = newack; | 416 | tcph->ack_seq = newack; |
diff --git a/net/ipv4/netfilter/nf_nat_irc.c b/net/ipv4/netfilter/nf_nat_irc.c index db7fbf66fec0..bcf274bba602 100644 --- a/net/ipv4/netfilter/nf_nat_irc.c +++ b/net/ipv4/netfilter/nf_nat_irc.c | |||
@@ -22,12 +22,6 @@ | |||
22 | #include <net/netfilter/nf_conntrack_expect.h> | 22 | #include <net/netfilter/nf_conntrack_expect.h> |
23 | #include <linux/netfilter/nf_conntrack_irc.h> | 23 | #include <linux/netfilter/nf_conntrack_irc.h> |
24 | 24 | ||
25 | #if 0 | ||
26 | #define DEBUGP printk | ||
27 | #else | ||
28 | #define DEBUGP(format, args...) | ||
29 | #endif | ||
30 | |||
31 | MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); | 25 | MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); |
32 | MODULE_DESCRIPTION("IRC (DCC) NAT helper"); | 26 | MODULE_DESCRIPTION("IRC (DCC) NAT helper"); |
33 | MODULE_LICENSE("GPL"); | 27 | MODULE_LICENSE("GPL"); |
@@ -44,9 +38,6 @@ static unsigned int help(struct sk_buff **pskb, | |||
44 | u_int16_t port; | 38 | u_int16_t port; |
45 | unsigned int ret; | 39 | unsigned int ret; |
46 | 40 | ||
47 | DEBUGP("IRC_NAT: info (seq %u + %u) in %u\n", | ||
48 | expect->seq, exp_irc_info->len, ntohl(tcph->seq)); | ||
49 | |||
50 | /* Reply comes from server. */ | 41 | /* Reply comes from server. */ |
51 | exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port; | 42 | exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port; |
52 | exp->dir = IP_CT_DIR_REPLY; | 43 | exp->dir = IP_CT_DIR_REPLY; |
@@ -64,8 +55,8 @@ static unsigned int help(struct sk_buff **pskb, | |||
64 | 55 | ||
65 | ip = ntohl(exp->master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip); | 56 | ip = ntohl(exp->master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip); |
66 | sprintf(buffer, "%u %u", ip, port); | 57 | sprintf(buffer, "%u %u", ip, port); |
67 | DEBUGP("nf_nat_irc: inserting '%s' == %u.%u.%u.%u, port %u\n", | 58 | pr_debug("nf_nat_irc: inserting '%s' == %u.%u.%u.%u, port %u\n", |
68 | buffer, NIPQUAD(ip), port); | 59 | buffer, NIPQUAD(ip), port); |
69 | 60 | ||
70 | ret = nf_nat_mangle_tcp_packet(pskb, exp->master, ctinfo, | 61 | ret = nf_nat_mangle_tcp_packet(pskb, exp->master, ctinfo, |
71 | matchoff, matchlen, buffer, | 62 | matchoff, matchlen, buffer, |
diff --git a/net/ipv4/netfilter/nf_nat_pptp.c b/net/ipv4/netfilter/nf_nat_pptp.c index deb80ae2831e..984ec8308b2e 100644 --- a/net/ipv4/netfilter/nf_nat_pptp.c +++ b/net/ipv4/netfilter/nf_nat_pptp.c | |||
@@ -37,14 +37,6 @@ MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); | |||
37 | MODULE_DESCRIPTION("Netfilter NAT helper module for PPTP"); | 37 | MODULE_DESCRIPTION("Netfilter NAT helper module for PPTP"); |
38 | MODULE_ALIAS("ip_nat_pptp"); | 38 | MODULE_ALIAS("ip_nat_pptp"); |
39 | 39 | ||
40 | #if 0 | ||
41 | extern const char *pptp_msg_name[]; | ||
42 | #define DEBUGP(format, args...) printk(KERN_DEBUG "%s:%s: " format, __FILE__, \ | ||
43 | __FUNCTION__, ## args) | ||
44 | #else | ||
45 | #define DEBUGP(format, args...) | ||
46 | #endif | ||
47 | |||
48 | static void pptp_nat_expected(struct nf_conn *ct, | 40 | static void pptp_nat_expected(struct nf_conn *ct, |
49 | struct nf_conntrack_expect *exp) | 41 | struct nf_conntrack_expect *exp) |
50 | { | 42 | { |
@@ -60,7 +52,7 @@ static void pptp_nat_expected(struct nf_conn *ct, | |||
60 | 52 | ||
61 | /* And here goes the grand finale of corrosion... */ | 53 | /* And here goes the grand finale of corrosion... */ |
62 | if (exp->dir == IP_CT_DIR_ORIGINAL) { | 54 | if (exp->dir == IP_CT_DIR_ORIGINAL) { |
63 | DEBUGP("we are PNS->PAC\n"); | 55 | pr_debug("we are PNS->PAC\n"); |
64 | /* therefore, build tuple for PAC->PNS */ | 56 | /* therefore, build tuple for PAC->PNS */ |
65 | t.src.l3num = AF_INET; | 57 | t.src.l3num = AF_INET; |
66 | t.src.u3.ip = master->tuplehash[!exp->dir].tuple.src.u3.ip; | 58 | t.src.u3.ip = master->tuplehash[!exp->dir].tuple.src.u3.ip; |
@@ -69,7 +61,7 @@ static void pptp_nat_expected(struct nf_conn *ct, | |||
69 | t.dst.u.gre.key = ct_pptp_info->pns_call_id; | 61 | t.dst.u.gre.key = ct_pptp_info->pns_call_id; |
70 | t.dst.protonum = IPPROTO_GRE; | 62 | t.dst.protonum = IPPROTO_GRE; |
71 | } else { | 63 | } else { |
72 | DEBUGP("we are PAC->PNS\n"); | 64 | pr_debug("we are PAC->PNS\n"); |
73 | /* build tuple for PNS->PAC */ | 65 | /* build tuple for PNS->PAC */ |
74 | t.src.l3num = AF_INET; | 66 | t.src.l3num = AF_INET; |
75 | t.src.u3.ip = master->tuplehash[!exp->dir].tuple.src.u3.ip; | 67 | t.src.u3.ip = master->tuplehash[!exp->dir].tuple.src.u3.ip; |
@@ -79,15 +71,15 @@ static void pptp_nat_expected(struct nf_conn *ct, | |||
79 | t.dst.protonum = IPPROTO_GRE; | 71 | t.dst.protonum = IPPROTO_GRE; |
80 | } | 72 | } |
81 | 73 | ||
82 | DEBUGP("trying to unexpect other dir: "); | 74 | pr_debug("trying to unexpect other dir: "); |
83 | NF_CT_DUMP_TUPLE(&t); | 75 | NF_CT_DUMP_TUPLE(&t); |
84 | other_exp = nf_ct_expect_find_get(&t); | 76 | other_exp = nf_ct_expect_find_get(&t); |
85 | if (other_exp) { | 77 | if (other_exp) { |
86 | nf_ct_unexpect_related(other_exp); | 78 | nf_ct_unexpect_related(other_exp); |
87 | nf_ct_expect_put(other_exp); | 79 | nf_ct_expect_put(other_exp); |
88 | DEBUGP("success\n"); | 80 | pr_debug("success\n"); |
89 | } else { | 81 | } else { |
90 | DEBUGP("not found!\n"); | 82 | pr_debug("not found!\n"); |
91 | } | 83 | } |
92 | 84 | ||
93 | /* This must be a fresh one. */ | 85 | /* This must be a fresh one. */ |
@@ -161,9 +153,9 @@ pptp_outbound_pkt(struct sk_buff **pskb, | |||
161 | cid_off = offsetof(union pptp_ctrl_union, clrreq.callID); | 153 | cid_off = offsetof(union pptp_ctrl_union, clrreq.callID); |
162 | break; | 154 | break; |
163 | default: | 155 | default: |
164 | DEBUGP("unknown outbound packet 0x%04x:%s\n", msg, | 156 | pr_debug("unknown outbound packet 0x%04x:%s\n", msg, |
165 | (msg <= PPTP_MSG_MAX)? | 157 | msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] : |
166 | pptp_msg_name[msg]:pptp_msg_name[0]); | 158 | pptp_msg_name[0]); |
167 | /* fall through */ | 159 | /* fall through */ |
168 | case PPTP_SET_LINK_INFO: | 160 | case PPTP_SET_LINK_INFO: |
169 | /* only need to NAT in case PAC is behind NAT box */ | 161 | /* only need to NAT in case PAC is behind NAT box */ |
@@ -179,8 +171,8 @@ pptp_outbound_pkt(struct sk_buff **pskb, | |||
179 | 171 | ||
180 | /* only OUT_CALL_REQUEST, IN_CALL_REPLY, CALL_CLEAR_REQUEST pass | 172 | /* only OUT_CALL_REQUEST, IN_CALL_REPLY, CALL_CLEAR_REQUEST pass |
181 | * down to here */ | 173 | * down to here */ |
182 | DEBUGP("altering call id from 0x%04x to 0x%04x\n", | 174 | pr_debug("altering call id from 0x%04x to 0x%04x\n", |
183 | ntohs(REQ_CID(pptpReq, cid_off)), ntohs(new_callid)); | 175 | ntohs(REQ_CID(pptpReq, cid_off)), ntohs(new_callid)); |
184 | 176 | ||
185 | /* mangle packet */ | 177 | /* mangle packet */ |
186 | if (nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, | 178 | if (nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, |
@@ -255,8 +247,9 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
255 | pcid_off = offsetof(union pptp_ctrl_union, setlink.peersCallID); | 247 | pcid_off = offsetof(union pptp_ctrl_union, setlink.peersCallID); |
256 | break; | 248 | break; |
257 | default: | 249 | default: |
258 | DEBUGP("unknown inbound packet %s\n", (msg <= PPTP_MSG_MAX)? | 250 | pr_debug("unknown inbound packet %s\n", |
259 | pptp_msg_name[msg]:pptp_msg_name[0]); | 251 | msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] : |
252 | pptp_msg_name[0]); | ||
260 | /* fall through */ | 253 | /* fall through */ |
261 | case PPTP_START_SESSION_REQUEST: | 254 | case PPTP_START_SESSION_REQUEST: |
262 | case PPTP_START_SESSION_REPLY: | 255 | case PPTP_START_SESSION_REPLY: |
@@ -272,8 +265,8 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
272 | * WAN_ERROR_NOTIFY, CALL_DISCONNECT_NOTIFY pass down here */ | 265 | * WAN_ERROR_NOTIFY, CALL_DISCONNECT_NOTIFY pass down here */ |
273 | 266 | ||
274 | /* mangle packet */ | 267 | /* mangle packet */ |
275 | DEBUGP("altering peer call id from 0x%04x to 0x%04x\n", | 268 | pr_debug("altering peer call id from 0x%04x to 0x%04x\n", |
276 | ntohs(REQ_CID(pptpReq, pcid_off)), ntohs(new_pcid)); | 269 | ntohs(REQ_CID(pptpReq, pcid_off)), ntohs(new_pcid)); |
277 | 270 | ||
278 | if (nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, | 271 | if (nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, |
279 | pcid_off + sizeof(struct pptp_pkt_hdr) + | 272 | pcid_off + sizeof(struct pptp_pkt_hdr) + |
diff --git a/net/ipv4/netfilter/nf_nat_proto_gre.c b/net/ipv4/netfilter/nf_nat_proto_gre.c index c3908bc5a709..2e40cc83526a 100644 --- a/net/ipv4/netfilter/nf_nat_proto_gre.c +++ b/net/ipv4/netfilter/nf_nat_proto_gre.c | |||
@@ -36,13 +36,6 @@ MODULE_LICENSE("GPL"); | |||
36 | MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); | 36 | MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); |
37 | MODULE_DESCRIPTION("Netfilter NAT protocol helper module for GRE"); | 37 | MODULE_DESCRIPTION("Netfilter NAT protocol helper module for GRE"); |
38 | 38 | ||
39 | #if 0 | ||
40 | #define DEBUGP(format, args...) printk(KERN_DEBUG "%s:%s: " format, __FILE__, \ | ||
41 | __FUNCTION__, ## args) | ||
42 | #else | ||
43 | #define DEBUGP(x, args...) | ||
44 | #endif | ||
45 | |||
46 | /* is key in given range between min and max */ | 39 | /* is key in given range between min and max */ |
47 | static int | 40 | static int |
48 | gre_in_range(const struct nf_conntrack_tuple *tuple, | 41 | gre_in_range(const struct nf_conntrack_tuple *tuple, |
@@ -83,7 +76,7 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
83 | keyptr = &tuple->dst.u.gre.key; | 76 | keyptr = &tuple->dst.u.gre.key; |
84 | 77 | ||
85 | if (!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED)) { | 78 | if (!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED)) { |
86 | DEBUGP("%p: NATing GRE PPTP\n", conntrack); | 79 | pr_debug("%p: NATing GRE PPTP\n", conntrack); |
87 | min = 1; | 80 | min = 1; |
88 | range_size = 0xffff; | 81 | range_size = 0xffff; |
89 | } else { | 82 | } else { |
@@ -91,7 +84,7 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
91 | range_size = ntohs(range->max.gre.key) - min + 1; | 84 | range_size = ntohs(range->max.gre.key) - min + 1; |
92 | } | 85 | } |
93 | 86 | ||
94 | DEBUGP("min = %u, range_size = %u\n", min, range_size); | 87 | pr_debug("min = %u, range_size = %u\n", min, range_size); |
95 | 88 | ||
96 | for (i = 0; i < range_size; i++, key++) { | 89 | for (i = 0; i < range_size; i++, key++) { |
97 | *keyptr = htons(min + key % range_size); | 90 | *keyptr = htons(min + key % range_size); |
@@ -99,7 +92,7 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
99 | return 1; | 92 | return 1; |
100 | } | 93 | } |
101 | 94 | ||
102 | DEBUGP("%p: no NAT mapping\n", conntrack); | 95 | pr_debug("%p: no NAT mapping\n", conntrack); |
103 | return 0; | 96 | return 0; |
104 | } | 97 | } |
105 | 98 | ||
@@ -132,11 +125,11 @@ gre_manip_pkt(struct sk_buff **pskb, unsigned int iphdroff, | |||
132 | * Try to behave like "nf_nat_proto_unknown" */ | 125 | * Try to behave like "nf_nat_proto_unknown" */ |
133 | break; | 126 | break; |
134 | case GRE_VERSION_PPTP: | 127 | case GRE_VERSION_PPTP: |
135 | DEBUGP("call_id -> 0x%04x\n", ntohs(tuple->dst.u.gre.key)); | 128 | pr_debug("call_id -> 0x%04x\n", ntohs(tuple->dst.u.gre.key)); |
136 | pgreh->call_id = tuple->dst.u.gre.key; | 129 | pgreh->call_id = tuple->dst.u.gre.key; |
137 | break; | 130 | break; |
138 | default: | 131 | default: |
139 | DEBUGP("can't nat unknown GRE version\n"); | 132 | pr_debug("can't nat unknown GRE version\n"); |
140 | return 0; | 133 | return 0; |
141 | } | 134 | } |
142 | return 1; | 135 | return 1; |
diff --git a/net/ipv4/netfilter/nf_nat_rule.c b/net/ipv4/netfilter/nf_nat_rule.c index 080393a143d7..0f45427e5fdc 100644 --- a/net/ipv4/netfilter/nf_nat_rule.c +++ b/net/ipv4/netfilter/nf_nat_rule.c | |||
@@ -24,12 +24,6 @@ | |||
24 | #include <net/netfilter/nf_nat_core.h> | 24 | #include <net/netfilter/nf_nat_core.h> |
25 | #include <net/netfilter/nf_nat_rule.h> | 25 | #include <net/netfilter/nf_nat_rule.h> |
26 | 26 | ||
27 | #if 0 | ||
28 | #define DEBUGP printk | ||
29 | #else | ||
30 | #define DEBUGP(format, args...) | ||
31 | #endif | ||
32 | |||
33 | #define NAT_VALID_HOOKS ((1<<NF_IP_PRE_ROUTING) | (1<<NF_IP_POST_ROUTING) | (1<<NF_IP_LOCAL_OUT)) | 27 | #define NAT_VALID_HOOKS ((1<<NF_IP_PRE_ROUTING) | (1<<NF_IP_POST_ROUTING) | (1<<NF_IP_LOCAL_OUT)) |
34 | 28 | ||
35 | static struct | 29 | static struct |
@@ -186,8 +180,8 @@ alloc_null_binding(struct nf_conn *ct, unsigned int hooknum) | |||
186 | struct nf_nat_range range | 180 | struct nf_nat_range range |
187 | = { IP_NAT_RANGE_MAP_IPS, ip, ip, { 0 }, { 0 } }; | 181 | = { IP_NAT_RANGE_MAP_IPS, ip, ip, { 0 }, { 0 } }; |
188 | 182 | ||
189 | DEBUGP("Allocating NULL binding for %p (%u.%u.%u.%u)\n", | 183 | pr_debug("Allocating NULL binding for %p (%u.%u.%u.%u)\n", |
190 | ct, NIPQUAD(ip)); | 184 | ct, NIPQUAD(ip)); |
191 | return nf_nat_setup_info(ct, &range, hooknum); | 185 | return nf_nat_setup_info(ct, &range, hooknum); |
192 | } | 186 | } |
193 | 187 | ||
@@ -205,8 +199,8 @@ alloc_null_binding_confirmed(struct nf_conn *ct, unsigned int hooknum) | |||
205 | struct nf_nat_range range | 199 | struct nf_nat_range range |
206 | = { IP_NAT_RANGE_MAP_IPS, ip, ip, { all }, { all } }; | 200 | = { IP_NAT_RANGE_MAP_IPS, ip, ip, { all }, { all } }; |
207 | 201 | ||
208 | DEBUGP("Allocating NULL binding for confirmed %p (%u.%u.%u.%u)\n", | 202 | pr_debug("Allocating NULL binding for confirmed %p (%u.%u.%u.%u)\n", |
209 | ct, NIPQUAD(ip)); | 203 | ct, NIPQUAD(ip)); |
210 | return nf_nat_setup_info(ct, &range, hooknum); | 204 | return nf_nat_setup_info(ct, &range, hooknum); |
211 | } | 205 | } |
212 | 206 | ||
diff --git a/net/ipv4/netfilter/nf_nat_sip.c b/net/ipv4/netfilter/nf_nat_sip.c index 940cdfc429de..a889ec3ec83a 100644 --- a/net/ipv4/netfilter/nf_nat_sip.c +++ b/net/ipv4/netfilter/nf_nat_sip.c | |||
@@ -26,12 +26,6 @@ MODULE_AUTHOR("Christian Hentschel <chentschel@arnet.com.ar>"); | |||
26 | MODULE_DESCRIPTION("SIP NAT helper"); | 26 | MODULE_DESCRIPTION("SIP NAT helper"); |
27 | MODULE_ALIAS("ip_nat_sip"); | 27 | MODULE_ALIAS("ip_nat_sip"); |
28 | 28 | ||
29 | #if 0 | ||
30 | #define DEBUGP printk | ||
31 | #else | ||
32 | #define DEBUGP(format, args...) | ||
33 | #endif | ||
34 | |||
35 | struct addr_map { | 29 | struct addr_map { |
36 | struct { | 30 | struct { |
37 | char src[sizeof("nnn.nnn.nnn.nnn:nnnnn")]; | 31 | char src[sizeof("nnn.nnn.nnn.nnn:nnnnn")]; |
@@ -257,8 +251,6 @@ static unsigned int ip_nat_sdp(struct sk_buff **pskb, | |||
257 | __be32 newip; | 251 | __be32 newip; |
258 | u_int16_t port; | 252 | u_int16_t port; |
259 | 253 | ||
260 | DEBUGP("ip_nat_sdp():\n"); | ||
261 | |||
262 | /* Connection will come from reply */ | 254 | /* Connection will come from reply */ |
263 | if (ct->tuplehash[dir].tuple.src.u3.ip == | 255 | if (ct->tuplehash[dir].tuple.src.u3.ip == |
264 | ct->tuplehash[!dir].tuple.dst.u3.ip) | 256 | ct->tuplehash[!dir].tuple.dst.u3.ip) |
diff --git a/net/ipv4/netfilter/nf_nat_standalone.c b/net/ipv4/netfilter/nf_nat_standalone.c index 30eeaa4c645c..332814dac503 100644 --- a/net/ipv4/netfilter/nf_nat_standalone.c +++ b/net/ipv4/netfilter/nf_nat_standalone.c | |||
@@ -27,12 +27,6 @@ | |||
27 | #include <net/netfilter/nf_nat_helper.h> | 27 | #include <net/netfilter/nf_nat_helper.h> |
28 | #include <linux/netfilter_ipv4/ip_tables.h> | 28 | #include <linux/netfilter_ipv4/ip_tables.h> |
29 | 29 | ||
30 | #if 0 | ||
31 | #define DEBUGP printk | ||
32 | #else | ||
33 | #define DEBUGP(format, args...) | ||
34 | #endif | ||
35 | |||
36 | #ifdef CONFIG_XFRM | 30 | #ifdef CONFIG_XFRM |
37 | static void nat_decode_session(struct sk_buff *skb, struct flowi *fl) | 31 | static void nat_decode_session(struct sk_buff *skb, struct flowi *fl) |
38 | { | 32 | { |
@@ -117,7 +111,7 @@ nf_nat_fn(unsigned int hooknum, | |||
117 | if (!nat) { | 111 | if (!nat) { |
118 | nat = nf_ct_ext_add(ct, NF_CT_EXT_NAT, GFP_ATOMIC); | 112 | nat = nf_ct_ext_add(ct, NF_CT_EXT_NAT, GFP_ATOMIC); |
119 | if (nat == NULL) { | 113 | if (nat == NULL) { |
120 | DEBUGP("failed to add NAT extension\n"); | 114 | pr_debug("failed to add NAT extension\n"); |
121 | return NF_ACCEPT; | 115 | return NF_ACCEPT; |
122 | } | 116 | } |
123 | } | 117 | } |
@@ -154,9 +148,9 @@ nf_nat_fn(unsigned int hooknum, | |||
154 | return ret; | 148 | return ret; |
155 | } | 149 | } |
156 | } else | 150 | } else |
157 | DEBUGP("Already setup manip %s for ct %p\n", | 151 | pr_debug("Already setup manip %s for ct %p\n", |
158 | maniptype == IP_NAT_MANIP_SRC ? "SRC" : "DST", | 152 | maniptype == IP_NAT_MANIP_SRC ? "SRC" : "DST", |
159 | ct); | 153 | ct); |
160 | break; | 154 | break; |
161 | 155 | ||
162 | default: | 156 | default: |
@@ -270,7 +264,7 @@ nf_nat_adjust(unsigned int hooknum, | |||
270 | 264 | ||
271 | ct = nf_ct_get(*pskb, &ctinfo); | 265 | ct = nf_ct_get(*pskb, &ctinfo); |
272 | if (ct && test_bit(IPS_SEQ_ADJUST_BIT, &ct->status)) { | 266 | if (ct && test_bit(IPS_SEQ_ADJUST_BIT, &ct->status)) { |
273 | DEBUGP("nf_nat_standalone: adjusting sequence number\n"); | 267 | pr_debug("nf_nat_standalone: adjusting sequence number\n"); |
274 | if (!nf_nat_seq_adjust(pskb, ct, ctinfo)) | 268 | if (!nf_nat_seq_adjust(pskb, ct, ctinfo)) |
275 | return NF_DROP; | 269 | return NF_DROP; |
276 | } | 270 | } |
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c index 540bf14b851c..b05327ebd332 100644 --- a/net/ipv6/netfilter/ip6t_LOG.c +++ b/net/ipv6/netfilter/ip6t_LOG.c | |||
@@ -32,12 +32,6 @@ struct in_device; | |||
32 | #include <net/route.h> | 32 | #include <net/route.h> |
33 | #include <linux/netfilter_ipv6/ip6t_LOG.h> | 33 | #include <linux/netfilter_ipv6/ip6t_LOG.h> |
34 | 34 | ||
35 | #if 0 | ||
36 | #define DEBUGP printk | ||
37 | #else | ||
38 | #define DEBUGP(format, args...) | ||
39 | #endif | ||
40 | |||
41 | /* Use lock to serialize, so printks don't overlap */ | 35 | /* Use lock to serialize, so printks don't overlap */ |
42 | static DEFINE_SPINLOCK(log_lock); | 36 | static DEFINE_SPINLOCK(log_lock); |
43 | 37 | ||
@@ -466,12 +460,12 @@ static bool ip6t_log_checkentry(const char *tablename, | |||
466 | const struct ip6t_log_info *loginfo = targinfo; | 460 | const struct ip6t_log_info *loginfo = targinfo; |
467 | 461 | ||
468 | if (loginfo->level >= 8) { | 462 | if (loginfo->level >= 8) { |
469 | DEBUGP("LOG: level %u >= 8\n", loginfo->level); | 463 | pr_debug("LOG: level %u >= 8\n", loginfo->level); |
470 | return false; | 464 | return false; |
471 | } | 465 | } |
472 | if (loginfo->prefix[sizeof(loginfo->prefix)-1] != '\0') { | 466 | if (loginfo->prefix[sizeof(loginfo->prefix)-1] != '\0') { |
473 | DEBUGP("LOG: prefix term %i\n", | 467 | pr_debug("LOG: prefix term %i\n", |
474 | loginfo->prefix[sizeof(loginfo->prefix)-1]); | 468 | loginfo->prefix[sizeof(loginfo->prefix)-1]); |
475 | return false; | 469 | return false; |
476 | } | 470 | } |
477 | return true; | 471 | return true; |
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c index 14008dc6a197..2f487cda3b6b 100644 --- a/net/ipv6/netfilter/ip6t_REJECT.c +++ b/net/ipv6/netfilter/ip6t_REJECT.c | |||
@@ -34,12 +34,6 @@ MODULE_AUTHOR("Yasuyuki KOZAKAI <yasuyuki.kozakai@toshiba.co.jp>"); | |||
34 | MODULE_DESCRIPTION("IP6 tables REJECT target module"); | 34 | MODULE_DESCRIPTION("IP6 tables REJECT target module"); |
35 | MODULE_LICENSE("GPL"); | 35 | MODULE_LICENSE("GPL"); |
36 | 36 | ||
37 | #if 0 | ||
38 | #define DEBUGP printk | ||
39 | #else | ||
40 | #define DEBUGP(format, args...) | ||
41 | #endif | ||
42 | |||
43 | /* Send RST reply */ | 37 | /* Send RST reply */ |
44 | static void send_reset(struct sk_buff *oldskb) | 38 | static void send_reset(struct sk_buff *oldskb) |
45 | { | 39 | { |
@@ -54,7 +48,7 @@ static void send_reset(struct sk_buff *oldskb) | |||
54 | 48 | ||
55 | if ((!(ipv6_addr_type(&oip6h->saddr) & IPV6_ADDR_UNICAST)) || | 49 | if ((!(ipv6_addr_type(&oip6h->saddr) & IPV6_ADDR_UNICAST)) || |
56 | (!(ipv6_addr_type(&oip6h->daddr) & IPV6_ADDR_UNICAST))) { | 50 | (!(ipv6_addr_type(&oip6h->daddr) & IPV6_ADDR_UNICAST))) { |
57 | DEBUGP("ip6t_REJECT: addr is not unicast.\n"); | 51 | pr_debug("ip6t_REJECT: addr is not unicast.\n"); |
58 | return; | 52 | return; |
59 | } | 53 | } |
60 | 54 | ||
@@ -62,7 +56,7 @@ static void send_reset(struct sk_buff *oldskb) | |||
62 | tcphoff = ipv6_skip_exthdr(oldskb, ((u8*)(oip6h+1) - oldskb->data), &proto); | 56 | tcphoff = ipv6_skip_exthdr(oldskb, ((u8*)(oip6h+1) - oldskb->data), &proto); |
63 | 57 | ||
64 | if ((tcphoff < 0) || (tcphoff > oldskb->len)) { | 58 | if ((tcphoff < 0) || (tcphoff > oldskb->len)) { |
65 | DEBUGP("ip6t_REJECT: Can't get TCP header.\n"); | 59 | pr_debug("ip6t_REJECT: Can't get TCP header.\n"); |
66 | return; | 60 | return; |
67 | } | 61 | } |
68 | 62 | ||
@@ -70,8 +64,9 @@ static void send_reset(struct sk_buff *oldskb) | |||
70 | 64 | ||
71 | /* IP header checks: fragment, too short. */ | 65 | /* IP header checks: fragment, too short. */ |
72 | if (proto != IPPROTO_TCP || otcplen < sizeof(struct tcphdr)) { | 66 | if (proto != IPPROTO_TCP || otcplen < sizeof(struct tcphdr)) { |
73 | DEBUGP("ip6t_REJECT: proto(%d) != IPPROTO_TCP, or too short. otcplen = %d\n", | 67 | pr_debug("ip6t_REJECT: proto(%d) != IPPROTO_TCP, " |
74 | proto, otcplen); | 68 | "or too short. otcplen = %d\n", |
69 | proto, otcplen); | ||
75 | return; | 70 | return; |
76 | } | 71 | } |
77 | 72 | ||
@@ -80,14 +75,14 @@ static void send_reset(struct sk_buff *oldskb) | |||
80 | 75 | ||
81 | /* No RST for RST. */ | 76 | /* No RST for RST. */ |
82 | if (otcph.rst) { | 77 | if (otcph.rst) { |
83 | DEBUGP("ip6t_REJECT: RST is set\n"); | 78 | pr_debug("ip6t_REJECT: RST is set\n"); |
84 | return; | 79 | return; |
85 | } | 80 | } |
86 | 81 | ||
87 | /* Check checksum. */ | 82 | /* Check checksum. */ |
88 | if (csum_ipv6_magic(&oip6h->saddr, &oip6h->daddr, otcplen, IPPROTO_TCP, | 83 | if (csum_ipv6_magic(&oip6h->saddr, &oip6h->daddr, otcplen, IPPROTO_TCP, |
89 | skb_checksum(oldskb, tcphoff, otcplen, 0))) { | 84 | skb_checksum(oldskb, tcphoff, otcplen, 0))) { |
90 | DEBUGP("ip6t_REJECT: TCP checksum is invalid\n"); | 85 | pr_debug("ip6t_REJECT: TCP checksum is invalid\n"); |
91 | return; | 86 | return; |
92 | } | 87 | } |
93 | 88 | ||
@@ -186,7 +181,7 @@ static unsigned int reject6_target(struct sk_buff **pskb, | |||
186 | { | 181 | { |
187 | const struct ip6t_reject_info *reject = targinfo; | 182 | const struct ip6t_reject_info *reject = targinfo; |
188 | 183 | ||
189 | DEBUGP(KERN_DEBUG "%s: medium point\n", __FUNCTION__); | 184 | pr_debug("%s: medium point\n", __FUNCTION__); |
190 | /* WARNING: This code causes reentry within ip6tables. | 185 | /* WARNING: This code causes reentry within ip6tables. |
191 | This means that the ip6tables jump stack is now crap. We | 186 | This means that the ip6tables jump stack is now crap. We |
192 | must return an absolute verdict. --RR */ | 187 | must return an absolute verdict. --RR */ |
@@ -237,7 +232,7 @@ static bool check(const char *tablename, | |||
237 | /* Must specify that it's a TCP packet */ | 232 | /* Must specify that it's a TCP packet */ |
238 | if (e->ipv6.proto != IPPROTO_TCP | 233 | if (e->ipv6.proto != IPPROTO_TCP |
239 | || (e->ipv6.invflags & XT_INV_PROTO)) { | 234 | || (e->ipv6.invflags & XT_INV_PROTO)) { |
240 | DEBUGP("ip6t_REJECT: TCP_RESET illegal for non-tcp\n"); | 235 | printk("ip6t_REJECT: TCP_RESET illegal for non-tcp\n"); |
241 | return false; | 236 | return false; |
242 | } | 237 | } |
243 | } | 238 | } |
diff --git a/net/ipv6/netfilter/ip6t_ah.c b/net/ipv6/netfilter/ip6t_ah.c index a9fe2aa97072..2a25fe25e0e0 100644 --- a/net/ipv6/netfilter/ip6t_ah.c +++ b/net/ipv6/netfilter/ip6t_ah.c | |||
@@ -23,21 +23,16 @@ MODULE_LICENSE("GPL"); | |||
23 | MODULE_DESCRIPTION("IPv6 AH match"); | 23 | MODULE_DESCRIPTION("IPv6 AH match"); |
24 | MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); | 24 | MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); |
25 | 25 | ||
26 | #if 0 | ||
27 | #define DEBUGP printk | ||
28 | #else | ||
29 | #define DEBUGP(format, args...) | ||
30 | #endif | ||
31 | |||
32 | /* Returns 1 if the spi is matched by the range, 0 otherwise */ | 26 | /* Returns 1 if the spi is matched by the range, 0 otherwise */ |
33 | static inline bool | 27 | static inline bool |
34 | spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert) | 28 | spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert) |
35 | { | 29 | { |
36 | bool r; | 30 | bool r; |
37 | DEBUGP("ah spi_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ', | 31 | |
38 | min,spi,max); | 32 | pr_debug("ah spi_match:%c 0x%x <= 0x%x <= 0x%x", |
33 | invert ? '!' : ' ', min, spi, max); | ||
39 | r = (spi >= min && spi <= max) ^ invert; | 34 | r = (spi >= min && spi <= max) ^ invert; |
40 | DEBUGP(" result %s\n",r? "PASS\n" : "FAILED\n"); | 35 | pr_debug(" result %s\n", r ? "PASS" : "FAILED"); |
41 | return r; | 36 | return r; |
42 | } | 37 | } |
43 | 38 | ||
@@ -73,22 +68,22 @@ match(const struct sk_buff *skb, | |||
73 | 68 | ||
74 | hdrlen = (ah->hdrlen + 2) << 2; | 69 | hdrlen = (ah->hdrlen + 2) << 2; |
75 | 70 | ||
76 | DEBUGP("IPv6 AH LEN %u %u ", hdrlen, ah->hdrlen); | 71 | pr_debug("IPv6 AH LEN %u %u ", hdrlen, ah->hdrlen); |
77 | DEBUGP("RES %04X ", ah->reserved); | 72 | pr_debug("RES %04X ", ah->reserved); |
78 | DEBUGP("SPI %u %08X\n", ntohl(ah->spi), ntohl(ah->spi)); | 73 | pr_debug("SPI %u %08X\n", ntohl(ah->spi), ntohl(ah->spi)); |
79 | 74 | ||
80 | DEBUGP("IPv6 AH spi %02X ", | 75 | pr_debug("IPv6 AH spi %02X ", |
81 | spi_match(ahinfo->spis[0], ahinfo->spis[1], | 76 | spi_match(ahinfo->spis[0], ahinfo->spis[1], |
82 | ntohl(ah->spi), | 77 | ntohl(ah->spi), |
83 | !!(ahinfo->invflags & IP6T_AH_INV_SPI))); | 78 | !!(ahinfo->invflags & IP6T_AH_INV_SPI))); |
84 | DEBUGP("len %02X %04X %02X ", | 79 | pr_debug("len %02X %04X %02X ", |
85 | ahinfo->hdrlen, hdrlen, | 80 | ahinfo->hdrlen, hdrlen, |
86 | (!ahinfo->hdrlen || | 81 | (!ahinfo->hdrlen || |
87 | (ahinfo->hdrlen == hdrlen) ^ | 82 | (ahinfo->hdrlen == hdrlen) ^ |
88 | !!(ahinfo->invflags & IP6T_AH_INV_LEN))); | 83 | !!(ahinfo->invflags & IP6T_AH_INV_LEN))); |
89 | DEBUGP("res %02X %04X %02X\n", | 84 | pr_debug("res %02X %04X %02X\n", |
90 | ahinfo->hdrres, ah->reserved, | 85 | ahinfo->hdrres, ah->reserved, |
91 | !(ahinfo->hdrres && ah->reserved)); | 86 | !(ahinfo->hdrres && ah->reserved)); |
92 | 87 | ||
93 | return (ah != NULL) | 88 | return (ah != NULL) |
94 | && | 89 | && |
@@ -114,7 +109,7 @@ checkentry(const char *tablename, | |||
114 | const struct ip6t_ah *ahinfo = matchinfo; | 109 | const struct ip6t_ah *ahinfo = matchinfo; |
115 | 110 | ||
116 | if (ahinfo->invflags & ~IP6T_AH_INV_MASK) { | 111 | if (ahinfo->invflags & ~IP6T_AH_INV_MASK) { |
117 | DEBUGP("ip6t_ah: unknown flags %X\n", ahinfo->invflags); | 112 | pr_debug("ip6t_ah: unknown flags %X\n", ahinfo->invflags); |
118 | return false; | 113 | return false; |
119 | } | 114 | } |
120 | return true; | 115 | return true; |
diff --git a/net/ipv6/netfilter/ip6t_frag.c b/net/ipv6/netfilter/ip6t_frag.c index bb1cfa82b47c..968aeba02073 100644 --- a/net/ipv6/netfilter/ip6t_frag.c +++ b/net/ipv6/netfilter/ip6t_frag.c | |||
@@ -22,21 +22,15 @@ MODULE_LICENSE("GPL"); | |||
22 | MODULE_DESCRIPTION("IPv6 FRAG match"); | 22 | MODULE_DESCRIPTION("IPv6 FRAG match"); |
23 | MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); | 23 | MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); |
24 | 24 | ||
25 | #if 0 | ||
26 | #define DEBUGP printk | ||
27 | #else | ||
28 | #define DEBUGP(format, args...) | ||
29 | #endif | ||
30 | |||
31 | /* Returns 1 if the id is matched by the range, 0 otherwise */ | 25 | /* Returns 1 if the id is matched by the range, 0 otherwise */ |
32 | static inline bool | 26 | static inline bool |
33 | id_match(u_int32_t min, u_int32_t max, u_int32_t id, bool invert) | 27 | id_match(u_int32_t min, u_int32_t max, u_int32_t id, bool invert) |
34 | { | 28 | { |
35 | bool r; | 29 | bool r; |
36 | DEBUGP("frag id_match:%c 0x%x <= 0x%x <= 0x%x", invert ? '!' : ' ', | 30 | pr_debug("frag id_match:%c 0x%x <= 0x%x <= 0x%x", invert ? '!' : ' ', |
37 | min, id, max); | 31 | min, id, max); |
38 | r = (id >= min && id <= max) ^ invert; | 32 | r = (id >= min && id <= max) ^ invert; |
39 | DEBUGP(" result %s\n", r ? "PASS" : "FAILED"); | 33 | pr_debug(" result %s\n", r ? "PASS" : "FAILED"); |
40 | return r; | 34 | return r; |
41 | } | 35 | } |
42 | 36 | ||
@@ -69,37 +63,37 @@ match(const struct sk_buff *skb, | |||
69 | return false; | 63 | return false; |
70 | } | 64 | } |
71 | 65 | ||
72 | DEBUGP("INFO %04X ", fh->frag_off); | 66 | pr_debug("INFO %04X ", fh->frag_off); |
73 | DEBUGP("OFFSET %04X ", ntohs(fh->frag_off) & ~0x7); | 67 | pr_debug("OFFSET %04X ", ntohs(fh->frag_off) & ~0x7); |
74 | DEBUGP("RES %02X %04X", fh->reserved, ntohs(fh->frag_off) & 0x6); | 68 | pr_debug("RES %02X %04X", fh->reserved, ntohs(fh->frag_off) & 0x6); |
75 | DEBUGP("MF %04X ", fh->frag_off & htons(IP6_MF)); | 69 | pr_debug("MF %04X ", fh->frag_off & htons(IP6_MF)); |
76 | DEBUGP("ID %u %08X\n", ntohl(fh->identification), | 70 | pr_debug("ID %u %08X\n", ntohl(fh->identification), |
77 | ntohl(fh->identification)); | 71 | ntohl(fh->identification)); |
78 | 72 | ||
79 | DEBUGP("IPv6 FRAG id %02X ", | 73 | pr_debug("IPv6 FRAG id %02X ", |
80 | id_match(fraginfo->ids[0], fraginfo->ids[1], | 74 | id_match(fraginfo->ids[0], fraginfo->ids[1], |
81 | ntohl(fh->identification), | 75 | ntohl(fh->identification), |
82 | !!(fraginfo->invflags & IP6T_FRAG_INV_IDS))); | 76 | !!(fraginfo->invflags & IP6T_FRAG_INV_IDS))); |
83 | DEBUGP("res %02X %02X%04X %02X ", | 77 | pr_debug("res %02X %02X%04X %02X ", |
84 | fraginfo->flags & IP6T_FRAG_RES, fh->reserved, | 78 | fraginfo->flags & IP6T_FRAG_RES, fh->reserved, |
85 | ntohs(fh->frag_off) & 0x6, | 79 | ntohs(fh->frag_off) & 0x6, |
86 | !((fraginfo->flags & IP6T_FRAG_RES) | 80 | !((fraginfo->flags & IP6T_FRAG_RES) |
87 | && (fh->reserved || (ntohs(fh->frag_off) & 0x06)))); | 81 | && (fh->reserved || (ntohs(fh->frag_off) & 0x06)))); |
88 | DEBUGP("first %02X %02X %02X ", | 82 | pr_debug("first %02X %02X %02X ", |
89 | fraginfo->flags & IP6T_FRAG_FST, | 83 | fraginfo->flags & IP6T_FRAG_FST, |
90 | ntohs(fh->frag_off) & ~0x7, | 84 | ntohs(fh->frag_off) & ~0x7, |
91 | !((fraginfo->flags & IP6T_FRAG_FST) | 85 | !((fraginfo->flags & IP6T_FRAG_FST) |
92 | && (ntohs(fh->frag_off) & ~0x7))); | 86 | && (ntohs(fh->frag_off) & ~0x7))); |
93 | DEBUGP("mf %02X %02X %02X ", | 87 | pr_debug("mf %02X %02X %02X ", |
94 | fraginfo->flags & IP6T_FRAG_MF, | 88 | fraginfo->flags & IP6T_FRAG_MF, |
95 | ntohs(fh->frag_off) & IP6_MF, | 89 | ntohs(fh->frag_off) & IP6_MF, |
96 | !((fraginfo->flags & IP6T_FRAG_MF) | 90 | !((fraginfo->flags & IP6T_FRAG_MF) |
97 | && !((ntohs(fh->frag_off) & IP6_MF)))); | 91 | && !((ntohs(fh->frag_off) & IP6_MF)))); |
98 | DEBUGP("last %02X %02X %02X\n", | 92 | pr_debug("last %02X %02X %02X\n", |
99 | fraginfo->flags & IP6T_FRAG_NMF, | 93 | fraginfo->flags & IP6T_FRAG_NMF, |
100 | ntohs(fh->frag_off) & IP6_MF, | 94 | ntohs(fh->frag_off) & IP6_MF, |
101 | !((fraginfo->flags & IP6T_FRAG_NMF) | 95 | !((fraginfo->flags & IP6T_FRAG_NMF) |
102 | && (ntohs(fh->frag_off) & IP6_MF))); | 96 | && (ntohs(fh->frag_off) & IP6_MF))); |
103 | 97 | ||
104 | return (fh != NULL) | 98 | return (fh != NULL) |
105 | && | 99 | && |
@@ -131,7 +125,7 @@ checkentry(const char *tablename, | |||
131 | const struct ip6t_frag *fraginfo = matchinfo; | 125 | const struct ip6t_frag *fraginfo = matchinfo; |
132 | 126 | ||
133 | if (fraginfo->invflags & ~IP6T_FRAG_INV_MASK) { | 127 | if (fraginfo->invflags & ~IP6T_FRAG_INV_MASK) { |
134 | DEBUGP("ip6t_frag: unknown flags %X\n", fraginfo->invflags); | 128 | pr_debug("ip6t_frag: unknown flags %X\n", fraginfo->invflags); |
135 | return false; | 129 | return false; |
136 | } | 130 | } |
137 | return true; | 131 | return true; |
diff --git a/net/ipv6/netfilter/ip6t_hbh.c b/net/ipv6/netfilter/ip6t_hbh.c index 6247d4cdad99..e6ca6018b1ea 100644 --- a/net/ipv6/netfilter/ip6t_hbh.c +++ b/net/ipv6/netfilter/ip6t_hbh.c | |||
@@ -25,12 +25,6 @@ MODULE_DESCRIPTION("IPv6 opts match"); | |||
25 | MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); | 25 | MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); |
26 | MODULE_ALIAS("ip6t_dst"); | 26 | MODULE_ALIAS("ip6t_dst"); |
27 | 27 | ||
28 | #if 0 | ||
29 | #define DEBUGP printk | ||
30 | #else | ||
31 | #define DEBUGP(format, args...) | ||
32 | #endif | ||
33 | |||
34 | /* | 28 | /* |
35 | * (Type & 0xC0) >> 6 | 29 | * (Type & 0xC0) >> 6 |
36 | * 0 -> ignorable | 30 | * 0 -> ignorable |
@@ -90,13 +84,13 @@ match(const struct sk_buff *skb, | |||
90 | return false; | 84 | return false; |
91 | } | 85 | } |
92 | 86 | ||
93 | DEBUGP("IPv6 OPTS LEN %u %u ", hdrlen, oh->hdrlen); | 87 | pr_debug("IPv6 OPTS LEN %u %u ", hdrlen, oh->hdrlen); |
94 | 88 | ||
95 | DEBUGP("len %02X %04X %02X ", | 89 | pr_debug("len %02X %04X %02X ", |
96 | optinfo->hdrlen, hdrlen, | 90 | optinfo->hdrlen, hdrlen, |
97 | (!(optinfo->flags & IP6T_OPTS_LEN) || | 91 | (!(optinfo->flags & IP6T_OPTS_LEN) || |
98 | ((optinfo->hdrlen == hdrlen) ^ | 92 | ((optinfo->hdrlen == hdrlen) ^ |
99 | !!(optinfo->invflags & IP6T_OPTS_INV_LEN)))); | 93 | !!(optinfo->invflags & IP6T_OPTS_INV_LEN)))); |
100 | 94 | ||
101 | ret = (oh != NULL) && | 95 | ret = (oh != NULL) && |
102 | (!(optinfo->flags & IP6T_OPTS_LEN) || | 96 | (!(optinfo->flags & IP6T_OPTS_LEN) || |
@@ -108,10 +102,10 @@ match(const struct sk_buff *skb, | |||
108 | if (!(optinfo->flags & IP6T_OPTS_OPTS)) { | 102 | if (!(optinfo->flags & IP6T_OPTS_OPTS)) { |
109 | return ret; | 103 | return ret; |
110 | } else if (optinfo->flags & IP6T_OPTS_NSTRICT) { | 104 | } else if (optinfo->flags & IP6T_OPTS_NSTRICT) { |
111 | DEBUGP("Not strict - not implemented"); | 105 | pr_debug("Not strict - not implemented"); |
112 | } else { | 106 | } else { |
113 | DEBUGP("Strict "); | 107 | pr_debug("Strict "); |
114 | DEBUGP("#%d ", optinfo->optsnr); | 108 | pr_debug("#%d ", optinfo->optsnr); |
115 | for (temp = 0; temp < optinfo->optsnr; temp++) { | 109 | for (temp = 0; temp < optinfo->optsnr; temp++) { |
116 | /* type field exists ? */ | 110 | /* type field exists ? */ |
117 | if (hdrlen < 1) | 111 | if (hdrlen < 1) |
@@ -123,12 +117,11 @@ match(const struct sk_buff *skb, | |||
123 | 117 | ||
124 | /* Type check */ | 118 | /* Type check */ |
125 | if (*tp != (optinfo->opts[temp] & 0xFF00) >> 8) { | 119 | if (*tp != (optinfo->opts[temp] & 0xFF00) >> 8) { |
126 | DEBUGP("Tbad %02X %02X\n", | 120 | pr_debug("Tbad %02X %02X\n", *tp, |
127 | *tp, | 121 | (optinfo->opts[temp] & 0xFF00) >> 8); |
128 | (optinfo->opts[temp] & 0xFF00) >> 8); | ||
129 | return false; | 122 | return false; |
130 | } else { | 123 | } else { |
131 | DEBUGP("Tok "); | 124 | pr_debug("Tok "); |
132 | } | 125 | } |
133 | /* Length check */ | 126 | /* Length check */ |
134 | if (*tp) { | 127 | if (*tp) { |
@@ -145,23 +138,23 @@ match(const struct sk_buff *skb, | |||
145 | spec_len = optinfo->opts[temp] & 0x00FF; | 138 | spec_len = optinfo->opts[temp] & 0x00FF; |
146 | 139 | ||
147 | if (spec_len != 0x00FF && spec_len != *lp) { | 140 | if (spec_len != 0x00FF && spec_len != *lp) { |
148 | DEBUGP("Lbad %02X %04X\n", *lp, | 141 | pr_debug("Lbad %02X %04X\n", *lp, |
149 | spec_len); | 142 | spec_len); |
150 | return false; | 143 | return false; |
151 | } | 144 | } |
152 | DEBUGP("Lok "); | 145 | pr_debug("Lok "); |
153 | optlen = *lp + 2; | 146 | optlen = *lp + 2; |
154 | } else { | 147 | } else { |
155 | DEBUGP("Pad1\n"); | 148 | pr_debug("Pad1\n"); |
156 | optlen = 1; | 149 | optlen = 1; |
157 | } | 150 | } |
158 | 151 | ||
159 | /* Step to the next */ | 152 | /* Step to the next */ |
160 | DEBUGP("len%04X \n", optlen); | 153 | pr_debug("len%04X \n", optlen); |
161 | 154 | ||
162 | if ((ptr > skb->len - optlen || hdrlen < optlen) && | 155 | if ((ptr > skb->len - optlen || hdrlen < optlen) && |
163 | temp < optinfo->optsnr - 1) { | 156 | temp < optinfo->optsnr - 1) { |
164 | DEBUGP("new pointer is too large! \n"); | 157 | pr_debug("new pointer is too large! \n"); |
165 | break; | 158 | break; |
166 | } | 159 | } |
167 | ptr += optlen; | 160 | ptr += optlen; |
@@ -187,7 +180,7 @@ checkentry(const char *tablename, | |||
187 | const struct ip6t_opts *optsinfo = matchinfo; | 180 | const struct ip6t_opts *optsinfo = matchinfo; |
188 | 181 | ||
189 | if (optsinfo->invflags & ~IP6T_OPTS_INV_MASK) { | 182 | if (optsinfo->invflags & ~IP6T_OPTS_INV_MASK) { |
190 | DEBUGP("ip6t_opts: unknown flags %X\n", optsinfo->invflags); | 183 | pr_debug("ip6t_opts: unknown flags %X\n", optsinfo->invflags); |
191 | return false; | 184 | return false; |
192 | } | 185 | } |
193 | return true; | 186 | return true; |
diff --git a/net/ipv6/netfilter/ip6t_rt.c b/net/ipv6/netfilter/ip6t_rt.c index 549deea26418..357cea703bd9 100644 --- a/net/ipv6/netfilter/ip6t_rt.c +++ b/net/ipv6/netfilter/ip6t_rt.c | |||
@@ -24,21 +24,15 @@ MODULE_LICENSE("GPL"); | |||
24 | MODULE_DESCRIPTION("IPv6 RT match"); | 24 | MODULE_DESCRIPTION("IPv6 RT match"); |
25 | MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); | 25 | MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); |
26 | 26 | ||
27 | #if 0 | ||
28 | #define DEBUGP printk | ||
29 | #else | ||
30 | #define DEBUGP(format, args...) | ||
31 | #endif | ||
32 | |||
33 | /* Returns 1 if the id is matched by the range, 0 otherwise */ | 27 | /* Returns 1 if the id is matched by the range, 0 otherwise */ |
34 | static inline bool | 28 | static inline bool |
35 | segsleft_match(u_int32_t min, u_int32_t max, u_int32_t id, bool invert) | 29 | segsleft_match(u_int32_t min, u_int32_t max, u_int32_t id, bool invert) |
36 | { | 30 | { |
37 | bool r; | 31 | bool r; |
38 | DEBUGP("rt segsleft_match:%c 0x%x <= 0x%x <= 0x%x", | 32 | pr_debug("rt segsleft_match:%c 0x%x <= 0x%x <= 0x%x", |
39 | invert ? '!' : ' ', min, id, max); | 33 | invert ? '!' : ' ', min, id, max); |
40 | r = (id >= min && id <= max) ^ invert; | 34 | r = (id >= min && id <= max) ^ invert; |
41 | DEBUGP(" result %s\n", r ? "PASS" : "FAILED"); | 35 | pr_debug(" result %s\n", r ? "PASS" : "FAILED"); |
42 | return r; | 36 | return r; |
43 | } | 37 | } |
44 | 38 | ||
@@ -82,29 +76,29 @@ match(const struct sk_buff *skb, | |||
82 | return false; | 76 | return false; |
83 | } | 77 | } |
84 | 78 | ||
85 | DEBUGP("IPv6 RT LEN %u %u ", hdrlen, rh->hdrlen); | 79 | pr_debug("IPv6 RT LEN %u %u ", hdrlen, rh->hdrlen); |
86 | DEBUGP("TYPE %04X ", rh->type); | 80 | pr_debug("TYPE %04X ", rh->type); |
87 | DEBUGP("SGS_LEFT %u %02X\n", rh->segments_left, rh->segments_left); | 81 | pr_debug("SGS_LEFT %u %02X\n", rh->segments_left, rh->segments_left); |
88 | 82 | ||
89 | DEBUGP("IPv6 RT segsleft %02X ", | 83 | pr_debug("IPv6 RT segsleft %02X ", |
90 | segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1], | 84 | segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1], |
91 | rh->segments_left, | 85 | rh->segments_left, |
92 | !!(rtinfo->invflags & IP6T_RT_INV_SGS))); | 86 | !!(rtinfo->invflags & IP6T_RT_INV_SGS))); |
93 | DEBUGP("type %02X %02X %02X ", | 87 | pr_debug("type %02X %02X %02X ", |
94 | rtinfo->rt_type, rh->type, | 88 | rtinfo->rt_type, rh->type, |
95 | (!(rtinfo->flags & IP6T_RT_TYP) || | 89 | (!(rtinfo->flags & IP6T_RT_TYP) || |
96 | ((rtinfo->rt_type == rh->type) ^ | 90 | ((rtinfo->rt_type == rh->type) ^ |
97 | !!(rtinfo->invflags & IP6T_RT_INV_TYP)))); | 91 | !!(rtinfo->invflags & IP6T_RT_INV_TYP)))); |
98 | DEBUGP("len %02X %04X %02X ", | 92 | pr_debug("len %02X %04X %02X ", |
99 | rtinfo->hdrlen, hdrlen, | 93 | rtinfo->hdrlen, hdrlen, |
100 | !(rtinfo->flags & IP6T_RT_LEN) || | 94 | !(rtinfo->flags & IP6T_RT_LEN) || |
101 | ((rtinfo->hdrlen == hdrlen) ^ | 95 | ((rtinfo->hdrlen == hdrlen) ^ |
102 | !!(rtinfo->invflags & IP6T_RT_INV_LEN))); | 96 | !!(rtinfo->invflags & IP6T_RT_INV_LEN))); |
103 | DEBUGP("res %02X %02X %02X ", | 97 | pr_debug("res %02X %02X %02X ", |
104 | rtinfo->flags & IP6T_RT_RES, | 98 | rtinfo->flags & IP6T_RT_RES, |
105 | ((const struct rt0_hdr *)rh)->reserved, | 99 | ((const struct rt0_hdr *)rh)->reserved, |
106 | !((rtinfo->flags & IP6T_RT_RES) && | 100 | !((rtinfo->flags & IP6T_RT_RES) && |
107 | (((const struct rt0_hdr *)rh)->reserved))); | 101 | (((const struct rt0_hdr *)rh)->reserved))); |
108 | 102 | ||
109 | ret = (rh != NULL) | 103 | ret = (rh != NULL) |
110 | && | 104 | && |
@@ -131,18 +125,18 @@ match(const struct sk_buff *skb, | |||
131 | ret = (*rp == 0); | 125 | ret = (*rp == 0); |
132 | } | 126 | } |
133 | 127 | ||
134 | DEBUGP("#%d ", rtinfo->addrnr); | 128 | pr_debug("#%d ", rtinfo->addrnr); |
135 | if (!(rtinfo->flags & IP6T_RT_FST)) { | 129 | if (!(rtinfo->flags & IP6T_RT_FST)) { |
136 | return ret; | 130 | return ret; |
137 | } else if (rtinfo->flags & IP6T_RT_FST_NSTRICT) { | 131 | } else if (rtinfo->flags & IP6T_RT_FST_NSTRICT) { |
138 | DEBUGP("Not strict "); | 132 | pr_debug("Not strict "); |
139 | if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) { | 133 | if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) { |
140 | DEBUGP("There isn't enough space\n"); | 134 | pr_debug("There isn't enough space\n"); |
141 | return false; | 135 | return false; |
142 | } else { | 136 | } else { |
143 | unsigned int i = 0; | 137 | unsigned int i = 0; |
144 | 138 | ||
145 | DEBUGP("#%d ", rtinfo->addrnr); | 139 | pr_debug("#%d ", rtinfo->addrnr); |
146 | for (temp = 0; | 140 | for (temp = 0; |
147 | temp < (unsigned int)((hdrlen - 8) / 16); | 141 | temp < (unsigned int)((hdrlen - 8) / 16); |
148 | temp++) { | 142 | temp++) { |
@@ -156,25 +150,25 @@ match(const struct sk_buff *skb, | |||
156 | BUG_ON(ap == NULL); | 150 | BUG_ON(ap == NULL); |
157 | 151 | ||
158 | if (ipv6_addr_equal(ap, &rtinfo->addrs[i])) { | 152 | if (ipv6_addr_equal(ap, &rtinfo->addrs[i])) { |
159 | DEBUGP("i=%d temp=%d;\n", i, temp); | 153 | pr_debug("i=%d temp=%d;\n", i, temp); |
160 | i++; | 154 | i++; |
161 | } | 155 | } |
162 | if (i == rtinfo->addrnr) | 156 | if (i == rtinfo->addrnr) |
163 | break; | 157 | break; |
164 | } | 158 | } |
165 | DEBUGP("i=%d #%d\n", i, rtinfo->addrnr); | 159 | pr_debug("i=%d #%d\n", i, rtinfo->addrnr); |
166 | if (i == rtinfo->addrnr) | 160 | if (i == rtinfo->addrnr) |
167 | return ret; | 161 | return ret; |
168 | else | 162 | else |
169 | return false; | 163 | return false; |
170 | } | 164 | } |
171 | } else { | 165 | } else { |
172 | DEBUGP("Strict "); | 166 | pr_debug("Strict "); |
173 | if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) { | 167 | if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) { |
174 | DEBUGP("There isn't enough space\n"); | 168 | pr_debug("There isn't enough space\n"); |
175 | return false; | 169 | return false; |
176 | } else { | 170 | } else { |
177 | DEBUGP("#%d ", rtinfo->addrnr); | 171 | pr_debug("#%d ", rtinfo->addrnr); |
178 | for (temp = 0; temp < rtinfo->addrnr; temp++) { | 172 | for (temp = 0; temp < rtinfo->addrnr; temp++) { |
179 | ap = skb_header_pointer(skb, | 173 | ap = skb_header_pointer(skb, |
180 | ptr | 174 | ptr |
@@ -187,7 +181,7 @@ match(const struct sk_buff *skb, | |||
187 | if (!ipv6_addr_equal(ap, &rtinfo->addrs[temp])) | 181 | if (!ipv6_addr_equal(ap, &rtinfo->addrs[temp])) |
188 | break; | 182 | break; |
189 | } | 183 | } |
190 | DEBUGP("temp=%d #%d\n", temp, rtinfo->addrnr); | 184 | pr_debug("temp=%d #%d\n", temp, rtinfo->addrnr); |
191 | if (temp == rtinfo->addrnr && | 185 | if (temp == rtinfo->addrnr && |
192 | temp == (unsigned int)((hdrlen - 8) / 16)) | 186 | temp == (unsigned int)((hdrlen - 8) / 16)) |
193 | return ret; | 187 | return ret; |
@@ -210,14 +204,14 @@ checkentry(const char *tablename, | |||
210 | const struct ip6t_rt *rtinfo = matchinfo; | 204 | const struct ip6t_rt *rtinfo = matchinfo; |
211 | 205 | ||
212 | if (rtinfo->invflags & ~IP6T_RT_INV_MASK) { | 206 | if (rtinfo->invflags & ~IP6T_RT_INV_MASK) { |
213 | DEBUGP("ip6t_rt: unknown flags %X\n", rtinfo->invflags); | 207 | pr_debug("ip6t_rt: unknown flags %X\n", rtinfo->invflags); |
214 | return false; | 208 | return false; |
215 | } | 209 | } |
216 | if ((rtinfo->flags & (IP6T_RT_RES | IP6T_RT_FST_MASK)) && | 210 | if ((rtinfo->flags & (IP6T_RT_RES | IP6T_RT_FST_MASK)) && |
217 | (!(rtinfo->flags & IP6T_RT_TYP) || | 211 | (!(rtinfo->flags & IP6T_RT_TYP) || |
218 | (rtinfo->rt_type != 0) || | 212 | (rtinfo->rt_type != 0) || |
219 | (rtinfo->invflags & IP6T_RT_INV_TYP))) { | 213 | (rtinfo->invflags & IP6T_RT_INV_TYP))) { |
220 | DEBUGP("`--rt-type 0' required before `--rt-0-*'"); | 214 | pr_debug("`--rt-type 0' required before `--rt-0-*'"); |
221 | return false; | 215 | return false; |
222 | } | 216 | } |
223 | 217 | ||
diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c index f2d26495f413..f0a9efa67fb5 100644 --- a/net/ipv6/netfilter/ip6table_mangle.c +++ b/net/ipv6/netfilter/ip6table_mangle.c | |||
@@ -21,12 +21,6 @@ MODULE_DESCRIPTION("ip6tables mangle table"); | |||
21 | (1 << NF_IP6_LOCAL_OUT) | \ | 21 | (1 << NF_IP6_LOCAL_OUT) | \ |
22 | (1 << NF_IP6_POST_ROUTING)) | 22 | (1 << NF_IP6_POST_ROUTING)) |
23 | 23 | ||
24 | #if 0 | ||
25 | #define DEBUGP(x, args...) printk(KERN_DEBUG x, ## args) | ||
26 | #else | ||
27 | #define DEBUGP(x, args...) | ||
28 | #endif | ||
29 | |||
30 | static struct | 24 | static struct |
31 | { | 25 | { |
32 | struct ip6t_replace repl; | 26 | struct ip6t_replace repl; |
diff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c index 0acda45d455d..ec290e4ebdd8 100644 --- a/net/ipv6/netfilter/ip6table_raw.c +++ b/net/ipv6/netfilter/ip6table_raw.c | |||
@@ -8,12 +8,6 @@ | |||
8 | 8 | ||
9 | #define RAW_VALID_HOOKS ((1 << NF_IP6_PRE_ROUTING) | (1 << NF_IP6_LOCAL_OUT)) | 9 | #define RAW_VALID_HOOKS ((1 << NF_IP6_PRE_ROUTING) | (1 << NF_IP6_LOCAL_OUT)) |
10 | 10 | ||
11 | #if 0 | ||
12 | #define DEBUGP(x, args...) printk(KERN_DEBUG x, ## args) | ||
13 | #else | ||
14 | #define DEBUGP(x, args...) | ||
15 | #endif | ||
16 | |||
17 | static struct | 11 | static struct |
18 | { | 12 | { |
19 | struct ip6t_replace repl; | 13 | struct ip6t_replace repl; |
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c index 747b01e53132..89e20ab494b8 100644 --- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | |||
@@ -26,12 +26,6 @@ | |||
26 | #include <net/netfilter/nf_conntrack_l3proto.h> | 26 | #include <net/netfilter/nf_conntrack_l3proto.h> |
27 | #include <net/netfilter/nf_conntrack_core.h> | 27 | #include <net/netfilter/nf_conntrack_core.h> |
28 | 28 | ||
29 | #if 0 | ||
30 | #define DEBUGP printk | ||
31 | #else | ||
32 | #define DEBUGP(format, args...) | ||
33 | #endif | ||
34 | |||
35 | static int ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, | 29 | static int ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, |
36 | struct nf_conntrack_tuple *tuple) | 30 | struct nf_conntrack_tuple *tuple) |
37 | { | 31 | { |
@@ -136,7 +130,7 @@ ipv6_prepare(struct sk_buff **pskb, unsigned int hooknum, unsigned int *dataoff, | |||
136 | * except of IPv6 & ext headers. but it's tracked anyway. - YK | 130 | * except of IPv6 & ext headers. but it's tracked anyway. - YK |
137 | */ | 131 | */ |
138 | if ((protoff < 0) || (protoff > (*pskb)->len)) { | 132 | if ((protoff < 0) || (protoff > (*pskb)->len)) { |
139 | DEBUGP("ip6_conntrack_core: can't find proto in pkt\n"); | 133 | pr_debug("ip6_conntrack_core: can't find proto in pkt\n"); |
140 | NF_CT_STAT_INC_ATOMIC(error); | 134 | NF_CT_STAT_INC_ATOMIC(error); |
141 | NF_CT_STAT_INC_ATOMIC(invalid); | 135 | NF_CT_STAT_INC_ATOMIC(invalid); |
142 | return -NF_ACCEPT; | 136 | return -NF_ACCEPT; |
@@ -178,7 +172,7 @@ static unsigned int ipv6_confirm(unsigned int hooknum, | |||
178 | protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum, | 172 | protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum, |
179 | (*pskb)->len - extoff); | 173 | (*pskb)->len - extoff); |
180 | if (protoff > (*pskb)->len || pnum == NEXTHDR_FRAGMENT) { | 174 | if (protoff > (*pskb)->len || pnum == NEXTHDR_FRAGMENT) { |
181 | DEBUGP("proto header not found\n"); | 175 | pr_debug("proto header not found\n"); |
182 | return NF_ACCEPT; | 176 | return NF_ACCEPT; |
183 | } | 177 | } |
184 | 178 | ||
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index a514661d25dd..9defc7e14554 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | |||
@@ -27,12 +27,6 @@ | |||
27 | 27 | ||
28 | static unsigned long nf_ct_icmpv6_timeout __read_mostly = 30*HZ; | 28 | static unsigned long nf_ct_icmpv6_timeout __read_mostly = 30*HZ; |
29 | 29 | ||
30 | #if 0 | ||
31 | #define DEBUGP printk | ||
32 | #else | ||
33 | #define DEBUGP(format, args...) | ||
34 | #endif | ||
35 | |||
36 | static int icmpv6_pkt_to_tuple(const struct sk_buff *skb, | 30 | static int icmpv6_pkt_to_tuple(const struct sk_buff *skb, |
37 | unsigned int dataoff, | 31 | unsigned int dataoff, |
38 | struct nf_conntrack_tuple *tuple) | 32 | struct nf_conntrack_tuple *tuple) |
@@ -125,8 +119,8 @@ static int icmpv6_new(struct nf_conn *conntrack, | |||
125 | 119 | ||
126 | if (type < 0 || type >= sizeof(valid_new) || !valid_new[type]) { | 120 | if (type < 0 || type >= sizeof(valid_new) || !valid_new[type]) { |
127 | /* Can't create a new ICMPv6 `conn' with this. */ | 121 | /* Can't create a new ICMPv6 `conn' with this. */ |
128 | DEBUGP("icmpv6: can't create new conn with type %u\n", | 122 | pr_debug("icmpv6: can't create new conn with type %u\n", |
129 | type + 128); | 123 | type + 128); |
130 | NF_CT_DUMP_TUPLE(&conntrack->tuplehash[0].tuple); | 124 | NF_CT_DUMP_TUPLE(&conntrack->tuplehash[0].tuple); |
131 | return 0; | 125 | return 0; |
132 | } | 126 | } |
@@ -152,14 +146,15 @@ icmpv6_error_message(struct sk_buff *skb, | |||
152 | 146 | ||
153 | hp = skb_header_pointer(skb, icmp6off, sizeof(_hdr), &_hdr); | 147 | hp = skb_header_pointer(skb, icmp6off, sizeof(_hdr), &_hdr); |
154 | if (hp == NULL) { | 148 | if (hp == NULL) { |
155 | DEBUGP("icmpv6_error: Can't get ICMPv6 hdr.\n"); | 149 | pr_debug("icmpv6_error: Can't get ICMPv6 hdr.\n"); |
156 | return -NF_ACCEPT; | 150 | return -NF_ACCEPT; |
157 | } | 151 | } |
158 | 152 | ||
159 | inip6off = icmp6off + sizeof(_hdr); | 153 | inip6off = icmp6off + sizeof(_hdr); |
160 | if (skb_copy_bits(skb, inip6off+offsetof(struct ipv6hdr, nexthdr), | 154 | if (skb_copy_bits(skb, inip6off+offsetof(struct ipv6hdr, nexthdr), |
161 | &inprotonum, sizeof(inprotonum)) != 0) { | 155 | &inprotonum, sizeof(inprotonum)) != 0) { |
162 | DEBUGP("icmpv6_error: Can't get nexthdr in inner IPv6 header.\n"); | 156 | pr_debug("icmpv6_error: Can't get nexthdr in inner IPv6 " |
157 | "header.\n"); | ||
163 | return -NF_ACCEPT; | 158 | return -NF_ACCEPT; |
164 | } | 159 | } |
165 | inprotoff = nf_ct_ipv6_skip_exthdr(skb, | 160 | inprotoff = nf_ct_ipv6_skip_exthdr(skb, |
@@ -169,7 +164,8 @@ icmpv6_error_message(struct sk_buff *skb, | |||
169 | - sizeof(struct ipv6hdr)); | 164 | - sizeof(struct ipv6hdr)); |
170 | 165 | ||
171 | if ((inprotoff > skb->len) || (inprotonum == NEXTHDR_FRAGMENT)) { | 166 | if ((inprotoff > skb->len) || (inprotonum == NEXTHDR_FRAGMENT)) { |
172 | DEBUGP("icmpv6_error: Can't get protocol header in ICMPv6 payload.\n"); | 167 | pr_debug("icmpv6_error: Can't get protocol header in ICMPv6 " |
168 | "payload.\n"); | ||
173 | return -NF_ACCEPT; | 169 | return -NF_ACCEPT; |
174 | } | 170 | } |
175 | 171 | ||
@@ -179,7 +175,7 @@ icmpv6_error_message(struct sk_buff *skb, | |||
179 | /* Are they talking about one of our connections? */ | 175 | /* Are they talking about one of our connections? */ |
180 | if (!nf_ct_get_tuple(skb, inip6off, inprotoff, PF_INET6, inprotonum, | 176 | if (!nf_ct_get_tuple(skb, inip6off, inprotoff, PF_INET6, inprotonum, |
181 | &origtuple, &nf_conntrack_l3proto_ipv6, inproto)) { | 177 | &origtuple, &nf_conntrack_l3proto_ipv6, inproto)) { |
182 | DEBUGP("icmpv6_error: Can't get tuple\n"); | 178 | pr_debug("icmpv6_error: Can't get tuple\n"); |
183 | return -NF_ACCEPT; | 179 | return -NF_ACCEPT; |
184 | } | 180 | } |
185 | 181 | ||
@@ -187,7 +183,7 @@ icmpv6_error_message(struct sk_buff *skb, | |||
187 | been preserved inside the ICMP. */ | 183 | been preserved inside the ICMP. */ |
188 | if (!nf_ct_invert_tuple(&intuple, &origtuple, | 184 | if (!nf_ct_invert_tuple(&intuple, &origtuple, |
189 | &nf_conntrack_l3proto_ipv6, inproto)) { | 185 | &nf_conntrack_l3proto_ipv6, inproto)) { |
190 | DEBUGP("icmpv6_error: Can't invert tuple\n"); | 186 | pr_debug("icmpv6_error: Can't invert tuple\n"); |
191 | return -NF_ACCEPT; | 187 | return -NF_ACCEPT; |
192 | } | 188 | } |
193 | 189 | ||
@@ -195,7 +191,7 @@ icmpv6_error_message(struct sk_buff *skb, | |||
195 | 191 | ||
196 | h = nf_conntrack_find_get(&intuple); | 192 | h = nf_conntrack_find_get(&intuple); |
197 | if (!h) { | 193 | if (!h) { |
198 | DEBUGP("icmpv6_error: no match\n"); | 194 | pr_debug("icmpv6_error: no match\n"); |
199 | return -NF_ACCEPT; | 195 | return -NF_ACCEPT; |
200 | } else { | 196 | } else { |
201 | if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY) | 197 | if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY) |
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index 347ab7608231..25442a8c1ba8 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c | |||
@@ -44,12 +44,6 @@ | |||
44 | #include <linux/kernel.h> | 44 | #include <linux/kernel.h> |
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | 46 | ||
47 | #if 0 | ||
48 | #define DEBUGP printk | ||
49 | #else | ||
50 | #define DEBUGP(format, args...) | ||
51 | #endif | ||
52 | |||
53 | #define NF_CT_FRAG6_HIGH_THRESH 262144 /* == 256*1024 */ | 47 | #define NF_CT_FRAG6_HIGH_THRESH 262144 /* == 256*1024 */ |
54 | #define NF_CT_FRAG6_LOW_THRESH 196608 /* == 192*1024 */ | 48 | #define NF_CT_FRAG6_LOW_THRESH 196608 /* == 192*1024 */ |
55 | #define NF_CT_FRAG6_TIMEOUT IPV6_FRAG_TIMEOUT | 49 | #define NF_CT_FRAG6_TIMEOUT IPV6_FRAG_TIMEOUT |
@@ -343,7 +337,7 @@ nf_ct_frag6_create(unsigned int hash, __be32 id, struct in6_addr *src, str | |||
343 | struct nf_ct_frag6_queue *fq; | 337 | struct nf_ct_frag6_queue *fq; |
344 | 338 | ||
345 | if ((fq = frag_alloc_queue()) == NULL) { | 339 | if ((fq = frag_alloc_queue()) == NULL) { |
346 | DEBUGP("Can't alloc new queue\n"); | 340 | pr_debug("Can't alloc new queue\n"); |
347 | goto oom; | 341 | goto oom; |
348 | } | 342 | } |
349 | 343 | ||
@@ -393,7 +387,7 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, | |||
393 | int offset, end; | 387 | int offset, end; |
394 | 388 | ||
395 | if (fq->last_in & COMPLETE) { | 389 | if (fq->last_in & COMPLETE) { |
396 | DEBUGP("Allready completed\n"); | 390 | pr_debug("Allready completed\n"); |
397 | goto err; | 391 | goto err; |
398 | } | 392 | } |
399 | 393 | ||
@@ -402,7 +396,7 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, | |||
402 | ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1))); | 396 | ((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1))); |
403 | 397 | ||
404 | if ((unsigned int)end > IPV6_MAXPLEN) { | 398 | if ((unsigned int)end > IPV6_MAXPLEN) { |
405 | DEBUGP("offset is too large.\n"); | 399 | pr_debug("offset is too large.\n"); |
406 | return -1; | 400 | return -1; |
407 | } | 401 | } |
408 | 402 | ||
@@ -420,7 +414,7 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, | |||
420 | */ | 414 | */ |
421 | if (end < fq->len || | 415 | if (end < fq->len || |
422 | ((fq->last_in & LAST_IN) && end != fq->len)) { | 416 | ((fq->last_in & LAST_IN) && end != fq->len)) { |
423 | DEBUGP("already received last fragment\n"); | 417 | pr_debug("already received last fragment\n"); |
424 | goto err; | 418 | goto err; |
425 | } | 419 | } |
426 | fq->last_in |= LAST_IN; | 420 | fq->last_in |= LAST_IN; |
@@ -433,13 +427,13 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, | |||
433 | /* RFC2460 says always send parameter problem in | 427 | /* RFC2460 says always send parameter problem in |
434 | * this case. -DaveM | 428 | * this case. -DaveM |
435 | */ | 429 | */ |
436 | DEBUGP("the end of this fragment is not rounded to 8 bytes.\n"); | 430 | pr_debug("end of fragment not rounded to 8 bytes.\n"); |
437 | return -1; | 431 | return -1; |
438 | } | 432 | } |
439 | if (end > fq->len) { | 433 | if (end > fq->len) { |
440 | /* Some bits beyond end -> corruption. */ | 434 | /* Some bits beyond end -> corruption. */ |
441 | if (fq->last_in & LAST_IN) { | 435 | if (fq->last_in & LAST_IN) { |
442 | DEBUGP("last packet already reached.\n"); | 436 | pr_debug("last packet already reached.\n"); |
443 | goto err; | 437 | goto err; |
444 | } | 438 | } |
445 | fq->len = end; | 439 | fq->len = end; |
@@ -451,11 +445,11 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, | |||
451 | 445 | ||
452 | /* Point into the IP datagram 'data' part. */ | 446 | /* Point into the IP datagram 'data' part. */ |
453 | if (!pskb_pull(skb, (u8 *) (fhdr + 1) - skb->data)) { | 447 | if (!pskb_pull(skb, (u8 *) (fhdr + 1) - skb->data)) { |
454 | DEBUGP("queue: message is too short.\n"); | 448 | pr_debug("queue: message is too short.\n"); |
455 | goto err; | 449 | goto err; |
456 | } | 450 | } |
457 | if (pskb_trim_rcsum(skb, end - offset)) { | 451 | if (pskb_trim_rcsum(skb, end - offset)) { |
458 | DEBUGP("Can't trim\n"); | 452 | pr_debug("Can't trim\n"); |
459 | goto err; | 453 | goto err; |
460 | } | 454 | } |
461 | 455 | ||
@@ -480,11 +474,11 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, | |||
480 | if (i > 0) { | 474 | if (i > 0) { |
481 | offset += i; | 475 | offset += i; |
482 | if (end <= offset) { | 476 | if (end <= offset) { |
483 | DEBUGP("overlap\n"); | 477 | pr_debug("overlap\n"); |
484 | goto err; | 478 | goto err; |
485 | } | 479 | } |
486 | if (!pskb_pull(skb, i)) { | 480 | if (!pskb_pull(skb, i)) { |
487 | DEBUGP("Can't pull\n"); | 481 | pr_debug("Can't pull\n"); |
488 | goto err; | 482 | goto err; |
489 | } | 483 | } |
490 | if (skb->ip_summed != CHECKSUM_UNNECESSARY) | 484 | if (skb->ip_summed != CHECKSUM_UNNECESSARY) |
@@ -503,7 +497,7 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, | |||
503 | /* Eat head of the next overlapped fragment | 497 | /* Eat head of the next overlapped fragment |
504 | * and leave the loop. The next ones cannot overlap. | 498 | * and leave the loop. The next ones cannot overlap. |
505 | */ | 499 | */ |
506 | DEBUGP("Eat head of the overlapped parts.: %d", i); | 500 | pr_debug("Eat head of the overlapped parts.: %d", i); |
507 | if (!pskb_pull(next, i)) | 501 | if (!pskb_pull(next, i)) |
508 | goto err; | 502 | goto err; |
509 | 503 | ||
@@ -586,13 +580,13 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev) | |||
586 | sizeof(struct ipv6hdr) + fq->len - | 580 | sizeof(struct ipv6hdr) + fq->len - |
587 | sizeof(struct frag_hdr)); | 581 | sizeof(struct frag_hdr)); |
588 | if (payload_len > IPV6_MAXPLEN) { | 582 | if (payload_len > IPV6_MAXPLEN) { |
589 | DEBUGP("payload len is too large.\n"); | 583 | pr_debug("payload len is too large.\n"); |
590 | goto out_oversize; | 584 | goto out_oversize; |
591 | } | 585 | } |
592 | 586 | ||
593 | /* Head of list must not be cloned. */ | 587 | /* Head of list must not be cloned. */ |
594 | if (skb_cloned(head) && pskb_expand_head(head, 0, 0, GFP_ATOMIC)) { | 588 | if (skb_cloned(head) && pskb_expand_head(head, 0, 0, GFP_ATOMIC)) { |
595 | DEBUGP("skb is cloned but can't expand head"); | 589 | pr_debug("skb is cloned but can't expand head"); |
596 | goto out_oom; | 590 | goto out_oom; |
597 | } | 591 | } |
598 | 592 | ||
@@ -604,7 +598,7 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev) | |||
604 | int i, plen = 0; | 598 | int i, plen = 0; |
605 | 599 | ||
606 | if ((clone = alloc_skb(0, GFP_ATOMIC)) == NULL) { | 600 | if ((clone = alloc_skb(0, GFP_ATOMIC)) == NULL) { |
607 | DEBUGP("Can't alloc skb\n"); | 601 | pr_debug("Can't alloc skb\n"); |
608 | goto out_oom; | 602 | goto out_oom; |
609 | } | 603 | } |
610 | clone->next = head->next; | 604 | clone->next = head->next; |
@@ -719,11 +713,11 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff) | |||
719 | return -1; | 713 | return -1; |
720 | } | 714 | } |
721 | if (len < (int)sizeof(struct ipv6_opt_hdr)) { | 715 | if (len < (int)sizeof(struct ipv6_opt_hdr)) { |
722 | DEBUGP("too short\n"); | 716 | pr_debug("too short\n"); |
723 | return -1; | 717 | return -1; |
724 | } | 718 | } |
725 | if (nexthdr == NEXTHDR_NONE) { | 719 | if (nexthdr == NEXTHDR_NONE) { |
726 | DEBUGP("next header is none\n"); | 720 | pr_debug("next header is none\n"); |
727 | return -1; | 721 | return -1; |
728 | } | 722 | } |
729 | if (skb_copy_bits(skb, start, &hdr, sizeof(hdr))) | 723 | if (skb_copy_bits(skb, start, &hdr, sizeof(hdr))) |
@@ -764,7 +758,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb) | |||
764 | 758 | ||
765 | /* Jumbo payload inhibits frag. header */ | 759 | /* Jumbo payload inhibits frag. header */ |
766 | if (ipv6_hdr(skb)->payload_len == 0) { | 760 | if (ipv6_hdr(skb)->payload_len == 0) { |
767 | DEBUGP("payload len = 0\n"); | 761 | pr_debug("payload len = 0\n"); |
768 | return skb; | 762 | return skb; |
769 | } | 763 | } |
770 | 764 | ||
@@ -773,14 +767,14 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb) | |||
773 | 767 | ||
774 | clone = skb_clone(skb, GFP_ATOMIC); | 768 | clone = skb_clone(skb, GFP_ATOMIC); |
775 | if (clone == NULL) { | 769 | if (clone == NULL) { |
776 | DEBUGP("Can't clone skb\n"); | 770 | pr_debug("Can't clone skb\n"); |
777 | return skb; | 771 | return skb; |
778 | } | 772 | } |
779 | 773 | ||
780 | NFCT_FRAG6_CB(clone)->orig = skb; | 774 | NFCT_FRAG6_CB(clone)->orig = skb; |
781 | 775 | ||
782 | if (!pskb_may_pull(clone, fhoff + sizeof(*fhdr))) { | 776 | if (!pskb_may_pull(clone, fhoff + sizeof(*fhdr))) { |
783 | DEBUGP("message is too short.\n"); | 777 | pr_debug("message is too short.\n"); |
784 | goto ret_orig; | 778 | goto ret_orig; |
785 | } | 779 | } |
786 | 780 | ||
@@ -789,7 +783,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb) | |||
789 | fhdr = (struct frag_hdr *)skb_transport_header(clone); | 783 | fhdr = (struct frag_hdr *)skb_transport_header(clone); |
790 | 784 | ||
791 | if (!(fhdr->frag_off & htons(0xFFF9))) { | 785 | if (!(fhdr->frag_off & htons(0xFFF9))) { |
792 | DEBUGP("Invalid fragment offset\n"); | 786 | pr_debug("Invalid fragment offset\n"); |
793 | /* It is not a fragmented frame */ | 787 | /* It is not a fragmented frame */ |
794 | goto ret_orig; | 788 | goto ret_orig; |
795 | } | 789 | } |
@@ -799,7 +793,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb) | |||
799 | 793 | ||
800 | fq = fq_find(fhdr->identification, &hdr->saddr, &hdr->daddr); | 794 | fq = fq_find(fhdr->identification, &hdr->saddr, &hdr->daddr); |
801 | if (fq == NULL) { | 795 | if (fq == NULL) { |
802 | DEBUGP("Can't find and can't create new queue\n"); | 796 | pr_debug("Can't find and can't create new queue\n"); |
803 | goto ret_orig; | 797 | goto ret_orig; |
804 | } | 798 | } |
805 | 799 | ||
@@ -807,7 +801,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb) | |||
807 | 801 | ||
808 | if (nf_ct_frag6_queue(fq, clone, fhdr, nhoff) < 0) { | 802 | if (nf_ct_frag6_queue(fq, clone, fhdr, nhoff) < 0) { |
809 | spin_unlock(&fq->lock); | 803 | spin_unlock(&fq->lock); |
810 | DEBUGP("Can't insert skb to queue\n"); | 804 | pr_debug("Can't insert skb to queue\n"); |
811 | fq_put(fq, NULL); | 805 | fq_put(fq, NULL); |
812 | goto ret_orig; | 806 | goto ret_orig; |
813 | } | 807 | } |
@@ -815,7 +809,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb) | |||
815 | if (fq->last_in == (FIRST_IN|LAST_IN) && fq->meat == fq->len) { | 809 | if (fq->last_in == (FIRST_IN|LAST_IN) && fq->meat == fq->len) { |
816 | ret_skb = nf_ct_frag6_reasm(fq, dev); | 810 | ret_skb = nf_ct_frag6_reasm(fq, dev); |
817 | if (ret_skb == NULL) | 811 | if (ret_skb == NULL) |
818 | DEBUGP("Can't reassemble fragmented packets\n"); | 812 | pr_debug("Can't reassemble fragmented packets\n"); |
819 | } | 813 | } |
820 | spin_unlock(&fq->lock); | 814 | spin_unlock(&fq->lock); |
821 | 815 | ||
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 472396dac05c..3d1411012a2c 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -40,12 +40,6 @@ | |||
40 | 40 | ||
41 | #define NF_CONNTRACK_VERSION "0.5.0" | 41 | #define NF_CONNTRACK_VERSION "0.5.0" |
42 | 42 | ||
43 | #if 0 | ||
44 | #define DEBUGP printk | ||
45 | #else | ||
46 | #define DEBUGP(format, args...) | ||
47 | #endif | ||
48 | |||
49 | DEFINE_RWLOCK(nf_conntrack_lock); | 43 | DEFINE_RWLOCK(nf_conntrack_lock); |
50 | EXPORT_SYMBOL_GPL(nf_conntrack_lock); | 44 | EXPORT_SYMBOL_GPL(nf_conntrack_lock); |
51 | 45 | ||
@@ -141,7 +135,7 @@ EXPORT_SYMBOL_GPL(nf_ct_invert_tuple); | |||
141 | static void | 135 | static void |
142 | clean_from_lists(struct nf_conn *ct) | 136 | clean_from_lists(struct nf_conn *ct) |
143 | { | 137 | { |
144 | DEBUGP("clean_from_lists(%p)\n", ct); | 138 | pr_debug("clean_from_lists(%p)\n", ct); |
145 | hlist_del(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnode); | 139 | hlist_del(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnode); |
146 | hlist_del(&ct->tuplehash[IP_CT_DIR_REPLY].hnode); | 140 | hlist_del(&ct->tuplehash[IP_CT_DIR_REPLY].hnode); |
147 | 141 | ||
@@ -155,7 +149,7 @@ destroy_conntrack(struct nf_conntrack *nfct) | |||
155 | struct nf_conn *ct = (struct nf_conn *)nfct; | 149 | struct nf_conn *ct = (struct nf_conn *)nfct; |
156 | struct nf_conntrack_l4proto *l4proto; | 150 | struct nf_conntrack_l4proto *l4proto; |
157 | 151 | ||
158 | DEBUGP("destroy_conntrack(%p)\n", ct); | 152 | pr_debug("destroy_conntrack(%p)\n", ct); |
159 | NF_CT_ASSERT(atomic_read(&nfct->use) == 0); | 153 | NF_CT_ASSERT(atomic_read(&nfct->use) == 0); |
160 | NF_CT_ASSERT(!timer_pending(&ct->timeout)); | 154 | NF_CT_ASSERT(!timer_pending(&ct->timeout)); |
161 | 155 | ||
@@ -194,7 +188,7 @@ destroy_conntrack(struct nf_conntrack *nfct) | |||
194 | if (ct->master) | 188 | if (ct->master) |
195 | nf_ct_put(ct->master); | 189 | nf_ct_put(ct->master); |
196 | 190 | ||
197 | DEBUGP("destroy_conntrack: returning ct=%p to slab\n", ct); | 191 | pr_debug("destroy_conntrack: returning ct=%p to slab\n", ct); |
198 | nf_conntrack_free(ct); | 192 | nf_conntrack_free(ct); |
199 | } | 193 | } |
200 | 194 | ||
@@ -313,7 +307,7 @@ __nf_conntrack_confirm(struct sk_buff **pskb) | |||
313 | /* No external references means noone else could have | 307 | /* No external references means noone else could have |
314 | confirmed us. */ | 308 | confirmed us. */ |
315 | NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); | 309 | NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); |
316 | DEBUGP("Confirming conntrack %p\n", ct); | 310 | pr_debug("Confirming conntrack %p\n", ct); |
317 | 311 | ||
318 | write_lock_bh(&nf_conntrack_lock); | 312 | write_lock_bh(&nf_conntrack_lock); |
319 | 313 | ||
@@ -446,7 +440,7 @@ struct nf_conn *nf_conntrack_alloc(const struct nf_conntrack_tuple *orig, | |||
446 | 440 | ||
447 | conntrack = kmem_cache_zalloc(nf_conntrack_cachep, GFP_ATOMIC); | 441 | conntrack = kmem_cache_zalloc(nf_conntrack_cachep, GFP_ATOMIC); |
448 | if (conntrack == NULL) { | 442 | if (conntrack == NULL) { |
449 | DEBUGP("nf_conntrack_alloc: Can't alloc conntrack.\n"); | 443 | pr_debug("nf_conntrack_alloc: Can't alloc conntrack.\n"); |
450 | atomic_dec(&nf_conntrack_count); | 444 | atomic_dec(&nf_conntrack_count); |
451 | return ERR_PTR(-ENOMEM); | 445 | return ERR_PTR(-ENOMEM); |
452 | } | 446 | } |
@@ -485,27 +479,27 @@ init_conntrack(const struct nf_conntrack_tuple *tuple, | |||
485 | struct nf_conntrack_expect *exp; | 479 | struct nf_conntrack_expect *exp; |
486 | 480 | ||
487 | if (!nf_ct_invert_tuple(&repl_tuple, tuple, l3proto, l4proto)) { | 481 | if (!nf_ct_invert_tuple(&repl_tuple, tuple, l3proto, l4proto)) { |
488 | DEBUGP("Can't invert tuple.\n"); | 482 | pr_debug("Can't invert tuple.\n"); |
489 | return NULL; | 483 | return NULL; |
490 | } | 484 | } |
491 | 485 | ||
492 | conntrack = nf_conntrack_alloc(tuple, &repl_tuple); | 486 | conntrack = nf_conntrack_alloc(tuple, &repl_tuple); |
493 | if (conntrack == NULL || IS_ERR(conntrack)) { | 487 | if (conntrack == NULL || IS_ERR(conntrack)) { |
494 | DEBUGP("Can't allocate conntrack.\n"); | 488 | pr_debug("Can't allocate conntrack.\n"); |
495 | return (struct nf_conntrack_tuple_hash *)conntrack; | 489 | return (struct nf_conntrack_tuple_hash *)conntrack; |
496 | } | 490 | } |
497 | 491 | ||
498 | if (!l4proto->new(conntrack, skb, dataoff)) { | 492 | if (!l4proto->new(conntrack, skb, dataoff)) { |
499 | nf_conntrack_free(conntrack); | 493 | nf_conntrack_free(conntrack); |
500 | DEBUGP("init conntrack: can't track with proto module\n"); | 494 | pr_debug("init conntrack: can't track with proto module\n"); |
501 | return NULL; | 495 | return NULL; |
502 | } | 496 | } |
503 | 497 | ||
504 | write_lock_bh(&nf_conntrack_lock); | 498 | write_lock_bh(&nf_conntrack_lock); |
505 | exp = nf_ct_find_expectation(tuple); | 499 | exp = nf_ct_find_expectation(tuple); |
506 | if (exp) { | 500 | if (exp) { |
507 | DEBUGP("conntrack: expectation arrives ct=%p exp=%p\n", | 501 | pr_debug("conntrack: expectation arrives ct=%p exp=%p\n", |
508 | conntrack, exp); | 502 | conntrack, exp); |
509 | /* Welcome, Mr. Bond. We've been expecting you... */ | 503 | /* Welcome, Mr. Bond. We've been expecting you... */ |
510 | __set_bit(IPS_EXPECTED_BIT, &conntrack->status); | 504 | __set_bit(IPS_EXPECTED_BIT, &conntrack->status); |
511 | conntrack->master = exp->master; | 505 | conntrack->master = exp->master; |
@@ -568,7 +562,7 @@ resolve_normal_ct(struct sk_buff *skb, | |||
568 | if (!nf_ct_get_tuple(skb, skb_network_offset(skb), | 562 | if (!nf_ct_get_tuple(skb, skb_network_offset(skb), |
569 | dataoff, l3num, protonum, &tuple, l3proto, | 563 | dataoff, l3num, protonum, &tuple, l3proto, |
570 | l4proto)) { | 564 | l4proto)) { |
571 | DEBUGP("resolve_normal_ct: Can't get tuple\n"); | 565 | pr_debug("resolve_normal_ct: Can't get tuple\n"); |
572 | return NULL; | 566 | return NULL; |
573 | } | 567 | } |
574 | 568 | ||
@@ -591,13 +585,14 @@ resolve_normal_ct(struct sk_buff *skb, | |||
591 | } else { | 585 | } else { |
592 | /* Once we've had two way comms, always ESTABLISHED. */ | 586 | /* Once we've had two way comms, always ESTABLISHED. */ |
593 | if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) { | 587 | if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) { |
594 | DEBUGP("nf_conntrack_in: normal packet for %p\n", ct); | 588 | pr_debug("nf_conntrack_in: normal packet for %p\n", ct); |
595 | *ctinfo = IP_CT_ESTABLISHED; | 589 | *ctinfo = IP_CT_ESTABLISHED; |
596 | } else if (test_bit(IPS_EXPECTED_BIT, &ct->status)) { | 590 | } else if (test_bit(IPS_EXPECTED_BIT, &ct->status)) { |
597 | DEBUGP("nf_conntrack_in: related packet for %p\n", ct); | 591 | pr_debug("nf_conntrack_in: related packet for %p\n", |
592 | ct); | ||
598 | *ctinfo = IP_CT_RELATED; | 593 | *ctinfo = IP_CT_RELATED; |
599 | } else { | 594 | } else { |
600 | DEBUGP("nf_conntrack_in: new packet for %p\n", ct); | 595 | pr_debug("nf_conntrack_in: new packet for %p\n", ct); |
601 | *ctinfo = IP_CT_NEW; | 596 | *ctinfo = IP_CT_NEW; |
602 | } | 597 | } |
603 | *set_reply = 0; | 598 | *set_reply = 0; |
@@ -629,7 +624,7 @@ nf_conntrack_in(int pf, unsigned int hooknum, struct sk_buff **pskb) | |||
629 | l3proto = __nf_ct_l3proto_find((u_int16_t)pf); | 624 | l3proto = __nf_ct_l3proto_find((u_int16_t)pf); |
630 | 625 | ||
631 | if ((ret = l3proto->prepare(pskb, hooknum, &dataoff, &protonum)) <= 0) { | 626 | if ((ret = l3proto->prepare(pskb, hooknum, &dataoff, &protonum)) <= 0) { |
632 | DEBUGP("not prepared to track yet or error occured\n"); | 627 | pr_debug("not prepared to track yet or error occured\n"); |
633 | return -ret; | 628 | return -ret; |
634 | } | 629 | } |
635 | 630 | ||
@@ -665,7 +660,7 @@ nf_conntrack_in(int pf, unsigned int hooknum, struct sk_buff **pskb) | |||
665 | if (ret < 0) { | 660 | if (ret < 0) { |
666 | /* Invalid: inverse of the return code tells | 661 | /* Invalid: inverse of the return code tells |
667 | * the netfilter core what to do */ | 662 | * the netfilter core what to do */ |
668 | DEBUGP("nf_conntrack_in: Can't track with proto module\n"); | 663 | pr_debug("nf_conntrack_in: Can't track with proto module\n"); |
669 | nf_conntrack_put((*pskb)->nfct); | 664 | nf_conntrack_put((*pskb)->nfct); |
670 | (*pskb)->nfct = NULL; | 665 | (*pskb)->nfct = NULL; |
671 | NF_CT_STAT_INC_ATOMIC(invalid); | 666 | NF_CT_STAT_INC_ATOMIC(invalid); |
@@ -706,7 +701,7 @@ void nf_conntrack_alter_reply(struct nf_conn *ct, | |||
706 | /* Should be unconfirmed, so not in hash table yet */ | 701 | /* Should be unconfirmed, so not in hash table yet */ |
707 | NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); | 702 | NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); |
708 | 703 | ||
709 | DEBUGP("Altering reply tuple of %p to ", ct); | 704 | pr_debug("Altering reply tuple of %p to ", ct); |
710 | NF_CT_DUMP_TUPLE(newreply); | 705 | NF_CT_DUMP_TUPLE(newreply); |
711 | 706 | ||
712 | ct->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply; | 707 | ct->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply; |
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c index cd9c2d00cc09..c763ee74ea02 100644 --- a/net/netfilter/nf_conntrack_ftp.c +++ b/net/netfilter/nf_conntrack_ftp.c | |||
@@ -51,12 +51,6 @@ unsigned int (*nf_nat_ftp_hook)(struct sk_buff **pskb, | |||
51 | struct nf_conntrack_expect *exp); | 51 | struct nf_conntrack_expect *exp); |
52 | EXPORT_SYMBOL_GPL(nf_nat_ftp_hook); | 52 | EXPORT_SYMBOL_GPL(nf_nat_ftp_hook); |
53 | 53 | ||
54 | #if 0 | ||
55 | #define DEBUGP printk | ||
56 | #else | ||
57 | #define DEBUGP(format, args...) | ||
58 | #endif | ||
59 | |||
60 | static int try_rfc959(const char *, size_t, struct nf_conntrack_man *, char); | 54 | static int try_rfc959(const char *, size_t, struct nf_conntrack_man *, char); |
61 | static int try_eprt(const char *, size_t, struct nf_conntrack_man *, char); | 55 | static int try_eprt(const char *, size_t, struct nf_conntrack_man *, char); |
62 | static int try_epsv_response(const char *, size_t, struct nf_conntrack_man *, | 56 | static int try_epsv_response(const char *, size_t, struct nf_conntrack_man *, |
@@ -138,13 +132,13 @@ static int try_number(const char *data, size_t dlen, u_int32_t array[], | |||
138 | if (*data == term && i == array_size - 1) | 132 | if (*data == term && i == array_size - 1) |
139 | return len; | 133 | return len; |
140 | 134 | ||
141 | DEBUGP("Char %u (got %u nums) `%u' unexpected\n", | 135 | pr_debug("Char %u (got %u nums) `%u' unexpected\n", |
142 | len, i, *data); | 136 | len, i, *data); |
143 | return 0; | 137 | return 0; |
144 | } | 138 | } |
145 | } | 139 | } |
146 | DEBUGP("Failed to fill %u numbers separated by %c\n", array_size, sep); | 140 | pr_debug("Failed to fill %u numbers separated by %c\n", |
147 | 141 | array_size, sep); | |
148 | return 0; | 142 | return 0; |
149 | } | 143 | } |
150 | 144 | ||
@@ -178,13 +172,13 @@ static int get_port(const char *data, int start, size_t dlen, char delim, | |||
178 | if (tmp_port == 0) | 172 | if (tmp_port == 0) |
179 | break; | 173 | break; |
180 | *port = htons(tmp_port); | 174 | *port = htons(tmp_port); |
181 | DEBUGP("get_port: return %d\n", tmp_port); | 175 | pr_debug("get_port: return %d\n", tmp_port); |
182 | return i + 1; | 176 | return i + 1; |
183 | } | 177 | } |
184 | else if (data[i] >= '0' && data[i] <= '9') | 178 | else if (data[i] >= '0' && data[i] <= '9') |
185 | tmp_port = tmp_port*10 + data[i] - '0'; | 179 | tmp_port = tmp_port*10 + data[i] - '0'; |
186 | else { /* Some other crap */ | 180 | else { /* Some other crap */ |
187 | DEBUGP("get_port: invalid char.\n"); | 181 | pr_debug("get_port: invalid char.\n"); |
188 | break; | 182 | break; |
189 | } | 183 | } |
190 | } | 184 | } |
@@ -201,22 +195,22 @@ static int try_eprt(const char *data, size_t dlen, struct nf_conntrack_man *cmd, | |||
201 | /* First character is delimiter, then "1" for IPv4 or "2" for IPv6, | 195 | /* First character is delimiter, then "1" for IPv4 or "2" for IPv6, |
202 | then delimiter again. */ | 196 | then delimiter again. */ |
203 | if (dlen <= 3) { | 197 | if (dlen <= 3) { |
204 | DEBUGP("EPRT: too short\n"); | 198 | pr_debug("EPRT: too short\n"); |
205 | return 0; | 199 | return 0; |
206 | } | 200 | } |
207 | delim = data[0]; | 201 | delim = data[0]; |
208 | if (isdigit(delim) || delim < 33 || delim > 126 || data[2] != delim) { | 202 | if (isdigit(delim) || delim < 33 || delim > 126 || data[2] != delim) { |
209 | DEBUGP("try_eprt: invalid delimitter.\n"); | 203 | pr_debug("try_eprt: invalid delimitter.\n"); |
210 | return 0; | 204 | return 0; |
211 | } | 205 | } |
212 | 206 | ||
213 | if ((cmd->l3num == PF_INET && data[1] != '1') || | 207 | if ((cmd->l3num == PF_INET && data[1] != '1') || |
214 | (cmd->l3num == PF_INET6 && data[1] != '2')) { | 208 | (cmd->l3num == PF_INET6 && data[1] != '2')) { |
215 | DEBUGP("EPRT: invalid protocol number.\n"); | 209 | pr_debug("EPRT: invalid protocol number.\n"); |
216 | return 0; | 210 | return 0; |
217 | } | 211 | } |
218 | 212 | ||
219 | DEBUGP("EPRT: Got %c%c%c\n", delim, data[1], delim); | 213 | pr_debug("EPRT: Got %c%c%c\n", delim, data[1], delim); |
220 | 214 | ||
221 | if (data[1] == '1') { | 215 | if (data[1] == '1') { |
222 | u_int32_t array[4]; | 216 | u_int32_t array[4]; |
@@ -234,7 +228,7 @@ static int try_eprt(const char *data, size_t dlen, struct nf_conntrack_man *cmd, | |||
234 | 228 | ||
235 | if (length == 0) | 229 | if (length == 0) |
236 | return 0; | 230 | return 0; |
237 | DEBUGP("EPRT: Got IP address!\n"); | 231 | pr_debug("EPRT: Got IP address!\n"); |
238 | /* Start offset includes initial "|1|", and trailing delimiter */ | 232 | /* Start offset includes initial "|1|", and trailing delimiter */ |
239 | return get_port(data, 3 + length + 1, dlen, delim, &cmd->u.tcp.port); | 233 | return get_port(data, 3 + length + 1, dlen, delim, &cmd->u.tcp.port); |
240 | } | 234 | } |
@@ -267,7 +261,7 @@ static int find_pattern(const char *data, size_t dlen, | |||
267 | { | 261 | { |
268 | size_t i; | 262 | size_t i; |
269 | 263 | ||
270 | DEBUGP("find_pattern `%s': dlen = %u\n", pattern, dlen); | 264 | pr_debug("find_pattern `%s': dlen = %Zu\n", pattern, dlen); |
271 | if (dlen == 0) | 265 | if (dlen == 0) |
272 | return 0; | 266 | return 0; |
273 | 267 | ||
@@ -282,17 +276,17 @@ static int find_pattern(const char *data, size_t dlen, | |||
282 | #if 0 | 276 | #if 0 |
283 | size_t i; | 277 | size_t i; |
284 | 278 | ||
285 | DEBUGP("ftp: string mismatch\n"); | 279 | pr_debug("ftp: string mismatch\n"); |
286 | for (i = 0; i < plen; i++) { | 280 | for (i = 0; i < plen; i++) { |
287 | DEBUGP("ftp:char %u `%c'(%u) vs `%c'(%u)\n", | 281 | pr_debug("ftp:char %u `%c'(%u) vs `%c'(%u)\n", |
288 | i, data[i], data[i], | 282 | i, data[i], data[i], |
289 | pattern[i], pattern[i]); | 283 | pattern[i], pattern[i]); |
290 | } | 284 | } |
291 | #endif | 285 | #endif |
292 | return 0; | 286 | return 0; |
293 | } | 287 | } |
294 | 288 | ||
295 | DEBUGP("Pattern matches!\n"); | 289 | pr_debug("Pattern matches!\n"); |
296 | /* Now we've found the constant string, try to skip | 290 | /* Now we've found the constant string, try to skip |
297 | to the 'skip' character */ | 291 | to the 'skip' character */ |
298 | for (i = plen; data[i] != skip; i++) | 292 | for (i = plen; data[i] != skip; i++) |
@@ -301,14 +295,14 @@ static int find_pattern(const char *data, size_t dlen, | |||
301 | /* Skip over the last character */ | 295 | /* Skip over the last character */ |
302 | i++; | 296 | i++; |
303 | 297 | ||
304 | DEBUGP("Skipped up to `%c'!\n", skip); | 298 | pr_debug("Skipped up to `%c'!\n", skip); |
305 | 299 | ||
306 | *numoff = i; | 300 | *numoff = i; |
307 | *numlen = getnum(data + i, dlen - i, cmd, term); | 301 | *numlen = getnum(data + i, dlen - i, cmd, term); |
308 | if (!*numlen) | 302 | if (!*numlen) |
309 | return -1; | 303 | return -1; |
310 | 304 | ||
311 | DEBUGP("Match succeeded!\n"); | 305 | pr_debug("Match succeeded!\n"); |
312 | return 1; | 306 | return 1; |
313 | } | 307 | } |
314 | 308 | ||
@@ -373,7 +367,7 @@ static int help(struct sk_buff **pskb, | |||
373 | /* Until there's been traffic both ways, don't look in packets. */ | 367 | /* Until there's been traffic both ways, don't look in packets. */ |
374 | if (ctinfo != IP_CT_ESTABLISHED | 368 | if (ctinfo != IP_CT_ESTABLISHED |
375 | && ctinfo != IP_CT_ESTABLISHED+IP_CT_IS_REPLY) { | 369 | && ctinfo != IP_CT_ESTABLISHED+IP_CT_IS_REPLY) { |
376 | DEBUGP("ftp: Conntrackinfo = %u\n", ctinfo); | 370 | pr_debug("ftp: Conntrackinfo = %u\n", ctinfo); |
377 | return NF_ACCEPT; | 371 | return NF_ACCEPT; |
378 | } | 372 | } |
379 | 373 | ||
@@ -384,8 +378,8 @@ static int help(struct sk_buff **pskb, | |||
384 | dataoff = protoff + th->doff * 4; | 378 | dataoff = protoff + th->doff * 4; |
385 | /* No data? */ | 379 | /* No data? */ |
386 | if (dataoff >= (*pskb)->len) { | 380 | if (dataoff >= (*pskb)->len) { |
387 | DEBUGP("ftp: dataoff(%u) >= skblen(%u)\n", dataoff, | 381 | pr_debug("ftp: dataoff(%u) >= skblen(%u)\n", dataoff, |
388 | (*pskb)->len); | 382 | (*pskb)->len); |
389 | return NF_ACCEPT; | 383 | return NF_ACCEPT; |
390 | } | 384 | } |
391 | datalen = (*pskb)->len - dataoff; | 385 | datalen = (*pskb)->len - dataoff; |
@@ -400,11 +394,11 @@ static int help(struct sk_buff **pskb, | |||
400 | /* Look up to see if we're just after a \n. */ | 394 | /* Look up to see if we're just after a \n. */ |
401 | if (!find_nl_seq(ntohl(th->seq), ct_ftp_info, dir)) { | 395 | if (!find_nl_seq(ntohl(th->seq), ct_ftp_info, dir)) { |
402 | /* Now if this ends in \n, update ftp info. */ | 396 | /* Now if this ends in \n, update ftp info. */ |
403 | DEBUGP("nf_conntrack_ftp_help: wrong seq pos %s(%u) or %s(%u)\n", | 397 | pr_debug("nf_conntrack_ftp: wrong seq pos %s(%u) or %s(%u)\n", |
404 | ct_ftp_info->seq_aft_nl_num[dir] > 0 ? "" : "(UNSET)", | 398 | ct_ftp_info->seq_aft_nl_num[dir] > 0 ? "" : "(UNSET)", |
405 | ct_ftp_info->seq_aft_nl[dir][0], | 399 | ct_ftp_info->seq_aft_nl[dir][0], |
406 | ct_ftp_info->seq_aft_nl_num[dir] > 1 ? "" : "(UNSET)", | 400 | ct_ftp_info->seq_aft_nl_num[dir] > 1 ? "" : "(UNSET)", |
407 | ct_ftp_info->seq_aft_nl[dir][1]); | 401 | ct_ftp_info->seq_aft_nl[dir][1]); |
408 | ret = NF_ACCEPT; | 402 | ret = NF_ACCEPT; |
409 | goto out_update_nl; | 403 | goto out_update_nl; |
410 | } | 404 | } |
@@ -442,9 +436,9 @@ static int help(struct sk_buff **pskb, | |||
442 | goto out_update_nl; | 436 | goto out_update_nl; |
443 | } | 437 | } |
444 | 438 | ||
445 | DEBUGP("conntrack_ftp: match `%.*s' (%u bytes at %u)\n", | 439 | pr_debug("conntrack_ftp: match `%.*s' (%u bytes at %u)\n", |
446 | (int)matchlen, fb_ptr + matchoff, | 440 | matchlen, fb_ptr + matchoff, |
447 | matchlen, ntohl(th->seq) + matchoff); | 441 | matchlen, ntohl(th->seq) + matchoff); |
448 | 442 | ||
449 | exp = nf_ct_expect_alloc(ct); | 443 | exp = nf_ct_expect_alloc(ct); |
450 | if (exp == NULL) { | 444 | if (exp == NULL) { |
@@ -466,14 +460,16 @@ static int help(struct sk_buff **pskb, | |||
466 | different IP address. Simply don't record it for | 460 | different IP address. Simply don't record it for |
467 | NAT. */ | 461 | NAT. */ |
468 | if (cmd.l3num == PF_INET) { | 462 | if (cmd.l3num == PF_INET) { |
469 | DEBUGP("conntrack_ftp: NOT RECORDING: " NIPQUAD_FMT " != " NIPQUAD_FMT "\n", | 463 | pr_debug("conntrack_ftp: NOT RECORDING: " NIPQUAD_FMT |
470 | NIPQUAD(cmd.u3.ip), | 464 | " != " NIPQUAD_FMT "\n", |
471 | NIPQUAD(ct->tuplehash[dir].tuple.src.u3.ip)); | 465 | NIPQUAD(cmd.u3.ip), |
466 | NIPQUAD(ct->tuplehash[dir].tuple.src.u3.ip)); | ||
472 | } else { | 467 | } else { |
473 | DEBUGP("conntrack_ftp: NOT RECORDING: " NIP6_FMT " != " NIP6_FMT "\n", | 468 | pr_debug("conntrack_ftp: NOT RECORDING: " NIP6_FMT |
474 | NIP6(*((struct in6_addr *)cmd.u3.ip6)), | 469 | " != " NIP6_FMT "\n", |
475 | NIP6(*((struct in6_addr *)ct->tuplehash[dir] | 470 | NIP6(*((struct in6_addr *)cmd.u3.ip6)), |
476 | .tuple.src.u3.ip6))); | 471 | NIP6(*((struct in6_addr *) |
472 | ct->tuplehash[dir].tuple.src.u3.ip6))); | ||
477 | } | 473 | } |
478 | 474 | ||
479 | /* Thanks to Cristiano Lincoln Mattos | 475 | /* Thanks to Cristiano Lincoln Mattos |
@@ -530,9 +526,9 @@ static void nf_conntrack_ftp_fini(void) | |||
530 | if (ftp[i][j].me == NULL) | 526 | if (ftp[i][j].me == NULL) |
531 | continue; | 527 | continue; |
532 | 528 | ||
533 | DEBUGP("nf_ct_ftp: unregistering helper for pf: %d " | 529 | pr_debug("nf_ct_ftp: unregistering helper for pf: %d " |
534 | "port: %d\n", | 530 | "port: %d\n", |
535 | ftp[i][j].tuple.src.l3num, ports[i]); | 531 | ftp[i][j].tuple.src.l3num, ports[i]); |
536 | nf_conntrack_helper_unregister(&ftp[i][j]); | 532 | nf_conntrack_helper_unregister(&ftp[i][j]); |
537 | } | 533 | } |
538 | } | 534 | } |
@@ -571,9 +567,9 @@ static int __init nf_conntrack_ftp_init(void) | |||
571 | sprintf(tmpname, "ftp-%d", ports[i]); | 567 | sprintf(tmpname, "ftp-%d", ports[i]); |
572 | ftp[i][j].name = tmpname; | 568 | ftp[i][j].name = tmpname; |
573 | 569 | ||
574 | DEBUGP("nf_ct_ftp: registering helper for pf: %d " | 570 | pr_debug("nf_ct_ftp: registering helper for pf: %d " |
575 | "port: %d\n", | 571 | "port: %d\n", |
576 | ftp[i][j].tuple.src.l3num, ports[i]); | 572 | ftp[i][j].tuple.src.l3num, ports[i]); |
577 | ret = nf_conntrack_helper_register(&ftp[i][j]); | 573 | ret = nf_conntrack_helper_register(&ftp[i][j]); |
578 | if (ret) { | 574 | if (ret) { |
579 | printk("nf_ct_ftp: failed to register helper " | 575 | printk("nf_ct_ftp: failed to register helper " |
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c index aa5ba99b7a08..a8a9dfbe7a67 100644 --- a/net/netfilter/nf_conntrack_h323_main.c +++ b/net/netfilter/nf_conntrack_h323_main.c | |||
@@ -31,12 +31,6 @@ | |||
31 | #include <net/netfilter/nf_conntrack_helper.h> | 31 | #include <net/netfilter/nf_conntrack_helper.h> |
32 | #include <linux/netfilter/nf_conntrack_h323.h> | 32 | #include <linux/netfilter/nf_conntrack_h323.h> |
33 | 33 | ||
34 | #if 0 | ||
35 | #define DEBUGP printk | ||
36 | #else | ||
37 | #define DEBUGP(format, args...) | ||
38 | #endif | ||
39 | |||
40 | /* Parameters */ | 34 | /* Parameters */ |
41 | static unsigned int default_rrq_ttl __read_mostly = 300; | 35 | static unsigned int default_rrq_ttl __read_mostly = 300; |
42 | module_param(default_rrq_ttl, uint, 0600); | 36 | module_param(default_rrq_ttl, uint, 0600); |
@@ -150,9 +144,9 @@ static int get_tpkt_data(struct sk_buff **pskb, unsigned int protoff, | |||
150 | if (tcpdatalen < 4 || tpkt[0] != 0x03 || tpkt[1] != 0) { | 144 | if (tcpdatalen < 4 || tpkt[0] != 0x03 || tpkt[1] != 0) { |
151 | /* Netmeeting sends TPKT header and data separately */ | 145 | /* Netmeeting sends TPKT header and data separately */ |
152 | if (info->tpkt_len[dir] > 0) { | 146 | if (info->tpkt_len[dir] > 0) { |
153 | DEBUGP("nf_ct_h323: previous packet " | 147 | pr_debug("nf_ct_h323: previous packet " |
154 | "indicated separate TPKT data of %hu " | 148 | "indicated separate TPKT data of %hu " |
155 | "bytes\n", info->tpkt_len[dir]); | 149 | "bytes\n", info->tpkt_len[dir]); |
156 | if (info->tpkt_len[dir] <= tcpdatalen) { | 150 | if (info->tpkt_len[dir] <= tcpdatalen) { |
157 | /* Yes, there was a TPKT header | 151 | /* Yes, there was a TPKT header |
158 | * received */ | 152 | * received */ |
@@ -163,7 +157,7 @@ static int get_tpkt_data(struct sk_buff **pskb, unsigned int protoff, | |||
163 | } | 157 | } |
164 | 158 | ||
165 | /* Fragmented TPKT */ | 159 | /* Fragmented TPKT */ |
166 | DEBUGP("nf_ct_h323: fragmented TPKT\n"); | 160 | pr_debug("nf_ct_h323: fragmented TPKT\n"); |
167 | goto clear_out; | 161 | goto clear_out; |
168 | } | 162 | } |
169 | 163 | ||
@@ -190,9 +184,9 @@ static int get_tpkt_data(struct sk_buff **pskb, unsigned int protoff, | |||
190 | if (tpktlen > tcpdatalen) { | 184 | if (tpktlen > tcpdatalen) { |
191 | if (tcpdatalen == 4) { /* Separate TPKT header */ | 185 | if (tcpdatalen == 4) { /* Separate TPKT header */ |
192 | /* Netmeeting sends TPKT header and data separately */ | 186 | /* Netmeeting sends TPKT header and data separately */ |
193 | DEBUGP("nf_ct_h323: separate TPKT header indicates " | 187 | pr_debug("nf_ct_h323: separate TPKT header indicates " |
194 | "there will be TPKT data of %hu bytes\n", | 188 | "there will be TPKT data of %hu bytes\n", |
195 | tpktlen - 4); | 189 | tpktlen - 4); |
196 | info->tpkt_len[dir] = tpktlen - 4; | 190 | info->tpkt_len[dir] = tpktlen - 4; |
197 | return 0; | 191 | return 0; |
198 | } | 192 | } |
@@ -308,9 +302,9 @@ static int expect_rtp_rtcp(struct sk_buff **pskb, struct nf_conn *ct, | |||
308 | } else { /* Conntrack only */ | 302 | } else { /* Conntrack only */ |
309 | if (nf_ct_expect_related(rtp_exp) == 0) { | 303 | if (nf_ct_expect_related(rtp_exp) == 0) { |
310 | if (nf_ct_expect_related(rtcp_exp) == 0) { | 304 | if (nf_ct_expect_related(rtcp_exp) == 0) { |
311 | DEBUGP("nf_ct_h323: expect RTP "); | 305 | pr_debug("nf_ct_h323: expect RTP "); |
312 | NF_CT_DUMP_TUPLE(&rtp_exp->tuple); | 306 | NF_CT_DUMP_TUPLE(&rtp_exp->tuple); |
313 | DEBUGP("nf_ct_h323: expect RTCP "); | 307 | pr_debug("nf_ct_h323: expect RTCP "); |
314 | NF_CT_DUMP_TUPLE(&rtcp_exp->tuple); | 308 | NF_CT_DUMP_TUPLE(&rtcp_exp->tuple); |
315 | } else { | 309 | } else { |
316 | nf_ct_unexpect_related(rtp_exp); | 310 | nf_ct_unexpect_related(rtp_exp); |
@@ -365,7 +359,7 @@ static int expect_t120(struct sk_buff **pskb, | |||
365 | port, exp); | 359 | port, exp); |
366 | } else { /* Conntrack only */ | 360 | } else { /* Conntrack only */ |
367 | if (nf_ct_expect_related(exp) == 0) { | 361 | if (nf_ct_expect_related(exp) == 0) { |
368 | DEBUGP("nf_ct_h323: expect T.120 "); | 362 | pr_debug("nf_ct_h323: expect T.120 "); |
369 | NF_CT_DUMP_TUPLE(&exp->tuple); | 363 | NF_CT_DUMP_TUPLE(&exp->tuple); |
370 | } else | 364 | } else |
371 | ret = -1; | 365 | ret = -1; |
@@ -413,7 +407,7 @@ static int process_olc(struct sk_buff **pskb, struct nf_conn *ct, | |||
413 | { | 407 | { |
414 | int ret; | 408 | int ret; |
415 | 409 | ||
416 | DEBUGP("nf_ct_h323: OpenLogicalChannel\n"); | 410 | pr_debug("nf_ct_h323: OpenLogicalChannel\n"); |
417 | 411 | ||
418 | if (olc->forwardLogicalChannelParameters.multiplexParameters.choice == | 412 | if (olc->forwardLogicalChannelParameters.multiplexParameters.choice == |
419 | eOpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters) | 413 | eOpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters) |
@@ -473,7 +467,7 @@ static int process_olca(struct sk_buff **pskb, struct nf_conn *ct, | |||
473 | H2250LogicalChannelAckParameters *ack; | 467 | H2250LogicalChannelAckParameters *ack; |
474 | int ret; | 468 | int ret; |
475 | 469 | ||
476 | DEBUGP("nf_ct_h323: OpenLogicalChannelAck\n"); | 470 | pr_debug("nf_ct_h323: OpenLogicalChannelAck\n"); |
477 | 471 | ||
478 | if ((olca->options & | 472 | if ((olca->options & |
479 | eOpenLogicalChannelAck_reverseLogicalChannelParameters) && | 473 | eOpenLogicalChannelAck_reverseLogicalChannelParameters) && |
@@ -544,8 +538,8 @@ static int process_h245(struct sk_buff **pskb, struct nf_conn *ct, | |||
544 | return process_olc(pskb, ct, ctinfo, data, dataoff, | 538 | return process_olc(pskb, ct, ctinfo, data, dataoff, |
545 | &mscm->request.openLogicalChannel); | 539 | &mscm->request.openLogicalChannel); |
546 | } | 540 | } |
547 | DEBUGP("nf_ct_h323: H.245 Request %d\n", | 541 | pr_debug("nf_ct_h323: H.245 Request %d\n", |
548 | mscm->request.choice); | 542 | mscm->request.choice); |
549 | break; | 543 | break; |
550 | case eMultimediaSystemControlMessage_response: | 544 | case eMultimediaSystemControlMessage_response: |
551 | if (mscm->response.choice == | 545 | if (mscm->response.choice == |
@@ -554,11 +548,11 @@ static int process_h245(struct sk_buff **pskb, struct nf_conn *ct, | |||
554 | &mscm->response. | 548 | &mscm->response. |
555 | openLogicalChannelAck); | 549 | openLogicalChannelAck); |
556 | } | 550 | } |
557 | DEBUGP("nf_ct_h323: H.245 Response %d\n", | 551 | pr_debug("nf_ct_h323: H.245 Response %d\n", |
558 | mscm->response.choice); | 552 | mscm->response.choice); |
559 | break; | 553 | break; |
560 | default: | 554 | default: |
561 | DEBUGP("nf_ct_h323: H.245 signal %d\n", mscm->choice); | 555 | pr_debug("nf_ct_h323: H.245 signal %d\n", mscm->choice); |
562 | break; | 556 | break; |
563 | } | 557 | } |
564 | 558 | ||
@@ -580,23 +574,23 @@ static int h245_help(struct sk_buff **pskb, unsigned int protoff, | |||
580 | ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) { | 574 | ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) { |
581 | return NF_ACCEPT; | 575 | return NF_ACCEPT; |
582 | } | 576 | } |
583 | DEBUGP("nf_ct_h245: skblen = %u\n", (*pskb)->len); | 577 | pr_debug("nf_ct_h245: skblen = %u\n", (*pskb)->len); |
584 | 578 | ||
585 | spin_lock_bh(&nf_h323_lock); | 579 | spin_lock_bh(&nf_h323_lock); |
586 | 580 | ||
587 | /* Process each TPKT */ | 581 | /* Process each TPKT */ |
588 | while (get_tpkt_data(pskb, protoff, ct, ctinfo, | 582 | while (get_tpkt_data(pskb, protoff, ct, ctinfo, |
589 | &data, &datalen, &dataoff)) { | 583 | &data, &datalen, &dataoff)) { |
590 | DEBUGP("nf_ct_h245: TPKT len=%d ", datalen); | 584 | pr_debug("nf_ct_h245: TPKT len=%d ", datalen); |
591 | NF_CT_DUMP_TUPLE(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple); | 585 | NF_CT_DUMP_TUPLE(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple); |
592 | 586 | ||
593 | /* Decode H.245 signal */ | 587 | /* Decode H.245 signal */ |
594 | ret = DecodeMultimediaSystemControlMessage(data, datalen, | 588 | ret = DecodeMultimediaSystemControlMessage(data, datalen, |
595 | &mscm); | 589 | &mscm); |
596 | if (ret < 0) { | 590 | if (ret < 0) { |
597 | DEBUGP("nf_ct_h245: decoding error: %s\n", | 591 | pr_debug("nf_ct_h245: decoding error: %s\n", |
598 | ret == H323_ERROR_BOUND ? | 592 | ret == H323_ERROR_BOUND ? |
599 | "out of bound" : "out of range"); | 593 | "out of bound" : "out of range"); |
600 | /* We don't drop when decoding error */ | 594 | /* We don't drop when decoding error */ |
601 | break; | 595 | break; |
602 | } | 596 | } |
@@ -697,7 +691,7 @@ static int expect_h245(struct sk_buff **pskb, struct nf_conn *ct, | |||
697 | port, exp); | 691 | port, exp); |
698 | } else { /* Conntrack only */ | 692 | } else { /* Conntrack only */ |
699 | if (nf_ct_expect_related(exp) == 0) { | 693 | if (nf_ct_expect_related(exp) == 0) { |
700 | DEBUGP("nf_ct_q931: expect H.245 "); | 694 | pr_debug("nf_ct_q931: expect H.245 "); |
701 | NF_CT_DUMP_TUPLE(&exp->tuple); | 695 | NF_CT_DUMP_TUPLE(&exp->tuple); |
702 | } else | 696 | } else |
703 | ret = -1; | 697 | ret = -1; |
@@ -786,7 +780,7 @@ static int expect_callforwarding(struct sk_buff **pskb, | |||
786 | if (callforward_filter && | 780 | if (callforward_filter && |
787 | callforward_do_filter(&addr, &ct->tuplehash[!dir].tuple.src.u3, | 781 | callforward_do_filter(&addr, &ct->tuplehash[!dir].tuple.src.u3, |
788 | ct->tuplehash[!dir].tuple.src.l3num)) { | 782 | ct->tuplehash[!dir].tuple.src.l3num)) { |
789 | DEBUGP("nf_ct_q931: Call Forwarding not tracked\n"); | 783 | pr_debug("nf_ct_q931: Call Forwarding not tracked\n"); |
790 | return 0; | 784 | return 0; |
791 | } | 785 | } |
792 | 786 | ||
@@ -808,7 +802,7 @@ static int expect_callforwarding(struct sk_buff **pskb, | |||
808 | taddr, port, exp); | 802 | taddr, port, exp); |
809 | } else { /* Conntrack only */ | 803 | } else { /* Conntrack only */ |
810 | if (nf_ct_expect_related(exp) == 0) { | 804 | if (nf_ct_expect_related(exp) == 0) { |
811 | DEBUGP("nf_ct_q931: expect Call Forwarding "); | 805 | pr_debug("nf_ct_q931: expect Call Forwarding "); |
812 | NF_CT_DUMP_TUPLE(&exp->tuple); | 806 | NF_CT_DUMP_TUPLE(&exp->tuple); |
813 | } else | 807 | } else |
814 | ret = -1; | 808 | ret = -1; |
@@ -832,7 +826,7 @@ static int process_setup(struct sk_buff **pskb, struct nf_conn *ct, | |||
832 | union nf_conntrack_address addr; | 826 | union nf_conntrack_address addr; |
833 | typeof(set_h225_addr_hook) set_h225_addr; | 827 | typeof(set_h225_addr_hook) set_h225_addr; |
834 | 828 | ||
835 | DEBUGP("nf_ct_q931: Setup\n"); | 829 | pr_debug("nf_ct_q931: Setup\n"); |
836 | 830 | ||
837 | if (setup->options & eSetup_UUIE_h245Address) { | 831 | if (setup->options & eSetup_UUIE_h245Address) { |
838 | ret = expect_h245(pskb, ct, ctinfo, data, dataoff, | 832 | ret = expect_h245(pskb, ct, ctinfo, data, dataoff, |
@@ -847,11 +841,11 @@ static int process_setup(struct sk_buff **pskb, struct nf_conn *ct, | |||
847 | get_h225_addr(ct, *data, &setup->destCallSignalAddress, | 841 | get_h225_addr(ct, *data, &setup->destCallSignalAddress, |
848 | &addr, &port) && | 842 | &addr, &port) && |
849 | memcmp(&addr, &ct->tuplehash[!dir].tuple.src.u3, sizeof(addr))) { | 843 | memcmp(&addr, &ct->tuplehash[!dir].tuple.src.u3, sizeof(addr))) { |
850 | DEBUGP("nf_ct_q931: set destCallSignalAddress " | 844 | pr_debug("nf_ct_q931: set destCallSignalAddress " |
851 | NIP6_FMT ":%hu->" NIP6_FMT ":%hu\n", | 845 | NIP6_FMT ":%hu->" NIP6_FMT ":%hu\n", |
852 | NIP6(*(struct in6_addr *)&addr), ntohs(port), | 846 | NIP6(*(struct in6_addr *)&addr), ntohs(port), |
853 | NIP6(*(struct in6_addr *)&ct->tuplehash[!dir].tuple.src.u3), | 847 | NIP6(*(struct in6_addr *)&ct->tuplehash[!dir].tuple.src.u3), |
854 | ntohs(ct->tuplehash[!dir].tuple.src.u.tcp.port)); | 848 | ntohs(ct->tuplehash[!dir].tuple.src.u.tcp.port)); |
855 | ret = set_h225_addr(pskb, data, dataoff, | 849 | ret = set_h225_addr(pskb, data, dataoff, |
856 | &setup->destCallSignalAddress, | 850 | &setup->destCallSignalAddress, |
857 | &ct->tuplehash[!dir].tuple.src.u3, | 851 | &ct->tuplehash[!dir].tuple.src.u3, |
@@ -865,11 +859,11 @@ static int process_setup(struct sk_buff **pskb, struct nf_conn *ct, | |||
865 | get_h225_addr(ct, *data, &setup->sourceCallSignalAddress, | 859 | get_h225_addr(ct, *data, &setup->sourceCallSignalAddress, |
866 | &addr, &port) && | 860 | &addr, &port) && |
867 | memcmp(&addr, &ct->tuplehash[!dir].tuple.dst.u3, sizeof(addr))) { | 861 | memcmp(&addr, &ct->tuplehash[!dir].tuple.dst.u3, sizeof(addr))) { |
868 | DEBUGP("nf_ct_q931: set sourceCallSignalAddress " | 862 | pr_debug("nf_ct_q931: set sourceCallSignalAddress " |
869 | NIP6_FMT ":%hu->" NIP6_FMT ":%hu\n", | 863 | NIP6_FMT ":%hu->" NIP6_FMT ":%hu\n", |
870 | NIP6(*(struct in6_addr *)&addr), ntohs(port), | 864 | NIP6(*(struct in6_addr *)&addr), ntohs(port), |
871 | NIP6(*(struct in6_addr *)&ct->tuplehash[!dir].tuple.dst.u3), | 865 | NIP6(*(struct in6_addr *)&ct->tuplehash[!dir].tuple.dst.u3), |
872 | ntohs(ct->tuplehash[!dir].tuple.dst.u.tcp.port)); | 866 | ntohs(ct->tuplehash[!dir].tuple.dst.u.tcp.port)); |
873 | ret = set_h225_addr(pskb, data, dataoff, | 867 | ret = set_h225_addr(pskb, data, dataoff, |
874 | &setup->sourceCallSignalAddress, | 868 | &setup->sourceCallSignalAddress, |
875 | &ct->tuplehash[!dir].tuple.dst.u3, | 869 | &ct->tuplehash[!dir].tuple.dst.u3, |
@@ -900,7 +894,7 @@ static int process_callproceeding(struct sk_buff **pskb, | |||
900 | int ret; | 894 | int ret; |
901 | int i; | 895 | int i; |
902 | 896 | ||
903 | DEBUGP("nf_ct_q931: CallProceeding\n"); | 897 | pr_debug("nf_ct_q931: CallProceeding\n"); |
904 | 898 | ||
905 | if (callproc->options & eCallProceeding_UUIE_h245Address) { | 899 | if (callproc->options & eCallProceeding_UUIE_h245Address) { |
906 | ret = expect_h245(pskb, ct, ctinfo, data, dataoff, | 900 | ret = expect_h245(pskb, ct, ctinfo, data, dataoff, |
@@ -930,7 +924,7 @@ static int process_connect(struct sk_buff **pskb, struct nf_conn *ct, | |||
930 | int ret; | 924 | int ret; |
931 | int i; | 925 | int i; |
932 | 926 | ||
933 | DEBUGP("nf_ct_q931: Connect\n"); | 927 | pr_debug("nf_ct_q931: Connect\n"); |
934 | 928 | ||
935 | if (connect->options & eConnect_UUIE_h245Address) { | 929 | if (connect->options & eConnect_UUIE_h245Address) { |
936 | ret = expect_h245(pskb, ct, ctinfo, data, dataoff, | 930 | ret = expect_h245(pskb, ct, ctinfo, data, dataoff, |
@@ -960,7 +954,7 @@ static int process_alerting(struct sk_buff **pskb, struct nf_conn *ct, | |||
960 | int ret; | 954 | int ret; |
961 | int i; | 955 | int i; |
962 | 956 | ||
963 | DEBUGP("nf_ct_q931: Alerting\n"); | 957 | pr_debug("nf_ct_q931: Alerting\n"); |
964 | 958 | ||
965 | if (alert->options & eAlerting_UUIE_h245Address) { | 959 | if (alert->options & eAlerting_UUIE_h245Address) { |
966 | ret = expect_h245(pskb, ct, ctinfo, data, dataoff, | 960 | ret = expect_h245(pskb, ct, ctinfo, data, dataoff, |
@@ -990,7 +984,7 @@ static int process_facility(struct sk_buff **pskb, struct nf_conn *ct, | |||
990 | int ret; | 984 | int ret; |
991 | int i; | 985 | int i; |
992 | 986 | ||
993 | DEBUGP("nf_ct_q931: Facility\n"); | 987 | pr_debug("nf_ct_q931: Facility\n"); |
994 | 988 | ||
995 | if (facility->reason.choice == eFacilityReason_callForwarded) { | 989 | if (facility->reason.choice == eFacilityReason_callForwarded) { |
996 | if (facility->options & eFacility_UUIE_alternativeAddress) | 990 | if (facility->options & eFacility_UUIE_alternativeAddress) |
@@ -1029,7 +1023,7 @@ static int process_progress(struct sk_buff **pskb, struct nf_conn *ct, | |||
1029 | int ret; | 1023 | int ret; |
1030 | int i; | 1024 | int i; |
1031 | 1025 | ||
1032 | DEBUGP("nf_ct_q931: Progress\n"); | 1026 | pr_debug("nf_ct_q931: Progress\n"); |
1033 | 1027 | ||
1034 | if (progress->options & eProgress_UUIE_h245Address) { | 1028 | if (progress->options & eProgress_UUIE_h245Address) { |
1035 | ret = expect_h245(pskb, ct, ctinfo, data, dataoff, | 1029 | ret = expect_h245(pskb, ct, ctinfo, data, dataoff, |
@@ -1086,8 +1080,8 @@ static int process_q931(struct sk_buff **pskb, struct nf_conn *ct, | |||
1086 | &pdu->h323_message_body.progress); | 1080 | &pdu->h323_message_body.progress); |
1087 | break; | 1081 | break; |
1088 | default: | 1082 | default: |
1089 | DEBUGP("nf_ct_q931: Q.931 signal %d\n", | 1083 | pr_debug("nf_ct_q931: Q.931 signal %d\n", |
1090 | pdu->h323_message_body.choice); | 1084 | pdu->h323_message_body.choice); |
1091 | break; | 1085 | break; |
1092 | } | 1086 | } |
1093 | 1087 | ||
@@ -1121,22 +1115,22 @@ static int q931_help(struct sk_buff **pskb, unsigned int protoff, | |||
1121 | ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) { | 1115 | ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) { |
1122 | return NF_ACCEPT; | 1116 | return NF_ACCEPT; |
1123 | } | 1117 | } |
1124 | DEBUGP("nf_ct_q931: skblen = %u\n", (*pskb)->len); | 1118 | pr_debug("nf_ct_q931: skblen = %u\n", (*pskb)->len); |
1125 | 1119 | ||
1126 | spin_lock_bh(&nf_h323_lock); | 1120 | spin_lock_bh(&nf_h323_lock); |
1127 | 1121 | ||
1128 | /* Process each TPKT */ | 1122 | /* Process each TPKT */ |
1129 | while (get_tpkt_data(pskb, protoff, ct, ctinfo, | 1123 | while (get_tpkt_data(pskb, protoff, ct, ctinfo, |
1130 | &data, &datalen, &dataoff)) { | 1124 | &data, &datalen, &dataoff)) { |
1131 | DEBUGP("nf_ct_q931: TPKT len=%d ", datalen); | 1125 | pr_debug("nf_ct_q931: TPKT len=%d ", datalen); |
1132 | NF_CT_DUMP_TUPLE(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple); | 1126 | NF_CT_DUMP_TUPLE(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple); |
1133 | 1127 | ||
1134 | /* Decode Q.931 signal */ | 1128 | /* Decode Q.931 signal */ |
1135 | ret = DecodeQ931(data, datalen, &q931); | 1129 | ret = DecodeQ931(data, datalen, &q931); |
1136 | if (ret < 0) { | 1130 | if (ret < 0) { |
1137 | DEBUGP("nf_ct_q931: decoding error: %s\n", | 1131 | pr_debug("nf_ct_q931: decoding error: %s\n", |
1138 | ret == H323_ERROR_BOUND ? | 1132 | ret == H323_ERROR_BOUND ? |
1139 | "out of bound" : "out of range"); | 1133 | "out of bound" : "out of range"); |
1140 | /* We don't drop when decoding error */ | 1134 | /* We don't drop when decoding error */ |
1141 | break; | 1135 | break; |
1142 | } | 1136 | } |
@@ -1274,7 +1268,7 @@ static int expect_q931(struct sk_buff **pskb, struct nf_conn *ct, | |||
1274 | ret = nat_q931(pskb, ct, ctinfo, data, taddr, i, port, exp); | 1268 | ret = nat_q931(pskb, ct, ctinfo, data, taddr, i, port, exp); |
1275 | } else { /* Conntrack only */ | 1269 | } else { /* Conntrack only */ |
1276 | if (nf_ct_expect_related(exp) == 0) { | 1270 | if (nf_ct_expect_related(exp) == 0) { |
1277 | DEBUGP("nf_ct_ras: expect Q.931 "); | 1271 | pr_debug("nf_ct_ras: expect Q.931 "); |
1278 | NF_CT_DUMP_TUPLE(&exp->tuple); | 1272 | NF_CT_DUMP_TUPLE(&exp->tuple); |
1279 | 1273 | ||
1280 | /* Save port for looking up expect in processing RCF */ | 1274 | /* Save port for looking up expect in processing RCF */ |
@@ -1295,7 +1289,7 @@ static int process_grq(struct sk_buff **pskb, struct nf_conn *ct, | |||
1295 | { | 1289 | { |
1296 | typeof(set_ras_addr_hook) set_ras_addr; | 1290 | typeof(set_ras_addr_hook) set_ras_addr; |
1297 | 1291 | ||
1298 | DEBUGP("nf_ct_ras: GRQ\n"); | 1292 | pr_debug("nf_ct_ras: GRQ\n"); |
1299 | 1293 | ||
1300 | set_ras_addr = rcu_dereference(set_ras_addr_hook); | 1294 | set_ras_addr = rcu_dereference(set_ras_addr_hook); |
1301 | if (set_ras_addr && ct->status & IPS_NAT_MASK) /* NATed */ | 1295 | if (set_ras_addr && ct->status & IPS_NAT_MASK) /* NATed */ |
@@ -1315,7 +1309,7 @@ static int process_gcf(struct sk_buff **pskb, struct nf_conn *ct, | |||
1315 | union nf_conntrack_address addr; | 1309 | union nf_conntrack_address addr; |
1316 | struct nf_conntrack_expect *exp; | 1310 | struct nf_conntrack_expect *exp; |
1317 | 1311 | ||
1318 | DEBUGP("nf_ct_ras: GCF\n"); | 1312 | pr_debug("nf_ct_ras: GCF\n"); |
1319 | 1313 | ||
1320 | if (!get_h225_addr(ct, *data, &gcf->rasAddress, &addr, &port)) | 1314 | if (!get_h225_addr(ct, *data, &gcf->rasAddress, &addr, &port)) |
1321 | return 0; | 1315 | return 0; |
@@ -1338,7 +1332,7 @@ static int process_gcf(struct sk_buff **pskb, struct nf_conn *ct, | |||
1338 | exp->helper = nf_conntrack_helper_ras; | 1332 | exp->helper = nf_conntrack_helper_ras; |
1339 | 1333 | ||
1340 | if (nf_ct_expect_related(exp) == 0) { | 1334 | if (nf_ct_expect_related(exp) == 0) { |
1341 | DEBUGP("nf_ct_ras: expect RAS "); | 1335 | pr_debug("nf_ct_ras: expect RAS "); |
1342 | NF_CT_DUMP_TUPLE(&exp->tuple); | 1336 | NF_CT_DUMP_TUPLE(&exp->tuple); |
1343 | } else | 1337 | } else |
1344 | ret = -1; | 1338 | ret = -1; |
@@ -1357,7 +1351,7 @@ static int process_rrq(struct sk_buff **pskb, struct nf_conn *ct, | |||
1357 | int ret; | 1351 | int ret; |
1358 | typeof(set_ras_addr_hook) set_ras_addr; | 1352 | typeof(set_ras_addr_hook) set_ras_addr; |
1359 | 1353 | ||
1360 | DEBUGP("nf_ct_ras: RRQ\n"); | 1354 | pr_debug("nf_ct_ras: RRQ\n"); |
1361 | 1355 | ||
1362 | ret = expect_q931(pskb, ct, ctinfo, data, | 1356 | ret = expect_q931(pskb, ct, ctinfo, data, |
1363 | rrq->callSignalAddress.item, | 1357 | rrq->callSignalAddress.item, |
@@ -1375,7 +1369,7 @@ static int process_rrq(struct sk_buff **pskb, struct nf_conn *ct, | |||
1375 | } | 1369 | } |
1376 | 1370 | ||
1377 | if (rrq->options & eRegistrationRequest_timeToLive) { | 1371 | if (rrq->options & eRegistrationRequest_timeToLive) { |
1378 | DEBUGP("nf_ct_ras: RRQ TTL = %u seconds\n", rrq->timeToLive); | 1372 | pr_debug("nf_ct_ras: RRQ TTL = %u seconds\n", rrq->timeToLive); |
1379 | info->timeout = rrq->timeToLive; | 1373 | info->timeout = rrq->timeToLive; |
1380 | } else | 1374 | } else |
1381 | info->timeout = default_rrq_ttl; | 1375 | info->timeout = default_rrq_ttl; |
@@ -1394,7 +1388,7 @@ static int process_rcf(struct sk_buff **pskb, struct nf_conn *ct, | |||
1394 | struct nf_conntrack_expect *exp; | 1388 | struct nf_conntrack_expect *exp; |
1395 | typeof(set_sig_addr_hook) set_sig_addr; | 1389 | typeof(set_sig_addr_hook) set_sig_addr; |
1396 | 1390 | ||
1397 | DEBUGP("nf_ct_ras: RCF\n"); | 1391 | pr_debug("nf_ct_ras: RCF\n"); |
1398 | 1392 | ||
1399 | set_sig_addr = rcu_dereference(set_sig_addr_hook); | 1393 | set_sig_addr = rcu_dereference(set_sig_addr_hook); |
1400 | if (set_sig_addr && ct->status & IPS_NAT_MASK) { | 1394 | if (set_sig_addr && ct->status & IPS_NAT_MASK) { |
@@ -1406,14 +1400,13 @@ static int process_rcf(struct sk_buff **pskb, struct nf_conn *ct, | |||
1406 | } | 1400 | } |
1407 | 1401 | ||
1408 | if (rcf->options & eRegistrationConfirm_timeToLive) { | 1402 | if (rcf->options & eRegistrationConfirm_timeToLive) { |
1409 | DEBUGP("nf_ct_ras: RCF TTL = %u seconds\n", rcf->timeToLive); | 1403 | pr_debug("nf_ct_ras: RCF TTL = %u seconds\n", rcf->timeToLive); |
1410 | info->timeout = rcf->timeToLive; | 1404 | info->timeout = rcf->timeToLive; |
1411 | } | 1405 | } |
1412 | 1406 | ||
1413 | if (info->timeout > 0) { | 1407 | if (info->timeout > 0) { |
1414 | DEBUGP | 1408 | pr_debug("nf_ct_ras: set RAS connection timeout to " |
1415 | ("nf_ct_ras: set RAS connection timeout to %u seconds\n", | 1409 | "%u seconds\n", info->timeout); |
1416 | info->timeout); | ||
1417 | nf_ct_refresh(ct, *pskb, info->timeout * HZ); | 1410 | nf_ct_refresh(ct, *pskb, info->timeout * HZ); |
1418 | 1411 | ||
1419 | /* Set expect timeout */ | 1412 | /* Set expect timeout */ |
@@ -1421,9 +1414,9 @@ static int process_rcf(struct sk_buff **pskb, struct nf_conn *ct, | |||
1421 | exp = find_expect(ct, &ct->tuplehash[dir].tuple.dst.u3, | 1414 | exp = find_expect(ct, &ct->tuplehash[dir].tuple.dst.u3, |
1422 | info->sig_port[!dir]); | 1415 | info->sig_port[!dir]); |
1423 | if (exp) { | 1416 | if (exp) { |
1424 | DEBUGP("nf_ct_ras: set Q.931 expect " | 1417 | pr_debug("nf_ct_ras: set Q.931 expect " |
1425 | "timeout to %u seconds for", | 1418 | "timeout to %u seconds for", |
1426 | info->timeout); | 1419 | info->timeout); |
1427 | NF_CT_DUMP_TUPLE(&exp->tuple); | 1420 | NF_CT_DUMP_TUPLE(&exp->tuple); |
1428 | set_expect_timeout(exp, info->timeout); | 1421 | set_expect_timeout(exp, info->timeout); |
1429 | } | 1422 | } |
@@ -1443,7 +1436,7 @@ static int process_urq(struct sk_buff **pskb, struct nf_conn *ct, | |||
1443 | int ret; | 1436 | int ret; |
1444 | typeof(set_sig_addr_hook) set_sig_addr; | 1437 | typeof(set_sig_addr_hook) set_sig_addr; |
1445 | 1438 | ||
1446 | DEBUGP("nf_ct_ras: URQ\n"); | 1439 | pr_debug("nf_ct_ras: URQ\n"); |
1447 | 1440 | ||
1448 | set_sig_addr = rcu_dereference(set_sig_addr_hook); | 1441 | set_sig_addr = rcu_dereference(set_sig_addr_hook); |
1449 | if (set_sig_addr && ct->status & IPS_NAT_MASK) { | 1442 | if (set_sig_addr && ct->status & IPS_NAT_MASK) { |
@@ -1476,7 +1469,7 @@ static int process_arq(struct sk_buff **pskb, struct nf_conn *ct, | |||
1476 | union nf_conntrack_address addr; | 1469 | union nf_conntrack_address addr; |
1477 | typeof(set_h225_addr_hook) set_h225_addr; | 1470 | typeof(set_h225_addr_hook) set_h225_addr; |
1478 | 1471 | ||
1479 | DEBUGP("nf_ct_ras: ARQ\n"); | 1472 | pr_debug("nf_ct_ras: ARQ\n"); |
1480 | 1473 | ||
1481 | set_h225_addr = rcu_dereference(set_h225_addr_hook); | 1474 | set_h225_addr = rcu_dereference(set_h225_addr_hook); |
1482 | if ((arq->options & eAdmissionRequest_destCallSignalAddress) && | 1475 | if ((arq->options & eAdmissionRequest_destCallSignalAddress) && |
@@ -1519,7 +1512,7 @@ static int process_acf(struct sk_buff **pskb, struct nf_conn *ct, | |||
1519 | struct nf_conntrack_expect *exp; | 1512 | struct nf_conntrack_expect *exp; |
1520 | typeof(set_sig_addr_hook) set_sig_addr; | 1513 | typeof(set_sig_addr_hook) set_sig_addr; |
1521 | 1514 | ||
1522 | DEBUGP("nf_ct_ras: ACF\n"); | 1515 | pr_debug("nf_ct_ras: ACF\n"); |
1523 | 1516 | ||
1524 | if (!get_h225_addr(ct, *data, &acf->destCallSignalAddress, | 1517 | if (!get_h225_addr(ct, *data, &acf->destCallSignalAddress, |
1525 | &addr, &port)) | 1518 | &addr, &port)) |
@@ -1544,7 +1537,7 @@ static int process_acf(struct sk_buff **pskb, struct nf_conn *ct, | |||
1544 | exp->helper = nf_conntrack_helper_q931; | 1537 | exp->helper = nf_conntrack_helper_q931; |
1545 | 1538 | ||
1546 | if (nf_ct_expect_related(exp) == 0) { | 1539 | if (nf_ct_expect_related(exp) == 0) { |
1547 | DEBUGP("nf_ct_ras: expect Q.931 "); | 1540 | pr_debug("nf_ct_ras: expect Q.931 "); |
1548 | NF_CT_DUMP_TUPLE(&exp->tuple); | 1541 | NF_CT_DUMP_TUPLE(&exp->tuple); |
1549 | } else | 1542 | } else |
1550 | ret = -1; | 1543 | ret = -1; |
@@ -1561,7 +1554,7 @@ static int process_lrq(struct sk_buff **pskb, struct nf_conn *ct, | |||
1561 | { | 1554 | { |
1562 | typeof(set_ras_addr_hook) set_ras_addr; | 1555 | typeof(set_ras_addr_hook) set_ras_addr; |
1563 | 1556 | ||
1564 | DEBUGP("nf_ct_ras: LRQ\n"); | 1557 | pr_debug("nf_ct_ras: LRQ\n"); |
1565 | 1558 | ||
1566 | set_ras_addr = rcu_dereference(set_ras_addr_hook); | 1559 | set_ras_addr = rcu_dereference(set_ras_addr_hook); |
1567 | if (set_ras_addr && ct->status & IPS_NAT_MASK) | 1560 | if (set_ras_addr && ct->status & IPS_NAT_MASK) |
@@ -1581,7 +1574,7 @@ static int process_lcf(struct sk_buff **pskb, struct nf_conn *ct, | |||
1581 | union nf_conntrack_address addr; | 1574 | union nf_conntrack_address addr; |
1582 | struct nf_conntrack_expect *exp; | 1575 | struct nf_conntrack_expect *exp; |
1583 | 1576 | ||
1584 | DEBUGP("nf_ct_ras: LCF\n"); | 1577 | pr_debug("nf_ct_ras: LCF\n"); |
1585 | 1578 | ||
1586 | if (!get_h225_addr(ct, *data, &lcf->callSignalAddress, | 1579 | if (!get_h225_addr(ct, *data, &lcf->callSignalAddress, |
1587 | &addr, &port)) | 1580 | &addr, &port)) |
@@ -1597,7 +1590,7 @@ static int process_lcf(struct sk_buff **pskb, struct nf_conn *ct, | |||
1597 | exp->helper = nf_conntrack_helper_q931; | 1590 | exp->helper = nf_conntrack_helper_q931; |
1598 | 1591 | ||
1599 | if (nf_ct_expect_related(exp) == 0) { | 1592 | if (nf_ct_expect_related(exp) == 0) { |
1600 | DEBUGP("nf_ct_ras: expect Q.931 "); | 1593 | pr_debug("nf_ct_ras: expect Q.931 "); |
1601 | NF_CT_DUMP_TUPLE(&exp->tuple); | 1594 | NF_CT_DUMP_TUPLE(&exp->tuple); |
1602 | } else | 1595 | } else |
1603 | ret = -1; | 1596 | ret = -1; |
@@ -1618,7 +1611,7 @@ static int process_irr(struct sk_buff **pskb, struct nf_conn *ct, | |||
1618 | typeof(set_ras_addr_hook) set_ras_addr; | 1611 | typeof(set_ras_addr_hook) set_ras_addr; |
1619 | typeof(set_sig_addr_hook) set_sig_addr; | 1612 | typeof(set_sig_addr_hook) set_sig_addr; |
1620 | 1613 | ||
1621 | DEBUGP("nf_ct_ras: IRR\n"); | 1614 | pr_debug("nf_ct_ras: IRR\n"); |
1622 | 1615 | ||
1623 | set_ras_addr = rcu_dereference(set_ras_addr_hook); | 1616 | set_ras_addr = rcu_dereference(set_ras_addr_hook); |
1624 | if (set_ras_addr && ct->status & IPS_NAT_MASK) { | 1617 | if (set_ras_addr && ct->status & IPS_NAT_MASK) { |
@@ -1677,7 +1670,7 @@ static int process_ras(struct sk_buff **pskb, struct nf_conn *ct, | |||
1677 | return process_irr(pskb, ct, ctinfo, data, | 1670 | return process_irr(pskb, ct, ctinfo, data, |
1678 | &ras->infoRequestResponse); | 1671 | &ras->infoRequestResponse); |
1679 | default: | 1672 | default: |
1680 | DEBUGP("nf_ct_ras: RAS message %d\n", ras->choice); | 1673 | pr_debug("nf_ct_ras: RAS message %d\n", ras->choice); |
1681 | break; | 1674 | break; |
1682 | } | 1675 | } |
1683 | 1676 | ||
@@ -1693,7 +1686,7 @@ static int ras_help(struct sk_buff **pskb, unsigned int protoff, | |||
1693 | int datalen = 0; | 1686 | int datalen = 0; |
1694 | int ret; | 1687 | int ret; |
1695 | 1688 | ||
1696 | DEBUGP("nf_ct_ras: skblen = %u\n", (*pskb)->len); | 1689 | pr_debug("nf_ct_ras: skblen = %u\n", (*pskb)->len); |
1697 | 1690 | ||
1698 | spin_lock_bh(&nf_h323_lock); | 1691 | spin_lock_bh(&nf_h323_lock); |
1699 | 1692 | ||
@@ -1701,15 +1694,15 @@ static int ras_help(struct sk_buff **pskb, unsigned int protoff, | |||
1701 | data = get_udp_data(pskb, protoff, &datalen); | 1694 | data = get_udp_data(pskb, protoff, &datalen); |
1702 | if (data == NULL) | 1695 | if (data == NULL) |
1703 | goto accept; | 1696 | goto accept; |
1704 | DEBUGP("nf_ct_ras: RAS message len=%d ", datalen); | 1697 | pr_debug("nf_ct_ras: RAS message len=%d ", datalen); |
1705 | NF_CT_DUMP_TUPLE(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple); | 1698 | NF_CT_DUMP_TUPLE(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple); |
1706 | 1699 | ||
1707 | /* Decode RAS message */ | 1700 | /* Decode RAS message */ |
1708 | ret = DecodeRasMessage(data, datalen, &ras); | 1701 | ret = DecodeRasMessage(data, datalen, &ras); |
1709 | if (ret < 0) { | 1702 | if (ret < 0) { |
1710 | DEBUGP("nf_ct_ras: decoding error: %s\n", | 1703 | pr_debug("nf_ct_ras: decoding error: %s\n", |
1711 | ret == H323_ERROR_BOUND ? | 1704 | ret == H323_ERROR_BOUND ? |
1712 | "out of bound" : "out of range"); | 1705 | "out of bound" : "out of range"); |
1713 | goto accept; | 1706 | goto accept; |
1714 | } | 1707 | } |
1715 | 1708 | ||
@@ -1760,7 +1753,7 @@ static void __exit nf_conntrack_h323_fini(void) | |||
1760 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); | 1753 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); |
1761 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); | 1754 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); |
1762 | kfree(h323_buffer); | 1755 | kfree(h323_buffer); |
1763 | DEBUGP("nf_ct_h323: fini\n"); | 1756 | pr_debug("nf_ct_h323: fini\n"); |
1764 | } | 1757 | } |
1765 | 1758 | ||
1766 | /****************************************************************************/ | 1759 | /****************************************************************************/ |
@@ -1783,7 +1776,7 @@ static int __init nf_conntrack_h323_init(void) | |||
1783 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]); | 1776 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]); |
1784 | if (ret < 0) | 1777 | if (ret < 0) |
1785 | goto err4; | 1778 | goto err4; |
1786 | DEBUGP("nf_ct_h323: init success\n"); | 1779 | pr_debug("nf_ct_h323: init success\n"); |
1787 | return 0; | 1780 | return 0; |
1788 | 1781 | ||
1789 | err4: | 1782 | err4: |
diff --git a/net/netfilter/nf_conntrack_irc.c b/net/netfilter/nf_conntrack_irc.c index 8c7340794bf6..1562ca97a349 100644 --- a/net/netfilter/nf_conntrack_irc.c +++ b/net/netfilter/nf_conntrack_irc.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/moduleparam.h> | 12 | #include <linux/moduleparam.h> |
13 | #include <linux/skbuff.h> | 13 | #include <linux/skbuff.h> |
14 | #include <linux/in.h> | 14 | #include <linux/in.h> |
15 | #include <linux/ip.h> | ||
15 | #include <linux/tcp.h> | 16 | #include <linux/tcp.h> |
16 | #include <linux/netfilter.h> | 17 | #include <linux/netfilter.h> |
17 | 18 | ||
@@ -55,13 +56,6 @@ static const char *dccprotos[] = { | |||
55 | 56 | ||
56 | #define MINMATCHLEN 5 | 57 | #define MINMATCHLEN 5 |
57 | 58 | ||
58 | #if 0 | ||
59 | #define DEBUGP(format, args...) printk(KERN_DEBUG "%s:%s:" format, \ | ||
60 | __FILE__, __FUNCTION__ , ## args) | ||
61 | #else | ||
62 | #define DEBUGP(format, args...) | ||
63 | #endif | ||
64 | |||
65 | /* tries to get the ip_addr and port out of a dcc command | 59 | /* tries to get the ip_addr and port out of a dcc command |
66 | * return value: -1 on failure, 0 on success | 60 | * return value: -1 on failure, 0 on success |
67 | * data pointer to first byte of DCC command data | 61 | * data pointer to first byte of DCC command data |
@@ -99,6 +93,7 @@ static int help(struct sk_buff **pskb, unsigned int protoff, | |||
99 | struct nf_conn *ct, enum ip_conntrack_info ctinfo) | 93 | struct nf_conn *ct, enum ip_conntrack_info ctinfo) |
100 | { | 94 | { |
101 | unsigned int dataoff; | 95 | unsigned int dataoff; |
96 | struct iphdr *iph; | ||
102 | struct tcphdr _tcph, *th; | 97 | struct tcphdr _tcph, *th; |
103 | char *data, *data_limit, *ib_ptr; | 98 | char *data, *data_limit, *ib_ptr; |
104 | int dir = CTINFO2DIR(ctinfo); | 99 | int dir = CTINFO2DIR(ctinfo); |
@@ -148,9 +143,10 @@ static int help(struct sk_buff **pskb, unsigned int protoff, | |||
148 | data += 5; | 143 | data += 5; |
149 | /* we have at least (19+MINMATCHLEN)-5 bytes valid data left */ | 144 | /* we have at least (19+MINMATCHLEN)-5 bytes valid data left */ |
150 | 145 | ||
151 | DEBUGP("DCC found in master %u.%u.%u.%u:%u %u.%u.%u.%u:%u...\n", | 146 | iph = ip_hdr(*pskb); |
152 | NIPQUAD(iph->saddr), ntohs(th->source), | 147 | pr_debug("DCC found in master %u.%u.%u.%u:%u %u.%u.%u.%u:%u\n", |
153 | NIPQUAD(iph->daddr), ntohs(th->dest)); | 148 | NIPQUAD(iph->saddr), ntohs(th->source), |
149 | NIPQUAD(iph->daddr), ntohs(th->dest)); | ||
154 | 150 | ||
155 | for (i = 0; i < ARRAY_SIZE(dccprotos); i++) { | 151 | for (i = 0; i < ARRAY_SIZE(dccprotos); i++) { |
156 | if (memcmp(data, dccprotos[i], strlen(dccprotos[i]))) { | 152 | if (memcmp(data, dccprotos[i], strlen(dccprotos[i]))) { |
@@ -158,18 +154,18 @@ static int help(struct sk_buff **pskb, unsigned int protoff, | |||
158 | continue; | 154 | continue; |
159 | } | 155 | } |
160 | data += strlen(dccprotos[i]); | 156 | data += strlen(dccprotos[i]); |
161 | DEBUGP("DCC %s detected\n", dccprotos[i]); | 157 | pr_debug("DCC %s detected\n", dccprotos[i]); |
162 | 158 | ||
163 | /* we have at least | 159 | /* we have at least |
164 | * (19+MINMATCHLEN)-5-dccprotos[i].matchlen bytes valid | 160 | * (19+MINMATCHLEN)-5-dccprotos[i].matchlen bytes valid |
165 | * data left (== 14/13 bytes) */ | 161 | * data left (== 14/13 bytes) */ |
166 | if (parse_dcc((char *)data, data_limit, &dcc_ip, | 162 | if (parse_dcc((char *)data, data_limit, &dcc_ip, |
167 | &dcc_port, &addr_beg_p, &addr_end_p)) { | 163 | &dcc_port, &addr_beg_p, &addr_end_p)) { |
168 | DEBUGP("unable to parse dcc command\n"); | 164 | pr_debug("unable to parse dcc command\n"); |
169 | continue; | 165 | continue; |
170 | } | 166 | } |
171 | DEBUGP("DCC bound ip/port: %u.%u.%u.%u:%u\n", | 167 | pr_debug("DCC bound ip/port: %u.%u.%u.%u:%u\n", |
172 | HIPQUAD(dcc_ip), dcc_port); | 168 | HIPQUAD(dcc_ip), dcc_port); |
173 | 169 | ||
174 | /* dcc_ip can be the internal OR external (NAT'ed) IP */ | 170 | /* dcc_ip can be the internal OR external (NAT'ed) IP */ |
175 | tuple = &ct->tuplehash[dir].tuple; | 171 | tuple = &ct->tuplehash[dir].tuple; |
diff --git a/net/netfilter/nf_conntrack_l3proto_generic.c b/net/netfilter/nf_conntrack_l3proto_generic.c index 2fd0f11b8fb2..b1bfa207a850 100644 --- a/net/netfilter/nf_conntrack_l3proto_generic.c +++ b/net/netfilter/nf_conntrack_l3proto_generic.c | |||
@@ -31,12 +31,6 @@ | |||
31 | #include <net/netfilter/nf_conntrack_core.h> | 31 | #include <net/netfilter/nf_conntrack_core.h> |
32 | #include <net/netfilter/ipv4/nf_conntrack_ipv4.h> | 32 | #include <net/netfilter/ipv4/nf_conntrack_ipv4.h> |
33 | 33 | ||
34 | #if 0 | ||
35 | #define DEBUGP printk | ||
36 | #else | ||
37 | #define DEBUGP(format, args...) | ||
38 | #endif | ||
39 | |||
40 | static int generic_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, | 34 | static int generic_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, |
41 | struct nf_conntrack_tuple *tuple) | 35 | struct nf_conntrack_tuple *tuple) |
42 | { | 36 | { |
diff --git a/net/netfilter/nf_conntrack_pptp.c b/net/netfilter/nf_conntrack_pptp.c index 63dac5eb959f..b0804199ab59 100644 --- a/net/netfilter/nf_conntrack_pptp.c +++ b/net/netfilter/nf_conntrack_pptp.c | |||
@@ -65,7 +65,7 @@ void | |||
65 | struct nf_conntrack_expect *exp) __read_mostly; | 65 | struct nf_conntrack_expect *exp) __read_mostly; |
66 | EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_expectfn); | 66 | EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_expectfn); |
67 | 67 | ||
68 | #if 0 | 68 | #ifdef DEBUG |
69 | /* PptpControlMessageType names */ | 69 | /* PptpControlMessageType names */ |
70 | const char *pptp_msg_name[] = { | 70 | const char *pptp_msg_name[] = { |
71 | "UNKNOWN_MESSAGE", | 71 | "UNKNOWN_MESSAGE", |
@@ -86,9 +86,6 @@ const char *pptp_msg_name[] = { | |||
86 | "SET_LINK_INFO" | 86 | "SET_LINK_INFO" |
87 | }; | 87 | }; |
88 | EXPORT_SYMBOL(pptp_msg_name); | 88 | EXPORT_SYMBOL(pptp_msg_name); |
89 | #define DEBUGP(format, args...) printk(KERN_DEBUG "%s:%s: " format, __FILE__, __FUNCTION__, ## args) | ||
90 | #else | ||
91 | #define DEBUGP(format, args...) | ||
92 | #endif | 89 | #endif |
93 | 90 | ||
94 | #define SECS *HZ | 91 | #define SECS *HZ |
@@ -102,7 +99,7 @@ static void pptp_expectfn(struct nf_conn *ct, | |||
102 | struct nf_conntrack_expect *exp) | 99 | struct nf_conntrack_expect *exp) |
103 | { | 100 | { |
104 | typeof(nf_nat_pptp_hook_expectfn) nf_nat_pptp_expectfn; | 101 | typeof(nf_nat_pptp_hook_expectfn) nf_nat_pptp_expectfn; |
105 | DEBUGP("increasing timeouts\n"); | 102 | pr_debug("increasing timeouts\n"); |
106 | 103 | ||
107 | /* increase timeout of GRE data channel conntrack entry */ | 104 | /* increase timeout of GRE data channel conntrack entry */ |
108 | ct->proto.gre.timeout = PPTP_GRE_TIMEOUT; | 105 | ct->proto.gre.timeout = PPTP_GRE_TIMEOUT; |
@@ -121,17 +118,17 @@ static void pptp_expectfn(struct nf_conn *ct, | |||
121 | 118 | ||
122 | /* obviously this tuple inversion only works until you do NAT */ | 119 | /* obviously this tuple inversion only works until you do NAT */ |
123 | nf_ct_invert_tuplepr(&inv_t, &exp->tuple); | 120 | nf_ct_invert_tuplepr(&inv_t, &exp->tuple); |
124 | DEBUGP("trying to unexpect other dir: "); | 121 | pr_debug("trying to unexpect other dir: "); |
125 | NF_CT_DUMP_TUPLE(&inv_t); | 122 | NF_CT_DUMP_TUPLE(&inv_t); |
126 | 123 | ||
127 | exp_other = nf_ct_expect_find_get(&inv_t); | 124 | exp_other = nf_ct_expect_find_get(&inv_t); |
128 | if (exp_other) { | 125 | if (exp_other) { |
129 | /* delete other expectation. */ | 126 | /* delete other expectation. */ |
130 | DEBUGP("found\n"); | 127 | pr_debug("found\n"); |
131 | nf_ct_unexpect_related(exp_other); | 128 | nf_ct_unexpect_related(exp_other); |
132 | nf_ct_expect_put(exp_other); | 129 | nf_ct_expect_put(exp_other); |
133 | } else { | 130 | } else { |
134 | DEBUGP("not found\n"); | 131 | pr_debug("not found\n"); |
135 | } | 132 | } |
136 | } | 133 | } |
137 | rcu_read_unlock(); | 134 | rcu_read_unlock(); |
@@ -143,13 +140,13 @@ static int destroy_sibling_or_exp(const struct nf_conntrack_tuple *t) | |||
143 | struct nf_conntrack_expect *exp; | 140 | struct nf_conntrack_expect *exp; |
144 | struct nf_conn *sibling; | 141 | struct nf_conn *sibling; |
145 | 142 | ||
146 | DEBUGP("trying to timeout ct or exp for tuple "); | 143 | pr_debug("trying to timeout ct or exp for tuple "); |
147 | NF_CT_DUMP_TUPLE(t); | 144 | NF_CT_DUMP_TUPLE(t); |
148 | 145 | ||
149 | h = nf_conntrack_find_get(t); | 146 | h = nf_conntrack_find_get(t); |
150 | if (h) { | 147 | if (h) { |
151 | sibling = nf_ct_tuplehash_to_ctrack(h); | 148 | sibling = nf_ct_tuplehash_to_ctrack(h); |
152 | DEBUGP("setting timeout of conntrack %p to 0\n", sibling); | 149 | pr_debug("setting timeout of conntrack %p to 0\n", sibling); |
153 | sibling->proto.gre.timeout = 0; | 150 | sibling->proto.gre.timeout = 0; |
154 | sibling->proto.gre.stream_timeout = 0; | 151 | sibling->proto.gre.stream_timeout = 0; |
155 | if (del_timer(&sibling->timeout)) | 152 | if (del_timer(&sibling->timeout)) |
@@ -159,7 +156,7 @@ static int destroy_sibling_or_exp(const struct nf_conntrack_tuple *t) | |||
159 | } else { | 156 | } else { |
160 | exp = nf_ct_expect_find_get(t); | 157 | exp = nf_ct_expect_find_get(t); |
161 | if (exp) { | 158 | if (exp) { |
162 | DEBUGP("unexpect_related of expect %p\n", exp); | 159 | pr_debug("unexpect_related of expect %p\n", exp); |
163 | nf_ct_unexpect_related(exp); | 160 | nf_ct_unexpect_related(exp); |
164 | nf_ct_expect_put(exp); | 161 | nf_ct_expect_put(exp); |
165 | return 1; | 162 | return 1; |
@@ -182,7 +179,7 @@ static void pptp_destroy_siblings(struct nf_conn *ct) | |||
182 | t.src.u.gre.key = help->help.ct_pptp_info.pns_call_id; | 179 | t.src.u.gre.key = help->help.ct_pptp_info.pns_call_id; |
183 | t.dst.u.gre.key = help->help.ct_pptp_info.pac_call_id; | 180 | t.dst.u.gre.key = help->help.ct_pptp_info.pac_call_id; |
184 | if (!destroy_sibling_or_exp(&t)) | 181 | if (!destroy_sibling_or_exp(&t)) |
185 | DEBUGP("failed to timeout original pns->pac ct/exp\n"); | 182 | pr_debug("failed to timeout original pns->pac ct/exp\n"); |
186 | 183 | ||
187 | /* try reply (pac->pns) tuple */ | 184 | /* try reply (pac->pns) tuple */ |
188 | memcpy(&t, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, sizeof(t)); | 185 | memcpy(&t, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, sizeof(t)); |
@@ -190,7 +187,7 @@ static void pptp_destroy_siblings(struct nf_conn *ct) | |||
190 | t.src.u.gre.key = help->help.ct_pptp_info.pac_call_id; | 187 | t.src.u.gre.key = help->help.ct_pptp_info.pac_call_id; |
191 | t.dst.u.gre.key = help->help.ct_pptp_info.pns_call_id; | 188 | t.dst.u.gre.key = help->help.ct_pptp_info.pns_call_id; |
192 | if (!destroy_sibling_or_exp(&t)) | 189 | if (!destroy_sibling_or_exp(&t)) |
193 | DEBUGP("failed to timeout reply pac->pns ct/exp\n"); | 190 | pr_debug("failed to timeout reply pac->pns ct/exp\n"); |
194 | } | 191 | } |
195 | 192 | ||
196 | /* expect GRE connections (PNS->PAC and PAC->PNS direction) */ | 193 | /* expect GRE connections (PNS->PAC and PAC->PNS direction) */ |
@@ -270,7 +267,7 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
270 | typeof(nf_nat_pptp_hook_inbound) nf_nat_pptp_inbound; | 267 | typeof(nf_nat_pptp_hook_inbound) nf_nat_pptp_inbound; |
271 | 268 | ||
272 | msg = ntohs(ctlh->messageType); | 269 | msg = ntohs(ctlh->messageType); |
273 | DEBUGP("inbound control message %s\n", pptp_msg_name[msg]); | 270 | pr_debug("inbound control message %s\n", pptp_msg_name[msg]); |
274 | 271 | ||
275 | switch (msg) { | 272 | switch (msg) { |
276 | case PPTP_START_SESSION_REPLY: | 273 | case PPTP_START_SESSION_REPLY: |
@@ -305,8 +302,8 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
305 | pcid = pptpReq->ocack.peersCallID; | 302 | pcid = pptpReq->ocack.peersCallID; |
306 | if (info->pns_call_id != pcid) | 303 | if (info->pns_call_id != pcid) |
307 | goto invalid; | 304 | goto invalid; |
308 | DEBUGP("%s, CID=%X, PCID=%X\n", pptp_msg_name[msg], | 305 | pr_debug("%s, CID=%X, PCID=%X\n", pptp_msg_name[msg], |
309 | ntohs(cid), ntohs(pcid)); | 306 | ntohs(cid), ntohs(pcid)); |
310 | 307 | ||
311 | if (pptpReq->ocack.resultCode == PPTP_OUTCALL_CONNECT) { | 308 | if (pptpReq->ocack.resultCode == PPTP_OUTCALL_CONNECT) { |
312 | info->cstate = PPTP_CALL_OUT_CONF; | 309 | info->cstate = PPTP_CALL_OUT_CONF; |
@@ -322,7 +319,7 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
322 | goto invalid; | 319 | goto invalid; |
323 | 320 | ||
324 | cid = pptpReq->icreq.callID; | 321 | cid = pptpReq->icreq.callID; |
325 | DEBUGP("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid)); | 322 | pr_debug("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid)); |
326 | info->cstate = PPTP_CALL_IN_REQ; | 323 | info->cstate = PPTP_CALL_IN_REQ; |
327 | info->pac_call_id = cid; | 324 | info->pac_call_id = cid; |
328 | break; | 325 | break; |
@@ -341,7 +338,7 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
341 | if (info->pns_call_id != pcid) | 338 | if (info->pns_call_id != pcid) |
342 | goto invalid; | 339 | goto invalid; |
343 | 340 | ||
344 | DEBUGP("%s, PCID=%X\n", pptp_msg_name[msg], ntohs(pcid)); | 341 | pr_debug("%s, PCID=%X\n", pptp_msg_name[msg], ntohs(pcid)); |
345 | info->cstate = PPTP_CALL_IN_CONF; | 342 | info->cstate = PPTP_CALL_IN_CONF; |
346 | 343 | ||
347 | /* we expect a GRE connection from PAC to PNS */ | 344 | /* we expect a GRE connection from PAC to PNS */ |
@@ -351,7 +348,7 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
351 | case PPTP_CALL_DISCONNECT_NOTIFY: | 348 | case PPTP_CALL_DISCONNECT_NOTIFY: |
352 | /* server confirms disconnect */ | 349 | /* server confirms disconnect */ |
353 | cid = pptpReq->disc.callID; | 350 | cid = pptpReq->disc.callID; |
354 | DEBUGP("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid)); | 351 | pr_debug("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid)); |
355 | info->cstate = PPTP_CALL_NONE; | 352 | info->cstate = PPTP_CALL_NONE; |
356 | 353 | ||
357 | /* untrack this call id, unexpect GRE packets */ | 354 | /* untrack this call id, unexpect GRE packets */ |
@@ -374,11 +371,11 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
374 | return NF_ACCEPT; | 371 | return NF_ACCEPT; |
375 | 372 | ||
376 | invalid: | 373 | invalid: |
377 | DEBUGP("invalid %s: type=%d cid=%u pcid=%u " | 374 | pr_debug("invalid %s: type=%d cid=%u pcid=%u " |
378 | "cstate=%d sstate=%d pns_cid=%u pac_cid=%u\n", | 375 | "cstate=%d sstate=%d pns_cid=%u pac_cid=%u\n", |
379 | msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] : pptp_msg_name[0], | 376 | msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] : pptp_msg_name[0], |
380 | msg, ntohs(cid), ntohs(pcid), info->cstate, info->sstate, | 377 | msg, ntohs(cid), ntohs(pcid), info->cstate, info->sstate, |
381 | ntohs(info->pns_call_id), ntohs(info->pac_call_id)); | 378 | ntohs(info->pns_call_id), ntohs(info->pac_call_id)); |
382 | return NF_ACCEPT; | 379 | return NF_ACCEPT; |
383 | } | 380 | } |
384 | 381 | ||
@@ -396,7 +393,7 @@ pptp_outbound_pkt(struct sk_buff **pskb, | |||
396 | typeof(nf_nat_pptp_hook_outbound) nf_nat_pptp_outbound; | 393 | typeof(nf_nat_pptp_hook_outbound) nf_nat_pptp_outbound; |
397 | 394 | ||
398 | msg = ntohs(ctlh->messageType); | 395 | msg = ntohs(ctlh->messageType); |
399 | DEBUGP("outbound control message %s\n", pptp_msg_name[msg]); | 396 | pr_debug("outbound control message %s\n", pptp_msg_name[msg]); |
400 | 397 | ||
401 | switch (msg) { | 398 | switch (msg) { |
402 | case PPTP_START_SESSION_REQUEST: | 399 | case PPTP_START_SESSION_REQUEST: |
@@ -418,7 +415,7 @@ pptp_outbound_pkt(struct sk_buff **pskb, | |||
418 | info->cstate = PPTP_CALL_OUT_REQ; | 415 | info->cstate = PPTP_CALL_OUT_REQ; |
419 | /* track PNS call id */ | 416 | /* track PNS call id */ |
420 | cid = pptpReq->ocreq.callID; | 417 | cid = pptpReq->ocreq.callID; |
421 | DEBUGP("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid)); | 418 | pr_debug("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid)); |
422 | info->pns_call_id = cid; | 419 | info->pns_call_id = cid; |
423 | break; | 420 | break; |
424 | 421 | ||
@@ -432,8 +429,8 @@ pptp_outbound_pkt(struct sk_buff **pskb, | |||
432 | pcid = pptpReq->icack.peersCallID; | 429 | pcid = pptpReq->icack.peersCallID; |
433 | if (info->pac_call_id != pcid) | 430 | if (info->pac_call_id != pcid) |
434 | goto invalid; | 431 | goto invalid; |
435 | DEBUGP("%s, CID=%X PCID=%X\n", pptp_msg_name[msg], | 432 | pr_debug("%s, CID=%X PCID=%X\n", pptp_msg_name[msg], |
436 | ntohs(cid), ntohs(pcid)); | 433 | ntohs(cid), ntohs(pcid)); |
437 | 434 | ||
438 | if (pptpReq->icack.resultCode == PPTP_INCALL_ACCEPT) { | 435 | if (pptpReq->icack.resultCode == PPTP_INCALL_ACCEPT) { |
439 | /* part two of the three-way handshake */ | 436 | /* part two of the three-way handshake */ |
@@ -469,11 +466,11 @@ pptp_outbound_pkt(struct sk_buff **pskb, | |||
469 | return NF_ACCEPT; | 466 | return NF_ACCEPT; |
470 | 467 | ||
471 | invalid: | 468 | invalid: |
472 | DEBUGP("invalid %s: type=%d cid=%u pcid=%u " | 469 | pr_debug("invalid %s: type=%d cid=%u pcid=%u " |
473 | "cstate=%d sstate=%d pns_cid=%u pac_cid=%u\n", | 470 | "cstate=%d sstate=%d pns_cid=%u pac_cid=%u\n", |
474 | msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] : pptp_msg_name[0], | 471 | msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] : pptp_msg_name[0], |
475 | msg, ntohs(cid), ntohs(pcid), info->cstate, info->sstate, | 472 | msg, ntohs(cid), ntohs(pcid), info->cstate, info->sstate, |
476 | ntohs(info->pns_call_id), ntohs(info->pac_call_id)); | 473 | ntohs(info->pns_call_id), ntohs(info->pac_call_id)); |
477 | return NF_ACCEPT; | 474 | return NF_ACCEPT; |
478 | } | 475 | } |
479 | 476 | ||
@@ -524,7 +521,7 @@ conntrack_pptp_help(struct sk_buff **pskb, unsigned int protoff, | |||
524 | 521 | ||
525 | pptph = skb_header_pointer(*pskb, nexthdr_off, sizeof(_pptph), &_pptph); | 522 | pptph = skb_header_pointer(*pskb, nexthdr_off, sizeof(_pptph), &_pptph); |
526 | if (!pptph) { | 523 | if (!pptph) { |
527 | DEBUGP("no full PPTP header, can't track\n"); | 524 | pr_debug("no full PPTP header, can't track\n"); |
528 | return NF_ACCEPT; | 525 | return NF_ACCEPT; |
529 | } | 526 | } |
530 | nexthdr_off += sizeof(_pptph); | 527 | nexthdr_off += sizeof(_pptph); |
@@ -533,7 +530,7 @@ conntrack_pptp_help(struct sk_buff **pskb, unsigned int protoff, | |||
533 | /* if it's not a control message we can't do anything with it */ | 530 | /* if it's not a control message we can't do anything with it */ |
534 | if (ntohs(pptph->packetType) != PPTP_PACKET_CONTROL || | 531 | if (ntohs(pptph->packetType) != PPTP_PACKET_CONTROL || |
535 | ntohl(pptph->magicCookie) != PPTP_MAGIC_COOKIE) { | 532 | ntohl(pptph->magicCookie) != PPTP_MAGIC_COOKIE) { |
536 | DEBUGP("not a control packet\n"); | 533 | pr_debug("not a control packet\n"); |
537 | return NF_ACCEPT; | 534 | return NF_ACCEPT; |
538 | } | 535 | } |
539 | 536 | ||
@@ -569,8 +566,8 @@ conntrack_pptp_help(struct sk_buff **pskb, unsigned int protoff, | |||
569 | /* server -> client (PAC -> PNS) */ | 566 | /* server -> client (PAC -> PNS) */ |
570 | ret = pptp_inbound_pkt(pskb, ctlh, pptpReq, reqlen, ct, | 567 | ret = pptp_inbound_pkt(pskb, ctlh, pptpReq, reqlen, ct, |
571 | ctinfo); | 568 | ctinfo); |
572 | DEBUGP("sstate: %d->%d, cstate: %d->%d\n", | 569 | pr_debug("sstate: %d->%d, cstate: %d->%d\n", |
573 | oldsstate, info->sstate, oldcstate, info->cstate); | 570 | oldsstate, info->sstate, oldcstate, info->cstate); |
574 | spin_unlock_bh(&nf_pptp_lock); | 571 | spin_unlock_bh(&nf_pptp_lock); |
575 | 572 | ||
576 | return ret; | 573 | return ret; |
diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c index 339c397d1b5f..771c4c29936e 100644 --- a/net/netfilter/nf_conntrack_proto_gre.c +++ b/net/netfilter/nf_conntrack_proto_gre.c | |||
@@ -40,12 +40,6 @@ | |||
40 | #define GRE_TIMEOUT (30 * HZ) | 40 | #define GRE_TIMEOUT (30 * HZ) |
41 | #define GRE_STREAM_TIMEOUT (180 * HZ) | 41 | #define GRE_STREAM_TIMEOUT (180 * HZ) |
42 | 42 | ||
43 | #if 0 | ||
44 | #define DEBUGP(format, args...) printk(KERN_DEBUG "%s:%s: " format, __FILE__, __FUNCTION__, ## args) | ||
45 | #else | ||
46 | #define DEBUGP(x, args...) | ||
47 | #endif | ||
48 | |||
49 | static DEFINE_RWLOCK(nf_ct_gre_lock); | 43 | static DEFINE_RWLOCK(nf_ct_gre_lock); |
50 | static LIST_HEAD(gre_keymap_list); | 44 | static LIST_HEAD(gre_keymap_list); |
51 | 45 | ||
@@ -87,7 +81,7 @@ static __be16 gre_keymap_lookup(struct nf_conntrack_tuple *t) | |||
87 | } | 81 | } |
88 | read_unlock_bh(&nf_ct_gre_lock); | 82 | read_unlock_bh(&nf_ct_gre_lock); |
89 | 83 | ||
90 | DEBUGP("lookup src key 0x%x for ", key); | 84 | pr_debug("lookup src key 0x%x for ", key); |
91 | NF_CT_DUMP_TUPLE(t); | 85 | NF_CT_DUMP_TUPLE(t); |
92 | 86 | ||
93 | return key; | 87 | return key; |
@@ -107,8 +101,8 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir, | |||
107 | if (gre_key_cmpfn(km, t) && km == *kmp) | 101 | if (gre_key_cmpfn(km, t) && km == *kmp) |
108 | return 0; | 102 | return 0; |
109 | } | 103 | } |
110 | DEBUGP("trying to override keymap_%s for ct %p\n", | 104 | pr_debug("trying to override keymap_%s for ct %p\n", |
111 | dir == IP_CT_DIR_REPLY ? "reply" : "orig", ct); | 105 | dir == IP_CT_DIR_REPLY ? "reply" : "orig", ct); |
112 | return -EEXIST; | 106 | return -EEXIST; |
113 | } | 107 | } |
114 | 108 | ||
@@ -118,7 +112,7 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir, | |||
118 | memcpy(&km->tuple, t, sizeof(*t)); | 112 | memcpy(&km->tuple, t, sizeof(*t)); |
119 | *kmp = km; | 113 | *kmp = km; |
120 | 114 | ||
121 | DEBUGP("adding new entry %p: ", km); | 115 | pr_debug("adding new entry %p: ", km); |
122 | NF_CT_DUMP_TUPLE(&km->tuple); | 116 | NF_CT_DUMP_TUPLE(&km->tuple); |
123 | 117 | ||
124 | write_lock_bh(&nf_ct_gre_lock); | 118 | write_lock_bh(&nf_ct_gre_lock); |
@@ -135,13 +129,13 @@ void nf_ct_gre_keymap_destroy(struct nf_conn *ct) | |||
135 | struct nf_conn_help *help = nfct_help(ct); | 129 | struct nf_conn_help *help = nfct_help(ct); |
136 | enum ip_conntrack_dir dir; | 130 | enum ip_conntrack_dir dir; |
137 | 131 | ||
138 | DEBUGP("entering for ct %p\n", ct); | 132 | pr_debug("entering for ct %p\n", ct); |
139 | 133 | ||
140 | write_lock_bh(&nf_ct_gre_lock); | 134 | write_lock_bh(&nf_ct_gre_lock); |
141 | for (dir = IP_CT_DIR_ORIGINAL; dir < IP_CT_DIR_MAX; dir++) { | 135 | for (dir = IP_CT_DIR_ORIGINAL; dir < IP_CT_DIR_MAX; dir++) { |
142 | if (help->help.ct_pptp_info.keymap[dir]) { | 136 | if (help->help.ct_pptp_info.keymap[dir]) { |
143 | DEBUGP("removing %p from list\n", | 137 | pr_debug("removing %p from list\n", |
144 | help->help.ct_pptp_info.keymap[dir]); | 138 | help->help.ct_pptp_info.keymap[dir]); |
145 | list_del(&help->help.ct_pptp_info.keymap[dir]->list); | 139 | list_del(&help->help.ct_pptp_info.keymap[dir]->list); |
146 | kfree(help->help.ct_pptp_info.keymap[dir]); | 140 | kfree(help->help.ct_pptp_info.keymap[dir]); |
147 | help->help.ct_pptp_info.keymap[dir] = NULL; | 141 | help->help.ct_pptp_info.keymap[dir] = NULL; |
@@ -186,7 +180,7 @@ static int gre_pkt_to_tuple(const struct sk_buff *skb, | |||
186 | return 1; | 180 | return 1; |
187 | 181 | ||
188 | if (ntohs(grehdr->protocol) != GRE_PROTOCOL_PPTP) { | 182 | if (ntohs(grehdr->protocol) != GRE_PROTOCOL_PPTP) { |
189 | DEBUGP("GRE_VERSION_PPTP but unknown proto\n"); | 183 | pr_debug("GRE_VERSION_PPTP but unknown proto\n"); |
190 | return 0; | 184 | return 0; |
191 | } | 185 | } |
192 | 186 | ||
@@ -242,7 +236,7 @@ static int gre_packet(struct nf_conn *ct, | |||
242 | static int gre_new(struct nf_conn *ct, const struct sk_buff *skb, | 236 | static int gre_new(struct nf_conn *ct, const struct sk_buff *skb, |
243 | unsigned int dataoff) | 237 | unsigned int dataoff) |
244 | { | 238 | { |
245 | DEBUGP(": "); | 239 | pr_debug(": "); |
246 | NF_CT_DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); | 240 | NF_CT_DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); |
247 | 241 | ||
248 | /* initialize to sane value. Ideally a conntrack helper | 242 | /* initialize to sane value. Ideally a conntrack helper |
@@ -258,10 +252,10 @@ static int gre_new(struct nf_conn *ct, const struct sk_buff *skb, | |||
258 | static void gre_destroy(struct nf_conn *ct) | 252 | static void gre_destroy(struct nf_conn *ct) |
259 | { | 253 | { |
260 | struct nf_conn *master = ct->master; | 254 | struct nf_conn *master = ct->master; |
261 | DEBUGP(" entering\n"); | 255 | pr_debug(" entering\n"); |
262 | 256 | ||
263 | if (!master) | 257 | if (!master) |
264 | DEBUGP("no master !?!\n"); | 258 | pr_debug("no master !?!\n"); |
265 | else | 259 | else |
266 | nf_ct_gre_keymap_destroy(master); | 260 | nf_ct_gre_keymap_destroy(master); |
267 | } | 261 | } |
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c index 0d3254b974c5..265769e5002b 100644 --- a/net/netfilter/nf_conntrack_proto_sctp.c +++ b/net/netfilter/nf_conntrack_proto_sctp.c | |||
@@ -25,12 +25,6 @@ | |||
25 | #include <net/netfilter/nf_conntrack_l4proto.h> | 25 | #include <net/netfilter/nf_conntrack_l4proto.h> |
26 | #include <net/netfilter/nf_conntrack_ecache.h> | 26 | #include <net/netfilter/nf_conntrack_ecache.h> |
27 | 27 | ||
28 | #if 0 | ||
29 | #define DEBUGP(format, ...) printk(format, ## __VA_ARGS__) | ||
30 | #else | ||
31 | #define DEBUGP(format, args...) | ||
32 | #endif | ||
33 | |||
34 | /* Protects conntrack->proto.sctp */ | 28 | /* Protects conntrack->proto.sctp */ |
35 | static DEFINE_RWLOCK(sctp_lock); | 29 | static DEFINE_RWLOCK(sctp_lock); |
36 | 30 | ||
@@ -151,9 +145,6 @@ static int sctp_pkt_to_tuple(const struct sk_buff *skb, | |||
151 | { | 145 | { |
152 | sctp_sctphdr_t _hdr, *hp; | 146 | sctp_sctphdr_t _hdr, *hp; |
153 | 147 | ||
154 | DEBUGP(__FUNCTION__); | ||
155 | DEBUGP("\n"); | ||
156 | |||
157 | /* Actually only need first 8 bytes. */ | 148 | /* Actually only need first 8 bytes. */ |
158 | hp = skb_header_pointer(skb, dataoff, 8, &_hdr); | 149 | hp = skb_header_pointer(skb, dataoff, 8, &_hdr); |
159 | if (hp == NULL) | 150 | if (hp == NULL) |
@@ -167,9 +158,6 @@ static int sctp_pkt_to_tuple(const struct sk_buff *skb, | |||
167 | static int sctp_invert_tuple(struct nf_conntrack_tuple *tuple, | 158 | static int sctp_invert_tuple(struct nf_conntrack_tuple *tuple, |
168 | const struct nf_conntrack_tuple *orig) | 159 | const struct nf_conntrack_tuple *orig) |
169 | { | 160 | { |
170 | DEBUGP(__FUNCTION__); | ||
171 | DEBUGP("\n"); | ||
172 | |||
173 | tuple->src.u.sctp.port = orig->dst.u.sctp.port; | 161 | tuple->src.u.sctp.port = orig->dst.u.sctp.port; |
174 | tuple->dst.u.sctp.port = orig->src.u.sctp.port; | 162 | tuple->dst.u.sctp.port = orig->src.u.sctp.port; |
175 | return 1; | 163 | return 1; |
@@ -179,9 +167,6 @@ static int sctp_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
179 | static int sctp_print_tuple(struct seq_file *s, | 167 | static int sctp_print_tuple(struct seq_file *s, |
180 | const struct nf_conntrack_tuple *tuple) | 168 | const struct nf_conntrack_tuple *tuple) |
181 | { | 169 | { |
182 | DEBUGP(__FUNCTION__); | ||
183 | DEBUGP("\n"); | ||
184 | |||
185 | return seq_printf(s, "sport=%hu dport=%hu ", | 170 | return seq_printf(s, "sport=%hu dport=%hu ", |
186 | ntohs(tuple->src.u.sctp.port), | 171 | ntohs(tuple->src.u.sctp.port), |
187 | ntohs(tuple->dst.u.sctp.port)); | 172 | ntohs(tuple->dst.u.sctp.port)); |
@@ -193,9 +178,6 @@ static int sctp_print_conntrack(struct seq_file *s, | |||
193 | { | 178 | { |
194 | enum sctp_conntrack state; | 179 | enum sctp_conntrack state; |
195 | 180 | ||
196 | DEBUGP(__FUNCTION__); | ||
197 | DEBUGP("\n"); | ||
198 | |||
199 | read_lock_bh(&sctp_lock); | 181 | read_lock_bh(&sctp_lock); |
200 | state = conntrack->proto.sctp.state; | 182 | state = conntrack->proto.sctp.state; |
201 | read_unlock_bh(&sctp_lock); | 183 | read_unlock_bh(&sctp_lock); |
@@ -219,13 +201,10 @@ static int do_basic_checks(struct nf_conn *conntrack, | |||
219 | sctp_chunkhdr_t _sch, *sch; | 201 | sctp_chunkhdr_t _sch, *sch; |
220 | int flag; | 202 | int flag; |
221 | 203 | ||
222 | DEBUGP(__FUNCTION__); | ||
223 | DEBUGP("\n"); | ||
224 | |||
225 | flag = 0; | 204 | flag = 0; |
226 | 205 | ||
227 | for_each_sctp_chunk (skb, sch, _sch, offset, dataoff, count) { | 206 | for_each_sctp_chunk (skb, sch, _sch, offset, dataoff, count) { |
228 | DEBUGP("Chunk Num: %d Type: %d\n", count, sch->type); | 207 | pr_debug("Chunk Num: %d Type: %d\n", count, sch->type); |
229 | 208 | ||
230 | if (sch->type == SCTP_CID_INIT | 209 | if (sch->type == SCTP_CID_INIT |
231 | || sch->type == SCTP_CID_INIT_ACK | 210 | || sch->type == SCTP_CID_INIT_ACK |
@@ -242,7 +221,7 @@ static int do_basic_checks(struct nf_conn *conntrack, | |||
242 | || sch->type == SCTP_CID_COOKIE_ECHO | 221 | || sch->type == SCTP_CID_COOKIE_ECHO |
243 | || flag) | 222 | || flag) |
244 | && count !=0) || !sch->length) { | 223 | && count !=0) || !sch->length) { |
245 | DEBUGP("Basic checks failed\n"); | 224 | pr_debug("Basic checks failed\n"); |
246 | return 1; | 225 | return 1; |
247 | } | 226 | } |
248 | 227 | ||
@@ -251,7 +230,7 @@ static int do_basic_checks(struct nf_conn *conntrack, | |||
251 | } | 230 | } |
252 | } | 231 | } |
253 | 232 | ||
254 | DEBUGP("Basic checks passed\n"); | 233 | pr_debug("Basic checks passed\n"); |
255 | return count == 0; | 234 | return count == 0; |
256 | } | 235 | } |
257 | 236 | ||
@@ -261,50 +240,47 @@ static int new_state(enum ip_conntrack_dir dir, | |||
261 | { | 240 | { |
262 | int i; | 241 | int i; |
263 | 242 | ||
264 | DEBUGP(__FUNCTION__); | 243 | pr_debug("Chunk type: %d\n", chunk_type); |
265 | DEBUGP("\n"); | ||
266 | |||
267 | DEBUGP("Chunk type: %d\n", chunk_type); | ||
268 | 244 | ||
269 | switch (chunk_type) { | 245 | switch (chunk_type) { |
270 | case SCTP_CID_INIT: | 246 | case SCTP_CID_INIT: |
271 | DEBUGP("SCTP_CID_INIT\n"); | 247 | pr_debug("SCTP_CID_INIT\n"); |
272 | i = 0; break; | 248 | i = 0; break; |
273 | case SCTP_CID_INIT_ACK: | 249 | case SCTP_CID_INIT_ACK: |
274 | DEBUGP("SCTP_CID_INIT_ACK\n"); | 250 | pr_debug("SCTP_CID_INIT_ACK\n"); |
275 | i = 1; break; | 251 | i = 1; break; |
276 | case SCTP_CID_ABORT: | 252 | case SCTP_CID_ABORT: |
277 | DEBUGP("SCTP_CID_ABORT\n"); | 253 | pr_debug("SCTP_CID_ABORT\n"); |
278 | i = 2; break; | 254 | i = 2; break; |
279 | case SCTP_CID_SHUTDOWN: | 255 | case SCTP_CID_SHUTDOWN: |
280 | DEBUGP("SCTP_CID_SHUTDOWN\n"); | 256 | pr_debug("SCTP_CID_SHUTDOWN\n"); |
281 | i = 3; break; | 257 | i = 3; break; |
282 | case SCTP_CID_SHUTDOWN_ACK: | 258 | case SCTP_CID_SHUTDOWN_ACK: |
283 | DEBUGP("SCTP_CID_SHUTDOWN_ACK\n"); | 259 | pr_debug("SCTP_CID_SHUTDOWN_ACK\n"); |
284 | i = 4; break; | 260 | i = 4; break; |
285 | case SCTP_CID_ERROR: | 261 | case SCTP_CID_ERROR: |
286 | DEBUGP("SCTP_CID_ERROR\n"); | 262 | pr_debug("SCTP_CID_ERROR\n"); |
287 | i = 5; break; | 263 | i = 5; break; |
288 | case SCTP_CID_COOKIE_ECHO: | 264 | case SCTP_CID_COOKIE_ECHO: |
289 | DEBUGP("SCTP_CID_COOKIE_ECHO\n"); | 265 | pr_debug("SCTP_CID_COOKIE_ECHO\n"); |
290 | i = 6; break; | 266 | i = 6; break; |
291 | case SCTP_CID_COOKIE_ACK: | 267 | case SCTP_CID_COOKIE_ACK: |
292 | DEBUGP("SCTP_CID_COOKIE_ACK\n"); | 268 | pr_debug("SCTP_CID_COOKIE_ACK\n"); |
293 | i = 7; break; | 269 | i = 7; break; |
294 | case SCTP_CID_SHUTDOWN_COMPLETE: | 270 | case SCTP_CID_SHUTDOWN_COMPLETE: |
295 | DEBUGP("SCTP_CID_SHUTDOWN_COMPLETE\n"); | 271 | pr_debug("SCTP_CID_SHUTDOWN_COMPLETE\n"); |
296 | i = 8; break; | 272 | i = 8; break; |
297 | default: | 273 | default: |
298 | /* Other chunks like DATA, SACK, HEARTBEAT and | 274 | /* Other chunks like DATA, SACK, HEARTBEAT and |
299 | its ACK do not cause a change in state */ | 275 | its ACK do not cause a change in state */ |
300 | DEBUGP("Unknown chunk type, Will stay in %s\n", | 276 | pr_debug("Unknown chunk type, Will stay in %s\n", |
301 | sctp_conntrack_names[cur_state]); | 277 | sctp_conntrack_names[cur_state]); |
302 | return cur_state; | 278 | return cur_state; |
303 | } | 279 | } |
304 | 280 | ||
305 | DEBUGP("dir: %d cur_state: %s chunk_type: %d new_state: %s\n", | 281 | pr_debug("dir: %d cur_state: %s chunk_type: %d new_state: %s\n", |
306 | dir, sctp_conntrack_names[cur_state], chunk_type, | 282 | dir, sctp_conntrack_names[cur_state], chunk_type, |
307 | sctp_conntrack_names[sctp_conntracks[dir][i][cur_state]]); | 283 | sctp_conntrack_names[sctp_conntracks[dir][i][cur_state]]); |
308 | 284 | ||
309 | return sctp_conntracks[dir][i][cur_state]; | 285 | return sctp_conntracks[dir][i][cur_state]; |
310 | } | 286 | } |
@@ -323,9 +299,6 @@ static int sctp_packet(struct nf_conn *conntrack, | |||
323 | u_int32_t offset, count; | 299 | u_int32_t offset, count; |
324 | char map[256 / sizeof (char)] = {0}; | 300 | char map[256 / sizeof (char)] = {0}; |
325 | 301 | ||
326 | DEBUGP(__FUNCTION__); | ||
327 | DEBUGP("\n"); | ||
328 | |||
329 | sh = skb_header_pointer(skb, dataoff, sizeof(_sctph), &_sctph); | 302 | sh = skb_header_pointer(skb, dataoff, sizeof(_sctph), &_sctph); |
330 | if (sh == NULL) | 303 | if (sh == NULL) |
331 | return -1; | 304 | return -1; |
@@ -340,7 +313,7 @@ static int sctp_packet(struct nf_conn *conntrack, | |||
340 | && !test_bit(SCTP_CID_ABORT, (void *)map) | 313 | && !test_bit(SCTP_CID_ABORT, (void *)map) |
341 | && !test_bit(SCTP_CID_SHUTDOWN_ACK, (void *)map) | 314 | && !test_bit(SCTP_CID_SHUTDOWN_ACK, (void *)map) |
342 | && (sh->vtag != conntrack->proto.sctp.vtag[CTINFO2DIR(ctinfo)])) { | 315 | && (sh->vtag != conntrack->proto.sctp.vtag[CTINFO2DIR(ctinfo)])) { |
343 | DEBUGP("Verification tag check failed\n"); | 316 | pr_debug("Verification tag check failed\n"); |
344 | return -1; | 317 | return -1; |
345 | } | 318 | } |
346 | 319 | ||
@@ -385,8 +358,9 @@ static int sctp_packet(struct nf_conn *conntrack, | |||
385 | 358 | ||
386 | /* Invalid */ | 359 | /* Invalid */ |
387 | if (newconntrack == SCTP_CONNTRACK_MAX) { | 360 | if (newconntrack == SCTP_CONNTRACK_MAX) { |
388 | DEBUGP("nf_conntrack_sctp: Invalid dir=%i ctype=%u conntrack=%u\n", | 361 | pr_debug("nf_conntrack_sctp: Invalid dir=%i ctype=%u " |
389 | CTINFO2DIR(ctinfo), sch->type, oldsctpstate); | 362 | "conntrack=%u\n", |
363 | CTINFO2DIR(ctinfo), sch->type, oldsctpstate); | ||
390 | write_unlock_bh(&sctp_lock); | 364 | write_unlock_bh(&sctp_lock); |
391 | return -1; | 365 | return -1; |
392 | } | 366 | } |
@@ -402,8 +376,8 @@ static int sctp_packet(struct nf_conn *conntrack, | |||
402 | write_unlock_bh(&sctp_lock); | 376 | write_unlock_bh(&sctp_lock); |
403 | return -1; | 377 | return -1; |
404 | } | 378 | } |
405 | DEBUGP("Setting vtag %x for dir %d\n", | 379 | pr_debug("Setting vtag %x for dir %d\n", |
406 | ih->init_tag, !CTINFO2DIR(ctinfo)); | 380 | ih->init_tag, !CTINFO2DIR(ctinfo)); |
407 | conntrack->proto.sctp.vtag[!CTINFO2DIR(ctinfo)] = ih->init_tag; | 381 | conntrack->proto.sctp.vtag[!CTINFO2DIR(ctinfo)] = ih->init_tag; |
408 | } | 382 | } |
409 | 383 | ||
@@ -418,7 +392,7 @@ static int sctp_packet(struct nf_conn *conntrack, | |||
418 | if (oldsctpstate == SCTP_CONNTRACK_COOKIE_ECHOED | 392 | if (oldsctpstate == SCTP_CONNTRACK_COOKIE_ECHOED |
419 | && CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY | 393 | && CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY |
420 | && newconntrack == SCTP_CONNTRACK_ESTABLISHED) { | 394 | && newconntrack == SCTP_CONNTRACK_ESTABLISHED) { |
421 | DEBUGP("Setting assured bit\n"); | 395 | pr_debug("Setting assured bit\n"); |
422 | set_bit(IPS_ASSURED_BIT, &conntrack->status); | 396 | set_bit(IPS_ASSURED_BIT, &conntrack->status); |
423 | nf_conntrack_event_cache(IPCT_STATUS, skb); | 397 | nf_conntrack_event_cache(IPCT_STATUS, skb); |
424 | } | 398 | } |
@@ -436,9 +410,6 @@ static int sctp_new(struct nf_conn *conntrack, const struct sk_buff *skb, | |||
436 | u_int32_t offset, count; | 410 | u_int32_t offset, count; |
437 | char map[256 / sizeof (char)] = {0}; | 411 | char map[256 / sizeof (char)] = {0}; |
438 | 412 | ||
439 | DEBUGP(__FUNCTION__); | ||
440 | DEBUGP("\n"); | ||
441 | |||
442 | sh = skb_header_pointer(skb, dataoff, sizeof(_sctph), &_sctph); | 413 | sh = skb_header_pointer(skb, dataoff, sizeof(_sctph), &_sctph); |
443 | if (sh == NULL) | 414 | if (sh == NULL) |
444 | return 0; | 415 | return 0; |
@@ -461,7 +432,7 @@ static int sctp_new(struct nf_conn *conntrack, const struct sk_buff *skb, | |||
461 | 432 | ||
462 | /* Invalid: delete conntrack */ | 433 | /* Invalid: delete conntrack */ |
463 | if (newconntrack == SCTP_CONNTRACK_MAX) { | 434 | if (newconntrack == SCTP_CONNTRACK_MAX) { |
464 | DEBUGP("nf_conntrack_sctp: invalid new deleting.\n"); | 435 | pr_debug("nf_conntrack_sctp: invalid new deleting.\n"); |
465 | return 0; | 436 | return 0; |
466 | } | 437 | } |
467 | 438 | ||
@@ -475,8 +446,8 @@ static int sctp_new(struct nf_conn *conntrack, const struct sk_buff *skb, | |||
475 | if (ih == NULL) | 446 | if (ih == NULL) |
476 | return 0; | 447 | return 0; |
477 | 448 | ||
478 | DEBUGP("Setting vtag %x for new conn\n", | 449 | pr_debug("Setting vtag %x for new conn\n", |
479 | ih->init_tag); | 450 | ih->init_tag); |
480 | 451 | ||
481 | conntrack->proto.sctp.vtag[IP_CT_DIR_REPLY] = | 452 | conntrack->proto.sctp.vtag[IP_CT_DIR_REPLY] = |
482 | ih->init_tag; | 453 | ih->init_tag; |
@@ -488,8 +459,8 @@ static int sctp_new(struct nf_conn *conntrack, const struct sk_buff *skb, | |||
488 | /* If it is a shutdown ack OOTB packet, we expect a return | 459 | /* If it is a shutdown ack OOTB packet, we expect a return |
489 | shutdown complete, otherwise an ABORT Sec 8.4 (5) and (8) */ | 460 | shutdown complete, otherwise an ABORT Sec 8.4 (5) and (8) */ |
490 | else { | 461 | else { |
491 | DEBUGP("Setting vtag %x for new conn OOTB\n", | 462 | pr_debug("Setting vtag %x for new conn OOTB\n", |
492 | sh->vtag); | 463 | sh->vtag); |
493 | conntrack->proto.sctp.vtag[IP_CT_DIR_REPLY] = sh->vtag; | 464 | conntrack->proto.sctp.vtag[IP_CT_DIR_REPLY] = sh->vtag; |
494 | } | 465 | } |
495 | 466 | ||
@@ -688,8 +659,6 @@ int __init nf_conntrack_proto_sctp_init(void) | |||
688 | cleanup_sctp4: | 659 | cleanup_sctp4: |
689 | nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_sctp4); | 660 | nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_sctp4); |
690 | out: | 661 | out: |
691 | DEBUGP("SCTP conntrack module loading %s\n", | ||
692 | ret ? "failed": "succeeded"); | ||
693 | return ret; | 662 | return ret; |
694 | } | 663 | } |
695 | 664 | ||
@@ -697,7 +666,6 @@ void __exit nf_conntrack_proto_sctp_fini(void) | |||
697 | { | 666 | { |
698 | nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_sctp6); | 667 | nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_sctp6); |
699 | nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_sctp4); | 668 | nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_sctp4); |
700 | DEBUGP("SCTP conntrack module unloaded\n"); | ||
701 | } | 669 | } |
702 | 670 | ||
703 | module_init(nf_conntrack_proto_sctp_init); | 671 | module_init(nf_conntrack_proto_sctp_init); |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index ccdd5d231e0d..1c8206e6560a 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -26,13 +26,6 @@ | |||
26 | #include <net/netfilter/nf_conntrack_l4proto.h> | 26 | #include <net/netfilter/nf_conntrack_l4proto.h> |
27 | #include <net/netfilter/nf_conntrack_ecache.h> | 27 | #include <net/netfilter/nf_conntrack_ecache.h> |
28 | 28 | ||
29 | #if 0 | ||
30 | #define DEBUGP printk | ||
31 | #define DEBUGP_VARS | ||
32 | #else | ||
33 | #define DEBUGP(format, args...) | ||
34 | #endif | ||
35 | |||
36 | /* Protects conntrack->proto.tcp */ | 29 | /* Protects conntrack->proto.tcp */ |
37 | static DEFINE_RWLOCK(tcp_lock); | 30 | static DEFINE_RWLOCK(tcp_lock); |
38 | 31 | ||
@@ -496,7 +489,8 @@ static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff, | |||
496 | } | 489 | } |
497 | } | 490 | } |
498 | 491 | ||
499 | static int tcp_in_window(struct ip_ct_tcp *state, | 492 | static int tcp_in_window(struct nf_conn *ct, |
493 | struct ip_ct_tcp *state, | ||
500 | enum ip_conntrack_dir dir, | 494 | enum ip_conntrack_dir dir, |
501 | unsigned int index, | 495 | unsigned int index, |
502 | const struct sk_buff *skb, | 496 | const struct sk_buff *skb, |
@@ -506,6 +500,7 @@ static int tcp_in_window(struct ip_ct_tcp *state, | |||
506 | { | 500 | { |
507 | struct ip_ct_tcp_state *sender = &state->seen[dir]; | 501 | struct ip_ct_tcp_state *sender = &state->seen[dir]; |
508 | struct ip_ct_tcp_state *receiver = &state->seen[!dir]; | 502 | struct ip_ct_tcp_state *receiver = &state->seen[!dir]; |
503 | struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple; | ||
509 | __u32 seq, ack, sack, end, win, swin; | 504 | __u32 seq, ack, sack, end, win, swin; |
510 | int res; | 505 | int res; |
511 | 506 | ||
@@ -520,18 +515,17 @@ static int tcp_in_window(struct ip_ct_tcp *state, | |||
520 | if (receiver->flags & IP_CT_TCP_FLAG_SACK_PERM) | 515 | if (receiver->flags & IP_CT_TCP_FLAG_SACK_PERM) |
521 | tcp_sack(skb, dataoff, tcph, &sack); | 516 | tcp_sack(skb, dataoff, tcph, &sack); |
522 | 517 | ||
523 | DEBUGP("tcp_in_window: START\n"); | 518 | pr_debug("tcp_in_window: START\n"); |
524 | DEBUGP("tcp_in_window: src=%u.%u.%u.%u:%hu dst=%u.%u.%u.%u:%hu " | 519 | pr_debug("tcp_in_window: "); |
525 | "seq=%u ack=%u sack=%u win=%u end=%u\n", | 520 | NF_CT_DUMP_TUPLE(tuple); |
526 | NIPQUAD(iph->saddr), ntohs(tcph->source), | 521 | pr_debug("seq=%u ack=%u sack=%u win=%u end=%u\n", |
527 | NIPQUAD(iph->daddr), ntohs(tcph->dest), | 522 | seq, ack, sack, win, end); |
528 | seq, ack, sack, win, end); | 523 | pr_debug("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i " |
529 | DEBUGP("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i " | 524 | "receiver end=%u maxend=%u maxwin=%u scale=%i\n", |
530 | "receiver end=%u maxend=%u maxwin=%u scale=%i\n", | 525 | sender->td_end, sender->td_maxend, sender->td_maxwin, |
531 | sender->td_end, sender->td_maxend, sender->td_maxwin, | 526 | sender->td_scale, |
532 | sender->td_scale, | 527 | receiver->td_end, receiver->td_maxend, receiver->td_maxwin, |
533 | receiver->td_end, receiver->td_maxend, receiver->td_maxwin, | 528 | receiver->td_scale); |
534 | receiver->td_scale); | ||
535 | 529 | ||
536 | if (sender->td_end == 0) { | 530 | if (sender->td_end == 0) { |
537 | /* | 531 | /* |
@@ -609,23 +603,22 @@ static int tcp_in_window(struct ip_ct_tcp *state, | |||
609 | */ | 603 | */ |
610 | seq = end = sender->td_end; | 604 | seq = end = sender->td_end; |
611 | 605 | ||
612 | DEBUGP("tcp_in_window: src=%u.%u.%u.%u:%hu dst=%u.%u.%u.%u:%hu " | 606 | pr_debug("tcp_in_window: "); |
613 | "seq=%u ack=%u sack =%u win=%u end=%u\n", | 607 | NF_CT_DUMP_TUPLE(tuple); |
614 | NIPQUAD(iph->saddr), ntohs(tcph->source), | 608 | pr_debug("seq=%u ack=%u sack =%u win=%u end=%u\n", |
615 | NIPQUAD(iph->daddr), ntohs(tcph->dest), | 609 | seq, ack, sack, win, end); |
616 | seq, ack, sack, win, end); | 610 | pr_debug("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i " |
617 | DEBUGP("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i " | 611 | "receiver end=%u maxend=%u maxwin=%u scale=%i\n", |
618 | "receiver end=%u maxend=%u maxwin=%u scale=%i\n", | 612 | sender->td_end, sender->td_maxend, sender->td_maxwin, |
619 | sender->td_end, sender->td_maxend, sender->td_maxwin, | 613 | sender->td_scale, |
620 | sender->td_scale, | 614 | receiver->td_end, receiver->td_maxend, receiver->td_maxwin, |
621 | receiver->td_end, receiver->td_maxend, receiver->td_maxwin, | 615 | receiver->td_scale); |
622 | receiver->td_scale); | 616 | |
623 | 617 | pr_debug("tcp_in_window: I=%i II=%i III=%i IV=%i\n", | |
624 | DEBUGP("tcp_in_window: I=%i II=%i III=%i IV=%i\n", | 618 | before(seq, sender->td_maxend + 1), |
625 | before(seq, sender->td_maxend + 1), | 619 | after(end, sender->td_end - receiver->td_maxwin - 1), |
626 | after(end, sender->td_end - receiver->td_maxwin - 1), | 620 | before(sack, receiver->td_end + 1), |
627 | before(sack, receiver->td_end + 1), | 621 | after(ack, receiver->td_end - MAXACKWINDOW(sender))); |
628 | after(ack, receiver->td_end - MAXACKWINDOW(sender))); | ||
629 | 622 | ||
630 | if (before(seq, sender->td_maxend + 1) && | 623 | if (before(seq, sender->td_maxend + 1) && |
631 | after(end, sender->td_end - receiver->td_maxwin - 1) && | 624 | after(end, sender->td_end - receiver->td_maxwin - 1) && |
@@ -694,10 +687,10 @@ static int tcp_in_window(struct ip_ct_tcp *state, | |||
694 | : "SEQ is over the upper bound (over the window of the receiver)"); | 687 | : "SEQ is over the upper bound (over the window of the receiver)"); |
695 | } | 688 | } |
696 | 689 | ||
697 | DEBUGP("tcp_in_window: res=%i sender end=%u maxend=%u maxwin=%u " | 690 | pr_debug("tcp_in_window: res=%i sender end=%u maxend=%u maxwin=%u " |
698 | "receiver end=%u maxend=%u maxwin=%u\n", | 691 | "receiver end=%u maxend=%u maxwin=%u\n", |
699 | res, sender->td_end, sender->td_maxend, sender->td_maxwin, | 692 | res, sender->td_end, sender->td_maxend, sender->td_maxwin, |
700 | receiver->td_end, receiver->td_maxend, receiver->td_maxwin); | 693 | receiver->td_end, receiver->td_maxend, receiver->td_maxwin); |
701 | 694 | ||
702 | return res; | 695 | return res; |
703 | } | 696 | } |
@@ -711,11 +704,9 @@ void nf_conntrack_tcp_update(struct sk_buff *skb, | |||
711 | int dir) | 704 | int dir) |
712 | { | 705 | { |
713 | struct tcphdr *tcph = (void *)skb->data + dataoff; | 706 | struct tcphdr *tcph = (void *)skb->data + dataoff; |
714 | __u32 end; | ||
715 | #ifdef DEBUGP_VARS | ||
716 | struct ip_ct_tcp_state *sender = &conntrack->proto.tcp.seen[dir]; | 707 | struct ip_ct_tcp_state *sender = &conntrack->proto.tcp.seen[dir]; |
717 | struct ip_ct_tcp_state *receiver = &conntrack->proto.tcp.seen[!dir]; | 708 | struct ip_ct_tcp_state *receiver = &conntrack->proto.tcp.seen[!dir]; |
718 | #endif | 709 | __u32 end; |
719 | 710 | ||
720 | end = segment_seq_plus_len(ntohl(tcph->seq), skb->len, dataoff, tcph); | 711 | end = segment_seq_plus_len(ntohl(tcph->seq), skb->len, dataoff, tcph); |
721 | 712 | ||
@@ -727,12 +718,12 @@ void nf_conntrack_tcp_update(struct sk_buff *skb, | |||
727 | conntrack->proto.tcp.seen[dir].td_end = end; | 718 | conntrack->proto.tcp.seen[dir].td_end = end; |
728 | conntrack->proto.tcp.last_end = end; | 719 | conntrack->proto.tcp.last_end = end; |
729 | write_unlock_bh(&tcp_lock); | 720 | write_unlock_bh(&tcp_lock); |
730 | DEBUGP("tcp_update: sender end=%u maxend=%u maxwin=%u scale=%i " | 721 | pr_debug("tcp_update: sender end=%u maxend=%u maxwin=%u scale=%i " |
731 | "receiver end=%u maxend=%u maxwin=%u scale=%i\n", | 722 | "receiver end=%u maxend=%u maxwin=%u scale=%i\n", |
732 | sender->td_end, sender->td_maxend, sender->td_maxwin, | 723 | sender->td_end, sender->td_maxend, sender->td_maxwin, |
733 | sender->td_scale, | 724 | sender->td_scale, |
734 | receiver->td_end, receiver->td_maxend, receiver->td_maxwin, | 725 | receiver->td_end, receiver->td_maxend, receiver->td_maxwin, |
735 | receiver->td_scale); | 726 | receiver->td_scale); |
736 | } | 727 | } |
737 | EXPORT_SYMBOL_GPL(nf_conntrack_tcp_update); | 728 | EXPORT_SYMBOL_GPL(nf_conntrack_tcp_update); |
738 | #endif | 729 | #endif |
@@ -823,6 +814,7 @@ static int tcp_packet(struct nf_conn *conntrack, | |||
823 | int pf, | 814 | int pf, |
824 | unsigned int hooknum) | 815 | unsigned int hooknum) |
825 | { | 816 | { |
817 | struct nf_conntrack_tuple *tuple; | ||
826 | enum tcp_conntrack new_state, old_state; | 818 | enum tcp_conntrack new_state, old_state; |
827 | enum ip_conntrack_dir dir; | 819 | enum ip_conntrack_dir dir; |
828 | struct tcphdr *th, _tcph; | 820 | struct tcphdr *th, _tcph; |
@@ -837,6 +829,7 @@ static int tcp_packet(struct nf_conn *conntrack, | |||
837 | dir = CTINFO2DIR(ctinfo); | 829 | dir = CTINFO2DIR(ctinfo); |
838 | index = get_conntrack_index(th); | 830 | index = get_conntrack_index(th); |
839 | new_state = tcp_conntracks[dir][index][old_state]; | 831 | new_state = tcp_conntracks[dir][index][old_state]; |
832 | tuple = &conntrack->tuplehash[dir].tuple; | ||
840 | 833 | ||
841 | switch (new_state) { | 834 | switch (new_state) { |
842 | case TCP_CONNTRACK_IGNORE: | 835 | case TCP_CONNTRACK_IGNORE: |
@@ -880,9 +873,8 @@ static int tcp_packet(struct nf_conn *conntrack, | |||
880 | return NF_ACCEPT; | 873 | return NF_ACCEPT; |
881 | case TCP_CONNTRACK_MAX: | 874 | case TCP_CONNTRACK_MAX: |
882 | /* Invalid packet */ | 875 | /* Invalid packet */ |
883 | DEBUGP("nf_ct_tcp: Invalid dir=%i index=%u ostate=%u\n", | 876 | pr_debug("nf_ct_tcp: Invalid dir=%i index=%u ostate=%u\n", |
884 | dir, get_conntrack_index(th), | 877 | dir, get_conntrack_index(th), old_state); |
885 | old_state); | ||
886 | write_unlock_bh(&tcp_lock); | 878 | write_unlock_bh(&tcp_lock); |
887 | if (LOG_INVALID(IPPROTO_TCP)) | 879 | if (LOG_INVALID(IPPROTO_TCP)) |
888 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 880 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
@@ -933,7 +925,7 @@ static int tcp_packet(struct nf_conn *conntrack, | |||
933 | break; | 925 | break; |
934 | } | 926 | } |
935 | 927 | ||
936 | if (!tcp_in_window(&conntrack->proto.tcp, dir, index, | 928 | if (!tcp_in_window(conntrack, &conntrack->proto.tcp, dir, index, |
937 | skb, dataoff, th, pf)) { | 929 | skb, dataoff, th, pf)) { |
938 | write_unlock_bh(&tcp_lock); | 930 | write_unlock_bh(&tcp_lock); |
939 | return -NF_ACCEPT; | 931 | return -NF_ACCEPT; |
@@ -942,13 +934,12 @@ static int tcp_packet(struct nf_conn *conntrack, | |||
942 | /* From now on we have got in-window packets */ | 934 | /* From now on we have got in-window packets */ |
943 | conntrack->proto.tcp.last_index = index; | 935 | conntrack->proto.tcp.last_index = index; |
944 | 936 | ||
945 | DEBUGP("tcp_conntracks: src=%u.%u.%u.%u:%hu dst=%u.%u.%u.%u:%hu " | 937 | pr_debug("tcp_conntracks: "); |
946 | "syn=%i ack=%i fin=%i rst=%i old=%i new=%i\n", | 938 | NF_CT_DUMP_TUPLE(tuple); |
947 | NIPQUAD(iph->saddr), ntohs(th->source), | 939 | pr_debug("syn=%i ack=%i fin=%i rst=%i old=%i new=%i\n", |
948 | NIPQUAD(iph->daddr), ntohs(th->dest), | 940 | (th->syn ? 1 : 0), (th->ack ? 1 : 0), |
949 | (th->syn ? 1 : 0), (th->ack ? 1 : 0), | 941 | (th->fin ? 1 : 0), (th->rst ? 1 : 0), |
950 | (th->fin ? 1 : 0), (th->rst ? 1 : 0), | 942 | old_state, new_state); |
951 | old_state, new_state); | ||
952 | 943 | ||
953 | conntrack->proto.tcp.state = new_state; | 944 | conntrack->proto.tcp.state = new_state; |
954 | if (old_state != new_state | 945 | if (old_state != new_state |
@@ -997,10 +988,8 @@ static int tcp_new(struct nf_conn *conntrack, | |||
997 | { | 988 | { |
998 | enum tcp_conntrack new_state; | 989 | enum tcp_conntrack new_state; |
999 | struct tcphdr *th, _tcph; | 990 | struct tcphdr *th, _tcph; |
1000 | #ifdef DEBUGP_VARS | ||
1001 | struct ip_ct_tcp_state *sender = &conntrack->proto.tcp.seen[0]; | 991 | struct ip_ct_tcp_state *sender = &conntrack->proto.tcp.seen[0]; |
1002 | struct ip_ct_tcp_state *receiver = &conntrack->proto.tcp.seen[1]; | 992 | struct ip_ct_tcp_state *receiver = &conntrack->proto.tcp.seen[1]; |
1003 | #endif | ||
1004 | 993 | ||
1005 | th = skb_header_pointer(skb, dataoff, sizeof(_tcph), &_tcph); | 994 | th = skb_header_pointer(skb, dataoff, sizeof(_tcph), &_tcph); |
1006 | BUG_ON(th == NULL); | 995 | BUG_ON(th == NULL); |
@@ -1012,7 +1001,7 @@ static int tcp_new(struct nf_conn *conntrack, | |||
1012 | 1001 | ||
1013 | /* Invalid: delete conntrack */ | 1002 | /* Invalid: delete conntrack */ |
1014 | if (new_state >= TCP_CONNTRACK_MAX) { | 1003 | if (new_state >= TCP_CONNTRACK_MAX) { |
1015 | DEBUGP("nf_ct_tcp: invalid new deleting.\n"); | 1004 | pr_debug("nf_ct_tcp: invalid new deleting.\n"); |
1016 | return 0; | 1005 | return 0; |
1017 | } | 1006 | } |
1018 | 1007 | ||
@@ -1065,12 +1054,12 @@ static int tcp_new(struct nf_conn *conntrack, | |||
1065 | conntrack->proto.tcp.state = TCP_CONNTRACK_NONE; | 1054 | conntrack->proto.tcp.state = TCP_CONNTRACK_NONE; |
1066 | conntrack->proto.tcp.last_index = TCP_NONE_SET; | 1055 | conntrack->proto.tcp.last_index = TCP_NONE_SET; |
1067 | 1056 | ||
1068 | DEBUGP("tcp_new: sender end=%u maxend=%u maxwin=%u scale=%i " | 1057 | pr_debug("tcp_new: sender end=%u maxend=%u maxwin=%u scale=%i " |
1069 | "receiver end=%u maxend=%u maxwin=%u scale=%i\n", | 1058 | "receiver end=%u maxend=%u maxwin=%u scale=%i\n", |
1070 | sender->td_end, sender->td_maxend, sender->td_maxwin, | 1059 | sender->td_end, sender->td_maxend, sender->td_maxwin, |
1071 | sender->td_scale, | 1060 | sender->td_scale, |
1072 | receiver->td_end, receiver->td_maxend, receiver->td_maxwin, | 1061 | receiver->td_end, receiver->td_maxend, receiver->td_maxwin, |
1073 | receiver->td_scale); | 1062 | receiver->td_scale); |
1074 | return 1; | 1063 | return 1; |
1075 | } | 1064 | } |
1076 | 1065 | ||
diff --git a/net/netfilter/nf_conntrack_sane.c b/net/netfilter/nf_conntrack_sane.c index 627eda79d154..355d371bac93 100644 --- a/net/netfilter/nf_conntrack_sane.c +++ b/net/netfilter/nf_conntrack_sane.c | |||
@@ -40,12 +40,6 @@ static u_int16_t ports[MAX_PORTS]; | |||
40 | static unsigned int ports_c; | 40 | static unsigned int ports_c; |
41 | module_param_array(ports, ushort, &ports_c, 0400); | 41 | module_param_array(ports, ushort, &ports_c, 0400); |
42 | 42 | ||
43 | #if 0 | ||
44 | #define DEBUGP printk | ||
45 | #else | ||
46 | #define DEBUGP(format, args...) | ||
47 | #endif | ||
48 | |||
49 | struct sane_request { | 43 | struct sane_request { |
50 | __be32 RPC_code; | 44 | __be32 RPC_code; |
51 | #define SANE_NET_START 7 /* RPC code */ | 45 | #define SANE_NET_START 7 /* RPC code */ |
@@ -125,15 +119,15 @@ static int help(struct sk_buff **pskb, | |||
125 | ct_sane_info->state = SANE_STATE_NORMAL; | 119 | ct_sane_info->state = SANE_STATE_NORMAL; |
126 | 120 | ||
127 | if (datalen < sizeof(struct sane_reply_net_start)) { | 121 | if (datalen < sizeof(struct sane_reply_net_start)) { |
128 | DEBUGP("nf_ct_sane: NET_START reply too short\n"); | 122 | pr_debug("nf_ct_sane: NET_START reply too short\n"); |
129 | goto out; | 123 | goto out; |
130 | } | 124 | } |
131 | 125 | ||
132 | reply = (struct sane_reply_net_start *)sb_ptr; | 126 | reply = (struct sane_reply_net_start *)sb_ptr; |
133 | if (reply->status != htonl(SANE_STATUS_SUCCESS)) { | 127 | if (reply->status != htonl(SANE_STATUS_SUCCESS)) { |
134 | /* saned refused the command */ | 128 | /* saned refused the command */ |
135 | DEBUGP("nf_ct_sane: unsuccessful SANE_STATUS = %u\n", | 129 | pr_debug("nf_ct_sane: unsuccessful SANE_STATUS = %u\n", |
136 | ntohl(reply->status)); | 130 | ntohl(reply->status)); |
137 | goto out; | 131 | goto out; |
138 | } | 132 | } |
139 | 133 | ||
@@ -151,9 +145,8 @@ static int help(struct sk_buff **pskb, | |||
151 | nf_ct_expect_init(exp, family, &tuple->src.u3, &tuple->dst.u3, | 145 | nf_ct_expect_init(exp, family, &tuple->src.u3, &tuple->dst.u3, |
152 | IPPROTO_TCP, NULL, &reply->port); | 146 | IPPROTO_TCP, NULL, &reply->port); |
153 | 147 | ||
154 | DEBUGP("nf_ct_sane: expect: "); | 148 | pr_debug("nf_ct_sane: expect: "); |
155 | NF_CT_DUMP_TUPLE(&exp->tuple); | 149 | NF_CT_DUMP_TUPLE(&exp->tuple); |
156 | NF_CT_DUMP_TUPLE(&exp->mask); | ||
157 | 150 | ||
158 | /* Can't expect this? Best to drop packet now. */ | 151 | /* Can't expect this? Best to drop packet now. */ |
159 | if (nf_ct_expect_related(exp) != 0) | 152 | if (nf_ct_expect_related(exp) != 0) |
@@ -176,9 +169,9 @@ static void nf_conntrack_sane_fini(void) | |||
176 | 169 | ||
177 | for (i = 0; i < ports_c; i++) { | 170 | for (i = 0; i < ports_c; i++) { |
178 | for (j = 0; j < 2; j++) { | 171 | for (j = 0; j < 2; j++) { |
179 | DEBUGP("nf_ct_sane: unregistering helper for pf: %d " | 172 | pr_debug("nf_ct_sane: unregistering helper for pf: %d " |
180 | "port: %d\n", | 173 | "port: %d\n", |
181 | sane[i][j].tuple.src.l3num, ports[i]); | 174 | sane[i][j].tuple.src.l3num, ports[i]); |
182 | nf_conntrack_helper_unregister(&sane[i][j]); | 175 | nf_conntrack_helper_unregister(&sane[i][j]); |
183 | } | 176 | } |
184 | } | 177 | } |
@@ -217,9 +210,9 @@ static int __init nf_conntrack_sane_init(void) | |||
217 | sprintf(tmpname, "sane-%d", ports[i]); | 210 | sprintf(tmpname, "sane-%d", ports[i]); |
218 | sane[i][j].name = tmpname; | 211 | sane[i][j].name = tmpname; |
219 | 212 | ||
220 | DEBUGP("nf_ct_sane: registering helper for pf: %d " | 213 | pr_debug("nf_ct_sane: registering helper for pf: %d " |
221 | "port: %d\n", | 214 | "port: %d\n", |
222 | sane[i][j].tuple.src.l3num, ports[i]); | 215 | sane[i][j].tuple.src.l3num, ports[i]); |
223 | ret = nf_conntrack_helper_register(&sane[i][j]); | 216 | ret = nf_conntrack_helper_register(&sane[i][j]); |
224 | if (ret) { | 217 | if (ret) { |
225 | printk(KERN_ERR "nf_ct_sane: failed to " | 218 | printk(KERN_ERR "nf_ct_sane: failed to " |
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c index 5b78f0e1f63b..1276a442f10c 100644 --- a/net/netfilter/nf_conntrack_sip.c +++ b/net/netfilter/nf_conntrack_sip.c | |||
@@ -21,12 +21,6 @@ | |||
21 | #include <net/netfilter/nf_conntrack_helper.h> | 21 | #include <net/netfilter/nf_conntrack_helper.h> |
22 | #include <linux/netfilter/nf_conntrack_sip.h> | 22 | #include <linux/netfilter/nf_conntrack_sip.h> |
23 | 23 | ||
24 | #if 0 | ||
25 | #define DEBUGP printk | ||
26 | #else | ||
27 | #define DEBUGP(format, args...) | ||
28 | #endif | ||
29 | |||
30 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
31 | MODULE_AUTHOR("Christian Hentschel <chentschel@arnet.com.ar>"); | 25 | MODULE_AUTHOR("Christian Hentschel <chentschel@arnet.com.ar>"); |
32 | MODULE_DESCRIPTION("SIP connection tracking helper"); | 26 | MODULE_DESCRIPTION("SIP connection tracking helper"); |
@@ -285,7 +279,7 @@ static int epaddr_len(struct nf_conn *ct, const char *dptr, | |||
285 | const char *aux = dptr; | 279 | const char *aux = dptr; |
286 | 280 | ||
287 | if (!parse_addr(ct, dptr, &dptr, &addr, limit)) { | 281 | if (!parse_addr(ct, dptr, &dptr, &addr, limit)) { |
288 | DEBUGP("ip: %s parse failed.!\n", dptr); | 282 | pr_debug("ip: %s parse failed.!\n", dptr); |
289 | return 0; | 283 | return 0; |
290 | } | 284 | } |
291 | 285 | ||
@@ -344,8 +338,8 @@ int ct_sip_get_info(struct nf_conn *ct, | |||
344 | ct_sip_lnlen(dptr, limit), | 338 | ct_sip_lnlen(dptr, limit), |
345 | hnfo->case_sensitive); | 339 | hnfo->case_sensitive); |
346 | if (!aux) { | 340 | if (!aux) { |
347 | DEBUGP("'%s' not found in '%s'.\n", hnfo->ln_str, | 341 | pr_debug("'%s' not found in '%s'.\n", hnfo->ln_str, |
348 | hnfo->lname); | 342 | hnfo->lname); |
349 | return -1; | 343 | return -1; |
350 | } | 344 | } |
351 | aux += hnfo->ln_strlen; | 345 | aux += hnfo->ln_strlen; |
@@ -356,11 +350,11 @@ int ct_sip_get_info(struct nf_conn *ct, | |||
356 | 350 | ||
357 | *matchoff = (aux - k) + shift; | 351 | *matchoff = (aux - k) + shift; |
358 | 352 | ||
359 | DEBUGP("%s match succeeded! - len: %u\n", hnfo->lname, | 353 | pr_debug("%s match succeeded! - len: %u\n", hnfo->lname, |
360 | *matchlen); | 354 | *matchlen); |
361 | return 1; | 355 | return 1; |
362 | } | 356 | } |
363 | DEBUGP("%s header not found.\n", hnfo->lname); | 357 | pr_debug("%s header not found.\n", hnfo->lname); |
364 | return 0; | 358 | return 0; |
365 | } | 359 | } |
366 | EXPORT_SYMBOL_GPL(ct_sip_get_info); | 360 | EXPORT_SYMBOL_GPL(ct_sip_get_info); |
@@ -424,7 +418,7 @@ static int sip_help(struct sk_buff **pskb, | |||
424 | if (!skb_is_nonlinear(*pskb)) | 418 | if (!skb_is_nonlinear(*pskb)) |
425 | dptr = (*pskb)->data + dataoff; | 419 | dptr = (*pskb)->data + dataoff; |
426 | else { | 420 | else { |
427 | DEBUGP("Copy of skbuff not supported yet.\n"); | 421 | pr_debug("Copy of skbuff not supported yet.\n"); |
428 | goto out; | 422 | goto out; |
429 | } | 423 | } |
430 | 424 | ||
@@ -518,7 +512,7 @@ static int __init nf_conntrack_sip_init(void) | |||
518 | sprintf(tmpname, "sip-%u", i); | 512 | sprintf(tmpname, "sip-%u", i); |
519 | sip[i][j].name = tmpname; | 513 | sip[i][j].name = tmpname; |
520 | 514 | ||
521 | DEBUGP("port #%u: %u\n", i, ports[i]); | 515 | pr_debug("port #%u: %u\n", i, ports[i]); |
522 | 516 | ||
523 | ret = nf_conntrack_helper_register(&sip[i][j]); | 517 | ret = nf_conntrack_helper_register(&sip[i][j]); |
524 | if (ret) { | 518 | if (ret) { |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index 6af96c6e29fb..54498bcfa862 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -25,12 +25,6 @@ | |||
25 | #include <net/netfilter/nf_conntrack_expect.h> | 25 | #include <net/netfilter/nf_conntrack_expect.h> |
26 | #include <net/netfilter/nf_conntrack_helper.h> | 26 | #include <net/netfilter/nf_conntrack_helper.h> |
27 | 27 | ||
28 | #if 0 | ||
29 | #define DEBUGP printk | ||
30 | #else | ||
31 | #define DEBUGP(format, args...) | ||
32 | #endif | ||
33 | |||
34 | MODULE_LICENSE("GPL"); | 28 | MODULE_LICENSE("GPL"); |
35 | 29 | ||
36 | #ifdef CONFIG_PROC_FS | 30 | #ifdef CONFIG_PROC_FS |
diff --git a/net/netfilter/nf_conntrack_tftp.c b/net/netfilter/nf_conntrack_tftp.c index db0387cf9bac..cc19506cf2f8 100644 --- a/net/netfilter/nf_conntrack_tftp.c +++ b/net/netfilter/nf_conntrack_tftp.c | |||
@@ -29,13 +29,6 @@ static int ports_c; | |||
29 | module_param_array(ports, ushort, &ports_c, 0400); | 29 | module_param_array(ports, ushort, &ports_c, 0400); |
30 | MODULE_PARM_DESC(ports, "Port numbers of TFTP servers"); | 30 | MODULE_PARM_DESC(ports, "Port numbers of TFTP servers"); |
31 | 31 | ||
32 | #if 0 | ||
33 | #define DEBUGP(format, args...) printk("%s:%s:" format, \ | ||
34 | __FILE__, __FUNCTION__ , ## args) | ||
35 | #else | ||
36 | #define DEBUGP(format, args...) | ||
37 | #endif | ||
38 | |||
39 | unsigned int (*nf_nat_tftp_hook)(struct sk_buff **pskb, | 32 | unsigned int (*nf_nat_tftp_hook)(struct sk_buff **pskb, |
40 | enum ip_conntrack_info ctinfo, | 33 | enum ip_conntrack_info ctinfo, |
41 | struct nf_conntrack_expect *exp) __read_mostly; | 34 | struct nf_conntrack_expect *exp) __read_mostly; |
@@ -62,7 +55,6 @@ static int tftp_help(struct sk_buff **pskb, | |||
62 | case TFTP_OPCODE_READ: | 55 | case TFTP_OPCODE_READ: |
63 | case TFTP_OPCODE_WRITE: | 56 | case TFTP_OPCODE_WRITE: |
64 | /* RRQ and WRQ works the same way */ | 57 | /* RRQ and WRQ works the same way */ |
65 | DEBUGP(""); | ||
66 | NF_CT_DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); | 58 | NF_CT_DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); |
67 | NF_CT_DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); | 59 | NF_CT_DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); |
68 | 60 | ||
@@ -73,9 +65,8 @@ static int tftp_help(struct sk_buff **pskb, | |||
73 | nf_ct_expect_init(exp, family, &tuple->src.u3, &tuple->dst.u3, | 65 | nf_ct_expect_init(exp, family, &tuple->src.u3, &tuple->dst.u3, |
74 | IPPROTO_UDP, NULL, &tuple->dst.u.udp.port); | 66 | IPPROTO_UDP, NULL, &tuple->dst.u.udp.port); |
75 | 67 | ||
76 | DEBUGP("expect: "); | 68 | pr_debug("expect: "); |
77 | NF_CT_DUMP_TUPLE(&exp->tuple); | 69 | NF_CT_DUMP_TUPLE(&exp->tuple); |
78 | NF_CT_DUMP_TUPLE(&exp->mask); | ||
79 | 70 | ||
80 | nf_nat_tftp = rcu_dereference(nf_nat_tftp_hook); | 71 | nf_nat_tftp = rcu_dereference(nf_nat_tftp_hook); |
81 | if (nf_nat_tftp && ct->status & IPS_NAT_MASK) | 72 | if (nf_nat_tftp && ct->status & IPS_NAT_MASK) |
@@ -86,13 +77,13 @@ static int tftp_help(struct sk_buff **pskb, | |||
86 | break; | 77 | break; |
87 | case TFTP_OPCODE_DATA: | 78 | case TFTP_OPCODE_DATA: |
88 | case TFTP_OPCODE_ACK: | 79 | case TFTP_OPCODE_ACK: |
89 | DEBUGP("Data/ACK opcode\n"); | 80 | pr_debug("Data/ACK opcode\n"); |
90 | break; | 81 | break; |
91 | case TFTP_OPCODE_ERROR: | 82 | case TFTP_OPCODE_ERROR: |
92 | DEBUGP("Error opcode\n"); | 83 | pr_debug("Error opcode\n"); |
93 | break; | 84 | break; |
94 | default: | 85 | default: |
95 | DEBUGP("Unknown opcode\n"); | 86 | pr_debug("Unknown opcode\n"); |
96 | } | 87 | } |
97 | return ret; | 88 | return ret; |
98 | } | 89 | } |