Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I could not compile a c program that uses libpcap
#include<pcap.h>
main(int argc, char **argv){
..
..
/* Open the capture file */
if ((fp = pcap_open_offline(argv[1], errbuf)) == NULL)
..
}
when i compile
/tmp/cc9Z2hEW.o(.text+0x59): In function `main':
: undefined reference to `pcap_open_offline'
/tmp/cc9Z2hEW.o(.text+0xa0): In function `main':
: undefined reference to `pcap_loop'
/tmp/cc9Z2hEW.o(.text+0xae): In function `main':
: undefined reference to `pcap_close'
collect2: ld returned 1 exit status
i am writing a program that sniff all the packets in the network.i know in pcap.c has got ready functions.But i am not able to add the pcap.h header file.I have already installed the libpcap package but still problem.
let me know that how did u inclde pcap.h in u r program.Hi i am using 2.6.17 kernel and ubuntu 6.10
I hope u have installed libpcap.Yesterday i was also getting the same errors i found the solution.When u r compiling the program compile this way "gcc filename -o 001 -lpcap".This should work,this works for me.
when i am compiling a program
..
fp= pcap_open(source, 1514 /*snaplen*/, PCAP_OPENFLAG_PROMISCUOUS /*flags*/, 20 /*read timeout*/, NULL /* remote authentication */,errbuf)
..
..
tcptop.c:60: error: `PCAP_OPENFLAG_PROMISCUOUS' undeclared
tcptop.c:86: error: `MODE_STAT' undeclared (first use in this function)
tcptop.c:91: error: `PUCHAR' undeclared (first use in this function)
tcptop.c: In function `dispatcher_handler':
tcptop.c:100: error: `LARGE_INTEGER' undeclared (first use in this function)
tcptop.c:100: error: syntax error before "Bps"
tcptop.c:108: error: `Bps' undeclared (first use in this function)
tcptop.c:108: error: `LONGLONG' undeclared (first use in this function)
tcptop.c:108: error: syntax error before ')' token
tcptop.c:119: error: `Pps' undeclared (first use in this function)
tcptop.c:119: error: syntax error before ')' token
tcptop.c:122: warning: assignment makes pointer from integer without a cast
tcptop.c:147:2: warning: no newline at end of file
plz tell me where r those constants,
can u plz post ur test program
hi gautam,
ur program has a problem.
when i run it is displaying like below
from: 251.212.59.93 19059 To: 116.92.213.191 22
Length: 17664
Flags: URGACK SYN
but my ip is 59.93.116.92, observe last two bytes in from feild and first two bytes in to feild.
so there is some fault event the port no are different when i compared with tcpdump output
sniffer program that display the contents of the captured packet
Hello mahesh,
Have u done the above assignment ?.If so send me the program .I think displaying the contents of the packet is quite difficulty.The program which i had send u few days back displays only the headers details ,Not the contents .But I hope using pcap package we can display the contents.Just study this thread which is similar to our problem. http://www.linuxquestions.org/questi...d.php?t=293022
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.