diff options
author | Patrick McHardy <kaber@trash.net> | 2005-06-21 17:01:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-06-21 17:01:57 -0400 |
commit | 18b8afc771102b1b6af97962808291a7d27f52af (patch) | |
tree | 4d278a45ab07b5ba81dfa0b737f5174ad9ee7f79 /net/core | |
parent | e45b1be8bcb3643808975a426fa3e201a2588e87 (diff) |
[NETFILTER]: Kill nf_debug
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/netfilter.c | 138 | ||||
-rw-r--r-- | net/core/skbuff.c | 6 |
2 files changed, 0 insertions, 144 deletions
diff --git a/net/core/netfilter.c b/net/core/netfilter.c index 22a8f127c4aa..076c156d5eda 100644 --- a/net/core/netfilter.c +++ b/net/core/netfilter.c | |||
@@ -141,136 +141,6 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg) | |||
141 | up(&nf_sockopt_mutex); | 141 | up(&nf_sockopt_mutex); |
142 | } | 142 | } |
143 | 143 | ||
144 | #ifdef CONFIG_NETFILTER_DEBUG | ||
145 | #include <net/ip.h> | ||
146 | #include <net/tcp.h> | ||
147 | #include <linux/netfilter_ipv4.h> | ||
148 | |||
149 | static void debug_print_hooks_ip(unsigned int nf_debug) | ||
150 | { | ||
151 | if (nf_debug & (1 << NF_IP_PRE_ROUTING)) { | ||
152 | printk("PRE_ROUTING "); | ||
153 | nf_debug ^= (1 << NF_IP_PRE_ROUTING); | ||
154 | } | ||
155 | if (nf_debug & (1 << NF_IP_LOCAL_IN)) { | ||
156 | printk("LOCAL_IN "); | ||
157 | nf_debug ^= (1 << NF_IP_LOCAL_IN); | ||
158 | } | ||
159 | if (nf_debug & (1 << NF_IP_FORWARD)) { | ||
160 | printk("FORWARD "); | ||
161 | nf_debug ^= (1 << NF_IP_FORWARD); | ||
162 | } | ||
163 | if (nf_debug & (1 << NF_IP_LOCAL_OUT)) { | ||
164 | printk("LOCAL_OUT "); | ||
165 | nf_debug ^= (1 << NF_IP_LOCAL_OUT); | ||
166 | } | ||
167 | if (nf_debug & (1 << NF_IP_POST_ROUTING)) { | ||
168 | printk("POST_ROUTING "); | ||
169 | nf_debug ^= (1 << NF_IP_POST_ROUTING); | ||
170 | } | ||
171 | if (nf_debug) | ||
172 | printk("Crap bits: 0x%04X", nf_debug); | ||
173 | printk("\n"); | ||
174 | } | ||
175 | |||
176 | static void nf_dump_skb(int pf, struct sk_buff *skb) | ||
177 | { | ||
178 | printk("skb: pf=%i %s dev=%s len=%u\n", | ||
179 | pf, | ||
180 | skb->sk ? "(owned)" : "(unowned)", | ||
181 | skb->dev ? skb->dev->name : "(no dev)", | ||
182 | skb->len); | ||
183 | switch (pf) { | ||
184 | case PF_INET: { | ||
185 | const struct iphdr *ip = skb->nh.iph; | ||
186 | __u32 *opt = (__u32 *) (ip + 1); | ||
187 | int opti; | ||
188 | __u16 src_port = 0, dst_port = 0; | ||
189 | |||
190 | if (ip->protocol == IPPROTO_TCP | ||
191 | || ip->protocol == IPPROTO_UDP) { | ||
192 | struct tcphdr *tcp=(struct tcphdr *)((__u32 *)ip+ip->ihl); | ||
193 | src_port = ntohs(tcp->source); | ||
194 | dst_port = ntohs(tcp->dest); | ||
195 | } | ||
196 | |||
197 | printk("PROTO=%d %u.%u.%u.%u:%hu %u.%u.%u.%u:%hu" | ||
198 | " L=%hu S=0x%2.2hX I=%hu F=0x%4.4hX T=%hu", | ||
199 | ip->protocol, NIPQUAD(ip->saddr), | ||
200 | src_port, NIPQUAD(ip->daddr), | ||
201 | dst_port, | ||
202 | ntohs(ip->tot_len), ip->tos, ntohs(ip->id), | ||
203 | ntohs(ip->frag_off), ip->ttl); | ||
204 | |||
205 | for (opti = 0; opti < (ip->ihl - sizeof(struct iphdr) / 4); opti++) | ||
206 | printk(" O=0x%8.8X", *opt++); | ||
207 | printk("\n"); | ||
208 | } | ||
209 | } | ||
210 | } | ||
211 | |||
212 | void nf_debug_ip_local_deliver(struct sk_buff *skb) | ||
213 | { | ||
214 | /* If it's a loopback packet, it must have come through | ||
215 | * NF_IP_LOCAL_OUT, NF_IP_RAW_INPUT, NF_IP_PRE_ROUTING and | ||
216 | * NF_IP_LOCAL_IN. Otherwise, must have gone through | ||
217 | * NF_IP_RAW_INPUT and NF_IP_PRE_ROUTING. */ | ||
218 | if (!skb->dev) { | ||
219 | printk("ip_local_deliver: skb->dev is NULL.\n"); | ||
220 | } else { | ||
221 | if (skb->nf_debug != ((1<<NF_IP_PRE_ROUTING) | ||
222 | | (1<<NF_IP_LOCAL_IN))) { | ||
223 | printk("ip_local_deliver: bad skb: "); | ||
224 | debug_print_hooks_ip(skb->nf_debug); | ||
225 | nf_dump_skb(PF_INET, skb); | ||
226 | } | ||
227 | } | ||
228 | } | ||
229 | |||
230 | void nf_debug_ip_loopback_xmit(struct sk_buff *newskb) | ||
231 | { | ||
232 | if (newskb->nf_debug != ((1 << NF_IP_LOCAL_OUT) | ||
233 | | (1 << NF_IP_POST_ROUTING))) { | ||
234 | printk("ip_dev_loopback_xmit: bad owned skb = %p: ", | ||
235 | newskb); | ||
236 | debug_print_hooks_ip(newskb->nf_debug); | ||
237 | nf_dump_skb(PF_INET, newskb); | ||
238 | } | ||
239 | } | ||
240 | |||
241 | void nf_debug_ip_finish_output2(struct sk_buff *skb) | ||
242 | { | ||
243 | /* If it's owned, it must have gone through the | ||
244 | * NF_IP_LOCAL_OUT and NF_IP_POST_ROUTING. | ||
245 | * Otherwise, must have gone through | ||
246 | * NF_IP_PRE_ROUTING, NF_IP_FORWARD and NF_IP_POST_ROUTING. | ||
247 | */ | ||
248 | if (skb->sk) { | ||
249 | if (skb->nf_debug != ((1 << NF_IP_LOCAL_OUT) | ||
250 | | (1 << NF_IP_POST_ROUTING))) { | ||
251 | printk("ip_finish_output: bad owned skb = %p: ", skb); | ||
252 | debug_print_hooks_ip(skb->nf_debug); | ||
253 | nf_dump_skb(PF_INET, skb); | ||
254 | } | ||
255 | } else { | ||
256 | if (skb->nf_debug != ((1 << NF_IP_PRE_ROUTING) | ||
257 | | (1 << NF_IP_FORWARD) | ||
258 | | (1 << NF_IP_POST_ROUTING))) { | ||
259 | /* Fragments, entunnelled packets, TCP RSTs | ||
260 | generated by ipt_REJECT will have no | ||
261 | owners, but still may be local */ | ||
262 | if (skb->nf_debug != ((1 << NF_IP_LOCAL_OUT) | ||
263 | | (1 << NF_IP_POST_ROUTING))){ | ||
264 | printk("ip_finish_output:" | ||
265 | " bad unowned skb = %p: ",skb); | ||
266 | debug_print_hooks_ip(skb->nf_debug); | ||
267 | nf_dump_skb(PF_INET, skb); | ||
268 | } | ||
269 | } | ||
270 | } | ||
271 | } | ||
272 | #endif /*CONFIG_NETFILTER_DEBUG*/ | ||
273 | |||
274 | /* Call get/setsockopt() */ | 144 | /* Call get/setsockopt() */ |
275 | static int nf_sockopt(struct sock *sk, int pf, int val, | 145 | static int nf_sockopt(struct sock *sk, int pf, int val, |
276 | char __user *opt, int *len, int get) | 146 | char __user *opt, int *len, int get) |
@@ -488,14 +358,6 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **pskb, | |||
488 | /* We may already have this, but read-locks nest anyway */ | 358 | /* We may already have this, but read-locks nest anyway */ |
489 | rcu_read_lock(); | 359 | rcu_read_lock(); |
490 | 360 | ||
491 | #ifdef CONFIG_NETFILTER_DEBUG | ||
492 | if (unlikely((*pskb)->nf_debug & (1 << hook))) { | ||
493 | printk("nf_hook: hook %i already set.\n", hook); | ||
494 | nf_dump_skb(pf, *pskb); | ||
495 | } | ||
496 | (*pskb)->nf_debug |= (1 << hook); | ||
497 | #endif | ||
498 | |||
499 | elem = &nf_hooks[pf][hook]; | 361 | elem = &nf_hooks[pf][hook]; |
500 | next_hook: | 362 | next_hook: |
501 | verdict = nf_iterate(&nf_hooks[pf][hook], pskb, hook, indev, | 363 | verdict = nf_iterate(&nf_hooks[pf][hook], pskb, hook, indev, |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index f65b3de590a9..6d68c03bc051 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -365,9 +365,6 @@ struct sk_buff *skb_clone(struct sk_buff *skb, int gfp_mask) | |||
365 | C(nfct); | 365 | C(nfct); |
366 | nf_conntrack_get(skb->nfct); | 366 | nf_conntrack_get(skb->nfct); |
367 | C(nfctinfo); | 367 | C(nfctinfo); |
368 | #ifdef CONFIG_NETFILTER_DEBUG | ||
369 | C(nf_debug); | ||
370 | #endif | ||
371 | #ifdef CONFIG_BRIDGE_NETFILTER | 368 | #ifdef CONFIG_BRIDGE_NETFILTER |
372 | C(nf_bridge); | 369 | C(nf_bridge); |
373 | nf_bridge_get(skb->nf_bridge); | 370 | nf_bridge_get(skb->nf_bridge); |
@@ -432,9 +429,6 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | |||
432 | new->nfct = old->nfct; | 429 | new->nfct = old->nfct; |
433 | nf_conntrack_get(old->nfct); | 430 | nf_conntrack_get(old->nfct); |
434 | new->nfctinfo = old->nfctinfo; | 431 | new->nfctinfo = old->nfctinfo; |
435 | #ifdef CONFIG_NETFILTER_DEBUG | ||
436 | new->nf_debug = old->nf_debug; | ||
437 | #endif | ||
438 | #ifdef CONFIG_BRIDGE_NETFILTER | 432 | #ifdef CONFIG_BRIDGE_NETFILTER |
439 | new->nf_bridge = old->nf_bridge; | 433 | new->nf_bridge = old->nf_bridge; |
440 | nf_bridge_get(old->nf_bridge); | 434 | nf_bridge_get(old->nf_bridge); |