summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Lenehan <lenehan@twibble.org>2006-07-04 03:38:21 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-07-04 03:38:21 +0000
commitd1f207a2c3388bbbd8a6ff976603e679478533b2 (patch)
treef9bad84c3c60c5f024599a93e148a29c6c684652
parent32fb77d1adfb5d733794f5da446f6262fd4e0b12 (diff)
hping2 2.0.0rc3: Added hping2, a network testing tool. Especially useful
when testing devices for their handling of various protocols (GRE, IP-IP etc) without needing to resort to an actual working application.
-rw-r--r--packages/hping/.mtn2git_empty0
-rw-r--r--packages/hping/files/.mtn2git_empty0
-rw-r--r--packages/hping/files/hping2_configure.patch75
-rw-r--r--packages/hping/files/hping2_debian.patch168
-rw-r--r--packages/hping/hping2_1.9.9+2.0.0rc3.bb48
5 files changed, 291 insertions, 0 deletions
diff --git a/packages/hping/.mtn2git_empty b/packages/hping/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/hping/.mtn2git_empty
diff --git a/packages/hping/files/.mtn2git_empty b/packages/hping/files/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/hping/files/.mtn2git_empty
diff --git a/packages/hping/files/hping2_configure.patch b/packages/hping/files/hping2_configure.patch
new file mode 100644
index 0000000000..90795ab0e0
--- /dev/null
+++ b/packages/hping/files/hping2_configure.patch
@@ -0,0 +1,75 @@
+Allow the byteorder and target os type to be specified via
+environment variables when running the configured shell script, don't
+try and run the resultant binary after building it, don't set various
+compiler related environment varibles - we'll let OE set those.
+
+diff -dur hping2-rc3-orig/configure hping2-rc3/configure
+--- hping2-rc3-orig/configure 2005-12-03 19:04:44.000000000 +1100
++++ hping2-rc3/configure 2005-12-03 19:05:58.000000000 +1100
+@@ -13,16 +13,19 @@
+ exit 0
+ fi
+
+-CC=${CC:=cc}
++if [ "x$BYTEORDER" = "x" ]; then
++ CC=${CC:=cc}
+
+-echo build byteorder.c...
+-$CC byteorder.c -o byteorder || exit 1
++ echo build byteorder.c...
++ $CC byteorder.c -o byteorder || exit 1
++
++ BYTEORDER=`./byteorder -m`
++fi
+
+ INSTALL_MANPATH=`echo $MANPATH|cut -f1 -d:`
+ if [ "$INSTALL_MANPATH" = "" ]; then
+ INSTALL_MANPATH="/usr/local/man"
+ fi
+-BYTEORDER=`./byteorder -m`
+
+ echo create byteorder.h...
+ cat > byteorder.h <<EOF
+@@ -38,7 +41,9 @@
+ #endif /* __BYTEORDER_H */
+ EOF
+
+-CONFIGOSTYPE=`uname -s | tr [a-z] [A-Z]`
++if [ "x$CONFIGOSTYPE" = "x" ]; then
++ CONFIGOSTYPE=`uname -s | tr [a-z] [A-Z]`
++fi
+ if [ ! "$CONFIGOSTYPE" ]; then
+ CONFIGOSTYPE=UNKNOWN
+ fi
+diff -dur hping2-rc3-orig/Makefile.in hping2-rc3/Makefile.in
+--- hping2-rc3-orig/Makefile.in 2005-12-03 19:04:44.000000000 +1100
++++ hping2-rc3/Makefile.in 2005-12-03 19:05:41.000000000 +1100
+@@ -6,17 +6,6 @@
+ # $date: Sun Jul 25 17:56:15 MET DST 1999$
+ # $rev: 3$
+
+-CC= gcc
+-AR=/usr/bin/ar
+-RANLIB=/usr/bin/ranlib
+-CCOPT= -O2 -Wall @PCAP_INCLUDE@
+-DEBUG= -g
+-#uncomment the following if you need libpcap based build under linux
+-#(not raccomanded)
+-COMPILE_TIME= @FORCE_LIBPCAP@
+-INSTALL_MANPATH=@MANPATH@
+-@PCAP@
+-
+ OBJ= main.o getifname.o getlhs.o \
+ linux_sockpacket.o parseoptions.o datafiller.o \
+ datahandler.o gethostname.o \
+@@ -44,10 +33,6 @@
+
+ hping2: byteorder.h $(OBJ)
+ $(CC) -o hping2 $(CCOPT) $(DEBUG) $(OBJ) $(PCAP) @SOLARISLIB@
+- @echo
+- ./hping2 -v
+- @echo "use \`make strip' to strip hping2 binary"
+- @echo "use \`make install' to install hping2"
+
+ byteorder.h:
+ ./configure
diff --git a/packages/hping/files/hping2_debian.patch b/packages/hping/files/hping2_debian.patch
new file mode 100644
index 0000000000..4edc893896
--- /dev/null
+++ b/packages/hping/files/hping2_debian.patch
@@ -0,0 +1,168 @@
+The following minor changes were taken from the debian hping2 package:
+
+--- hping2-2.rc3.orig/antigetopt.c
++++ hping2-2.rc3/antigetopt.c
+@@ -140,7 +140,7 @@
+ #define UNK_LONG_ERRSTRING "unrecognized option `--%s'\n"
+ #define ARG_SHORT_ERRSTRING "option requires an argument -- %c\n"
+ #define ARG_LONG_ERRSTRING "option `--%s' requires an argument\n"
+-#define AMB_ERRSTRING "option `--%s' is ambiguos\n"
++#define AMB_ERRSTRING "option `--%s' is ambiguous\n"
+ #define IERR_ERRSTRING "internal error. ago_gnu_error() called with " \
+ "a bad error code (%d)\n"
+ void ago_gnu_error(char *pname, int error)
+--- hping2-2.rc3.orig/bytesex.h
++++ hping2-2.rc3/bytesex.h
+@@ -7,16 +7,11 @@
+ #ifndef ARS_BYTESEX_H
+ #define ARS_BYTESEX_H
+
+-#if defined(__i386__) \
+- || defined(__alpha__) \
+- || (defined(__mips__) && (defined(MIPSEL) || defined (__MIPSEL__)))
++#include <endian.h>
++
++#if __BYTE_ORDER == __LITTLE_ENDIAN
+ #define BYTE_ORDER_LITTLE_ENDIAN
+-#elif defined(__mc68000__) \
+- || defined (__sparc__) \
+- || defined (__sparc) \
+- || defined (__PPC__) \
+- || defined (__BIG_ENDIAN__) \
+- || (defined(__mips__) && (defined(MIPSEB) || defined (__MIPSEB__)))
++#elif __BYTE_ORDER == __BIG_ENDIAN
+ #define BYTE_ORDER_BIG_ENDIAN
+ #else
+ # error can not find the byte order for this architecture, fix bytesex.h
+--- hping2-2.rc3.orig/getlhs.c
++++ hping2-2.rc3/getlhs.c
+@@ -55,6 +55,12 @@
+ case DLT_IEEE802_11:
+ linkhdr_size = 14;
+ break;
++ case DLT_IEEE802_11:
++ linkhdr_size = 14;
++ break;
++ case DLT_TOKEN_RING:
++ linkhdr_size = 20;
++ break;
+ case DLT_ATM_RFC1483:
+ #ifdef DLT_CIP
+ case DLT_CIP:
+@@ -105,6 +111,15 @@
+ } else if ( strstr(ifname, "wlan") ) {
+ linkhdr_size = WLANHDR_SIZE;
+ return 0;
++ } else if (strstr(ifname, "atm")) {
++ linkhdr_size = 0;
++ return 0;
++ } else if ( strstr(ifname, "wlan") ) {
++ linkhdr_size = WLANHDR_SIZE;
++ return 0;
++ } else if ( strstr(ifname, "tr") ) {
++ linkhdr_size = TRHDR_SIZE;
++ return 0;
+ }
+ else
+ return -1;
+--- hping2-2.rc3.orig/listen.c
++++ hping2-2.rc3/listen.c
+@@ -10,6 +10,7 @@
+
+ #include <stdlib.h>
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
+ #include <sys/types.h>
+--- hping2-2.rc3.orig/main.c
++++ hping2-2.rc3/main.c
+@@ -26,6 +26,7 @@
+ #include <time.h>
+ #include <sys/time.h>
+ #include <sys/types.h>
++#include <time.h>
+
+ #include "hping2.h"
+
+--- hping2-2.rc3.orig/resolve.c
++++ hping2-2.rc3/resolve.c
+@@ -12,6 +12,7 @@
+ #include <sys/types.h>
+ #include <netdb.h>
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <string.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+--- hping2-2.rc3.orig/sendicmp.c
++++ hping2-2.rc3/sendicmp.c
+@@ -19,6 +19,7 @@
+ #include <string.h>
+ #include <signal.h>
+ #include <errno.h>
++#include <time.h>
+
+ #include "hping2.h"
+ #include "globals.h"
+--- hping2-2.rc3.orig/sendtcp.c
++++ hping2-2.rc3/sendtcp.c
+@@ -15,6 +15,8 @@
+ #include <sys/time.h>
+ #include <unistd.h>
+ #include <signal.h>
++#include <errno.h>
++#include <time.h>
+
+ #include "hping2.h"
+ #include "globals.h"
+--- hping2-2.rc3.orig/sendudp.c
++++ hping2-2.rc3/sendudp.c
+@@ -15,6 +15,8 @@
+ #include <sys/time.h>
+ #include <unistd.h>
+ #include <signal.h>
++#include <errno.h>
++#include <time.h>
+
+ #include "hping2.h"
+ #include "globals.h"
+--- hping2-2.rc3.orig/statistics.c
++++ hping2-2.rc3/statistics.c
+@@ -10,6 +10,7 @@
+
+ #include <stdlib.h>
+ #include <stdio.h>
++#include <stdlib.h>
+
+ #include "hping2.h"
+ #include "globals.h"
+@@ -33,7 +34,7 @@
+ lossrate = 100;
+
+ fprintf(stderr, "\n--- %s hping statistic ---\n", targetname);
+- fprintf(stderr, "%d packets tramitted, %d packets received, "
++ fprintf(stderr, "%d packets transmitted, %d packets received, "
+ "%d%% packet loss\n", sent_pkt, recv_pkt, lossrate);
+ if (out_of_sequence_pkt)
+ fprintf(stderr, "%d out of sequence packets received\n",
+--- hping2-2.rc3.orig/usage.c
++++ hping2-2.rc3/usage.c
+@@ -12,6 +12,7 @@
+
+ #include <stdlib.h>
+ #include <stdio.h>
++#include <stdlib.h>
+
+ void show_usage(void)
+ {
+--- hping2-2.rc3.orig/version.c
++++ hping2-2.rc3/version.c
+@@ -10,6 +10,7 @@
+
+ #include <stdlib.h>
+ #include <stdio.h>
++#include <stdlib.h>
+
+ #include "release.h"
+ #include "hping2.h"
diff --git a/packages/hping/hping2_1.9.9+2.0.0rc3.bb b/packages/hping/hping2_1.9.9+2.0.0rc3.bb
new file mode 100644
index 0000000000..912f7c420e
--- /dev/null
+++ b/packages/hping/hping2_1.9.9+2.0.0rc3.bb
@@ -0,0 +1,48 @@
+DESCRIPTION = "hping is a command-line oriented TCP/IP packet \
+assembler/analyzer. The interface is inspired to the ping(8) \
+unix command, but hping isn't only able to send ICMP echo requests. \
+It supports TCP, UDP, ICMP and RAW-IP protocols, has a traceroute \
+mode, the ability to send files between a covered channel, and many \
+other features."
+HOMEPAGE = "http://www.hping.org/"
+SECTION = "console/network"
+MAINTAINER = "Jamie Lenehan <lenehan@twibble.org>"
+LICENSE = "GPL"
+PR = "r0"
+
+SRC_URI = "http://www.hping.org/hping2.0.0-rc3.tar.gz \
+ file://hping2_debian.patch;patch=1 \
+ file://hping2_configure.patch;patch=1"
+S="${WORKDIR}/hping2-rc3"
+
+#
+# We've patched configure to accept byte order and ostype as env
+# variables Pass those values in to stop it trying to figure it out
+# by itself.
+# NOTE: The configure script is not an autoconf script.
+#
+do_configure() {
+ # endianness fun.. inspired by openssl.inc
+ . ${CONFIG_SITE}
+ BYTEORDER="UNKNOWN"
+ if test "x$ac_cv_c_bigendian" = "xyes"; then
+ BYTEORDER="__BIG_ENDIAN_BITFIELD"
+ elif test "x$ac_cv_c_littleendian" = "xyes"; then
+ BYTEORDER="__LITTLE_ENDIAN_BITFIELD"
+ else
+ oefatal do_configure cannot determine endianess
+ fi
+ BYTEORDER="${BYTEORDER}" CONFIGOSTYPE="LINUX" ./configure
+}
+
+#
+# Instead of patching the install we do things manually here
+#
+do_install() {
+ install -m 0755 -d ${D}${sbindir} ${D}/${mandir} ${D}${docdir}/hping2
+ install -m 0755 hping2 ${D}/${sbindir}
+ install -m 0644 docs/hping2.8 ${D}/${mandir}
+ install -m 0644 docs/HPING2-HOWTO.txt docs/HPING2-IS-OPEN \
+ docs/MORE-FUN-WITH-IPID docs/SPOOFED_SCAN.txt \
+ docs/AS-BACKDOOR docs/APD.txt ${D}${docdir}/hping2
+}