Compile Hping on OpenSuse (and maybe others…)

I could not find any package for Hping3 in the repositories of OpenSuse (both official and non official). However, the source of Hping3 is available here and (almost) ready to be compiled. Almost ? let’s see why…


For compilation, you will need libpcap and tcl headers. That was available for me in the repositories. But, I still had an error during the compilation :

$ make
gcc -c -O2 -Wall    -g  main.c
gcc -c -O2 -Wall    -g  getifname.c
getifname.c: In function ‘get_output_if’:
getifname.c:343: warning: pointer targets in passing argument 3 of ‘getsockname’ differ in signedness
gcc -c -O2 -Wall    -g  getlhs.c
gcc -c -O2 -Wall    -g  parseoptions.c
gcc -c -O2 -Wall    -g  datafiller.c
gcc -c -O2 -Wall    -g  datahandler.c
gcc -c -O2 -Wall    -g  gethostname.c
gcc -c -O2 -Wall    -g  binding.c
gcc -c -O2 -Wall    -g  getusec.c
gcc -c -O2 -Wall    -g  opensockraw.c
gcc -c -O2 -Wall    -g  logicmp.c
gcc -c -O2 -Wall    -g  waitpacket.c
gcc -c -O2 -Wall    -g  resolve.c
gcc -c -O2 -Wall    -g  sendip.c
gcc -c -O2 -Wall    -g  sendicmp.c
gcc -c -O2 -Wall    -g  sendudp.c
gcc -c -O2 -Wall    -g  sendtcp.c
gcc -c -O2 -Wall    -g  cksum.c
gcc -c -O2 -Wall    -g  statistics.c
gcc -c -O2 -Wall    -g  usage.c
gcc -c -O2 -Wall    -g  version.c
gcc -c -O2 -Wall    -g  antigetopt.c
gcc -c -O2 -Wall    -g  sockopt.c
gcc -c -O2 -Wall    -g  listen.c
gcc -c -O2 -Wall    -g  sendhcmp.c
gcc -c -O2 -Wall    -g  memstr.c
gcc -c -O2 -Wall    -g  rtt.c
gcc -c -O2 -Wall    -g  relid.c
gcc -c -O2 -Wall    -g  sendip_handler.c
gcc -c -O2 -Wall    -g  libpcap_stuff.c
libpcap_stuff.c:20:21: error: net/bpf.h: Aucun fichier ou répertoire de ce type
libpcap_stuff.c: In function ‘pcap_recv’:
libpcap_stuff.c:61: warning: pointer targets in assignment differ in signedness
make: *** [libpcap_stuff.o] Erreur 1

I went through it doing :

$ ln -s /usr/include/pcap-bpf.h /usr/include/net/bpf.h

It is not the best solution, but at least it works. These paths related issues depending on the distribution are so annoying…

UPDATE for openSUSE 11.1 :

First, I got this error :

error "Please, edit Makefile and add -DBYTE_ORDER_(BIG|LITTLE)_ENDIAN

In addition to the above trick, if you are runing 64 bits, you need to apply hping-suse.patch to the source :

$ patch -p0 < hping-suse.patch

Then, I still had an issue with the tcl-devel package which is a prerequisite to compile hping with tcl-support.
The error :

/usr/bin/ld: cannot find -ltcl

I ended up compiling tcl from the source, and finally it compiled properly…

Related posts:

  1. Yersinia : patch to compile under openSUSE (11.1)
  2. openSUSE kernel sources : patching against sock_sendpage() NULL Pointer Dereference vulnerability

Comments 6

  1. noname wrote:

    humm…doesn’t work for me, I also tried to edit the path in source files (opensuse 10.2 with all needed packages installed). Did you get get any other error message after making symbol link?

    Posted 07 Dec 2007 at 12:49 am
  2. JC wrote:

    As far as I remember, it just worked. What kind of error do you get ?
    You can post it here.

    Posted 07 Dec 2007 at 12:56 am
  3. RaSchi wrote:

    Worked for me like a charme (under openSuSE 10.3) :-) Thanks!

    Posted 25 Jan 2008 at 5:31 pm
  4. Aaron Leininger wrote:

    I can compile w/o TCL support but I get a make error when I try a standard compile. I have the tcl packages installed btw.

    This is the error:
    /main.c:186: undefined reference to `hping_script’

    Has anyone ever seen this error? I have been googling all over w/ very little result

    I am on x86_64 bit architecture w/ openSuSe 10.3

    Posted 21 Jul 2008 at 8:51 pm
  5. Aaron Leininger wrote:

    ok. I finally found a site that had a few edits to make to some include statements that fixed my make error but now I am getting a different make error:

    /script.c:454: undefined reference to `hping_get_interfaces’

    Any help would be appreciated. Even a link to look at…

    Posted 21 Jul 2008 at 9:12 pm
  6. Eric Vanborren wrote:

    # ln -s /usr/include/pcap-bpf.h /usr/include/net/bpf.h

    Excellent solution ! it’s works on :

    [root@localhost hping3-20051105]# cat /etc/redhat-release
    Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
    [root@localhost hping3-20051105]#

    Best Regards,
    Eric
    May The OpenSource be with you !

    Posted 27 Aug 2008 at 5:28 pm

Post a Comment

Your email is never published nor shared. Required fields are marked *