Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Linux > Linux Networking

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-16-2008, 02:10 PM
zhengda
 
Posts: n/a
Why can tcpdump not capture all packets

Hello,

I'm writing a NETFILTER module, it works at NF_IP_LOCAL_IN.
Its work is to capture the IP packets and deliver them back to the user
space.
What I do is:
Use skb_realloc_headroom() to make sure there is enough space for
another IP header, and meanwhile, make a copy of the original packet.
Add another IP header in the new packet, whose the source IP and dest IP
are both the local IP.
Deliver the new packet by ip_dev_loopback_xmit()(I copy this function
from the kernel).
Drop the original packets by returning NF_DROP.
(the module doesn't deliver TCP packets back to the user space for
debugging reason.)

I send ICMP packets by using ping to test the module, and I also write a
program in the user space to receive the delivered packets(with 2 IP
headers), and the program does receive them.
But the weird thing is that I cannot use TCPDUMP captured the delivered
packets.
Because I use ip_dev_loopback_xmit(), TCPDUMP should see the packets
once(in netif_receive_skb()).

If TCPDUMP listens to lo, it cannot get any packets.
debian:~/storage# tcpdump -i lo -w packets.pcap
tcpdump: listening on lo, link-type EN10MB (Ethernet), capture size 96 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel

If it listens to every device, the number of captured packets and the
one received by filter are different. But I don't define any filter
rules here, and the captured packets are all TCP packets.
debian:~/storage# tcpdump -i any -w packets.pcap
tcpdump: WARNING: Promiscuous mode not supported on the "any" device
tcpdump: listening on any, link-type LINUX_SLL (Linux cooked), capture
size 96 bytes
32 packets captured
38 packets received by filter
0 packets dropped by kernel

Since I don't define the filter rule, TCPDUMP should receive all packets
it can see.
Does anyone know what happens here?

Best,
Zheng Da
Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Linux > Linux Networking


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:47 AM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Adverse Credit Remortgage | Cheat Codes | Homeowner Loans | WoW Gold | Online Dating



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114