Discussion:
Packet capturing
Jayesh Agrawal
2007-10-10 13:56:43 UTC
Permalink
Hello Everybody!

I am an Engineering student and doing a project on WAN Emulator. Can anyone
please tell me the way to capture a packet on Network Layer. I want to
capture original packet and not the copy(i think libpcap provides a copy of
the original packet). Let suppose we get a copy on Netwok layer then how we
can destroy the original packet....

Plz suggest me....Thanks in advance
John Default
2007-10-10 23:17:36 UTC
Permalink
Hi
and why do you need to destroy the other packet copy?
The packet you receive with pcap is
a/ for your host and can be used normally (for normal networking of the
host)
b/ not for your host - operating system drops packets not intended for
it anyway

If you didn't switch your network card into promiscuous mode, your NIC
has already dropped that packet so neither you (pcap), nor your
operating system will see it

With libpcap you are actually capturing on Layer 2, ethernet header is
included and can be injected.
your operating system doesn't even have to have an IP address
therefore. during testing i usually used "ifconfig ethX 0.0.0.0 up" just
to be sure OS will not mess with IP packets :) .
I am not sure the interface has to be even in "up" state for pcap to work.

In our school we have to implement "bridge" and "router" using libpcap
and i had no problems with that.

Using raw socket is another option to pcap
Post by Jayesh Agrawal
Hello Everybody!
I am an Engineering student and doing a project on WAN Emulator. Can
anyone please tell me the way to capture a packet on Network Layer. I
want to capture original packet and not the copy(i think libpcap
provides a copy of the original packet). Let suppose we get a copy on
Netwok layer then how we can destroy the original packet....
Plz suggest me....Thanks in advance
------------------------------------------------------------------------
_______________________________________________
LARTC mailing list
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
--
___________________________________
S pozdravom / Best regards

John Default
Loading...