Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 03-27-2006, 08:14 AM   #1
LQ Newbie
Registered: Mar 2006
Posts: 2

Rep: Reputation: 0
dropping and forwarding packets using libpcap


I wrote a program in C using lipcap library, and I connected MySQL server to log all the captured packets traffic, I am running Fedora3.

But I need to DROP the packets or forwarding them, Can I do that with libpcap ? if not, how can I do it ?

note: I need a function that I can embedded in my program.

thanks for the help
Old 03-27-2006, 12:38 PM   #2
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
basically, when people want to resend packets sniffed with the libpcap, they use libnet.
this lib enable you to send raw packets over the network (you build the whole packet from scratch) or, as an example, to give the DNS parameters of a DNS packet and ask libnet to build the DNS reply, the UDP trame, the IP packet and the Ethernet one.
In your case, your program would decide what to do with the packets depending on the info read from libpcap and use libnet functions to forward them.
Please also note that you can use iptables rules to do all that... chances are that the netfilter developpers have a much better implementation of all that than you'll have... (sorry, you may be a C guru as well ;o) )

Hope this helps!
Old 04-08-2006, 09:18 PM   #3
LQ Newbie
Registered: Mar 2006
Posts: 2

Original Poster
Rep: Reputation: 0


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't sniff packets using libpcap masterm Linux - Networking 0 05-17-2005 06:58 PM
how can i use libpcap to capture packets for the local loopback interface (lo) ? gajaykrishnan Programming 0 02-22-2005 05:03 AM
Dropping Network Packets Micah Linux - Networking 4 03-14-2004 10:39 PM
Packets dropping with LAN network valo Linux - Hardware 3 02-18-2004 07:19 PM
dropping packets ? jb_li Programming 7 04-14-2003 12:18 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:38 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration