diff options
author | Patrick McHardy <kaber@trash.net> | 2008-03-25 23:07:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-25 23:07:38 -0400 |
commit | ef27559b70bd5312dfcbeab3b9ab0296206413c4 (patch) | |
tree | 00f741d7113d1eda28b502ee76110c8384964a62 /include | |
parent | 30c69fed7d94c5c330a47fcc4833627644c19a5b (diff) |
[NETFILTER]: nf_conntrack: fix NF_CT_TUPLE_DUMP for IPv4
NF_CT_TUPLE_DUMP prints IPv4 addresses as IPv6, fix this and use printk
(guarded by #ifdef DEBUG) directly instead of pr_debug since the tuple
is usually printed at the end of line and we don't want to include a
log-level.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/netfilter/nf_conntrack_tuple.h | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index e69ab2e87597..d9b53dd601ad 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h | |||
@@ -113,11 +113,39 @@ struct nf_conntrack_tuple_mask | |||
113 | 113 | ||
114 | #ifdef __KERNEL__ | 114 | #ifdef __KERNEL__ |
115 | 115 | ||
116 | #define NF_CT_DUMP_TUPLE(tp) \ | 116 | static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t) |
117 | pr_debug("tuple %p: %u %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", \ | 117 | { |
118 | (tp), (tp)->src.l3num, (tp)->dst.protonum, \ | 118 | #ifdef DEBUG |
119 | NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \ | 119 | printk("tuple %p: %u " NIPQUAD_FMT ":%hu -> " NIPQUAD_FMT ":%hu\n", |
120 | NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all)) | 120 | t, t->dst.protonum, |
121 | NIPQUAD(t->src.u3.ip), ntohs(t->src.u.all), | ||
122 | NIPQUAD(t->dst.u3.ip), ntohs(t->dst.u.all)); | ||
123 | #endif | ||
124 | } | ||
125 | |||
126 | static inline void nf_ct_dump_tuple_ipv6(const struct nf_conntrack_tuple *t) | ||
127 | { | ||
128 | #ifdef DEBUG | ||
129 | printk("tuple %p: %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", | ||
130 | t, t->dst.protonum, | ||
131 | NIP6(*(struct in6_addr *)t->src.u3.all), ntohs(t->src.u.all), | ||
132 | NIP6(*(struct in6_addr *)t->dst.u3.all), ntohs(t->dst.u.all)); | ||
133 | #endif | ||
134 | } | ||
135 | |||
136 | static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t) | ||
137 | { | ||
138 | switch (t->src.l3num) { | ||
139 | case AF_INET: | ||
140 | nf_ct_dump_tuple_ip(t); | ||
141 | break; | ||
142 | case AF_INET6: | ||
143 | nf_ct_dump_tuple_ipv6(t); | ||
144 | break; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | #define NF_CT_DUMP_TUPLE(tp) nf_ct_dump_tuple(tp) | ||
121 | 149 | ||
122 | /* If we're the first tuple, it's the original dir. */ | 150 | /* If we're the first tuple, it's the original dir. */ |
123 | #define NF_CT_DIRECTION(h) \ | 151 | #define NF_CT_DIRECTION(h) \ |