ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have installed libpcap,libnet libraries for ICMP packet generation.While trying to compile the file icmpnum.c ,i am getting the following errors.Can anyone give a solution to rectify
gcc: libnetnet-config --defines: No such file or directory
In file included from icmpenum.c:5:/usr/include/libnet.h:87:2: #error "byte order has not been specified, you'llneed to #define either LIBNET_LIL_ENDIAN or LIBNET_BIG_ENDIAN. See the
documentation regarding the libnet-config script."
I think you're using the wrong quotation marks. You're using single quotes ( ' ) when I believe you should be using backticks ( ` ). Here's the difference:
The command treats anything inside sigle quotes literally. So your command says to treat 'libnetnet-config --defines' exactly as it appears. So, gcc is expecting to find a file named 'libnetnet-config --defines' (with a space and the dashes as part of its name).
The backticks are treated much differently. The shell interprets anything between backticks as a command. Then, the shell replaces the command with the command's output before executing the remaining item(s).
Try your compile with backticks instead of single quotes. On my keyboard (US layout), the backtick is on the same key as the tilde ( ~ ); near the top-left of the keyboard.
I have this same problem, with the following output:
[hatim@D0-Atlas icmpenum-1.1.1]$ gcc `libnet-config --defines` -o icmpenum icmpenum.c -lnet -lpcap
icmpenum.c: In function ‘send_packets’:
icmpenum.c:146: error: ‘LIBNET_IP_H’ undeclared (first use in this function)
icmpenum.c:146: error: (Each undeclared identifier is reported only once
icmpenum.c:146: error: for each function it appears in.)
icmpenum.c:152: error: ‘LIBNET_ERR_FATAL’ undeclared (first use in this function)
icmpenum.c:171: error: ‘LIBNET_ICMP_TS_H’ undeclared (first use in this function)
icmpenum.c:196: warning: passing argument 1 of ‘libnet_do_checksum’ from incompatible pointer type
icmpenum.c:196: warning: passing argument 2 of ‘libnet_do_checksum’ makes pointer from integer without a cast
icmpenum.c:196: error: too few arguments to function ‘libnet_do_checksum’
icmpenum.c:238: error: ‘LIBNET_ERR_WARNING’ undeclared (first use in this function)
icmpenum.c: In function ‘receive_packets_normal’:
icmpenum.c:284: error: dereferencing pointer to incomplete type
icmpenum.c: In function ‘grab_icmp’:
icmpenum.c:321: error: dereferencing pointer to incomplete type
icmpenum.c: In function ‘main’:
icmpenum.c:550: error: ‘LIBNET_ICMP_ECHO_H’ undeclared (first use in this function)
icmpenum.c:554: error: ‘LIBNET_ICMP_TS_H’ undeclared (first use in this function)
I can't say with any certainty how to solve it. Without having a copy of the code to examine, all I can say is look at your source code files to make sure you #include all the files that are necessary. All of this should be in either the man pages for the functions in libnet or on some web-based online documentation for libnet.
Some libraries require only #includes.
Some libraries require #includes and #defines.
Some libraries support commands such as "libnet-config --cflags".
You need to read the libnet documentation carefully. It should answer any and all questions you have in using the library properly.
I haven't used libnet before and I can't say what it wants.
I'm sorry if you feel like my help isn't what you were looking for, but let me point out a few things.
First, Varadharajan's original message identified a problem he was having with a compilation command, and he gave the command he was using. I was able to look at the command he used, saw the problem, and told him how to correct it. You, on the other hand, chose to identify a compilation problem, but provided no source code. Very few people can diagnose a compilation error by looking at only error results--there is simply not enough information.
Second, without code to look at, I cannot possibly fathom what you're trying to use the library for or in what way. Clearly, someone (e.g. Varadharajan) has used libnet to create their own program. The library works and can be used. There many ways that a library setup can be broken. Again, you have chosen only to show the error messages which gives no information to the root cause.
Third, you posted your response in an already existing thread. I have not professed to be a libnet expert of any sort. The original problem was solved because of a syntactical problem Varadharajan had with his command--a shell issue, not a libnet issue. I am not going to download libnet, read its documentation, and then write you a reader's digest version on how to use the library. All that is out there already. You should have read it yourself. And again, without source code, I would be at a loss even if I did do your research for you.
You have posted an error you received. You have given no source code. You haven't indicated anything else you've tried and what results those attempts gave. All things considered, my advice is still legitimate: re-read the documentation to make sure you're doing what you need to use the library properly. Until you give more information, that's the only advice anyone can give.
If you feel I'm being a jerk, feel free start a new thread, post the message you used above, and count the number of replies before someone says to "post the source code".
Last edited by Dark_Helmet; 02-02-2007 at 04:22 PM.
Because I actually am a nice guy, I looked around some more. For anyone that reads this, icmpenum.c appears to be a file provided by Symantec (which no one mentioned previously, leading me to believe these were from-scratch projects). Its purpose, according to the description, is a proof-of-concept utility to map network machines by using ICMP requests. Because it's a proof of concept tool by a security company, I have a hard time believing there's a legitimate use here because network administrators actually interested in testing their networks would probably know how to compile this software easily. Similarly, any university/college where this type of detection would be put to use for research purposes would likely be used by people fully capable of compiling it.
Regardless, on the off-chance that anyone using this utility is not some script-kiddie trying to break into other machines, verify that both required libraries are installed completely on the system - not just compiled in a local, home directory. The compilation error above is likely caused by a failure to find an appropriate header file (or finding the wrong one). If installing required libraries is still too cumbersome, a pre-compiled executable can be found at Packet Storm (something that could have been found by minimal searching - perhaps in looking to find the answer for a compilation problem).
Last edited by Dark_Helmet; 02-04-2007 at 01:59 AM.