From 648256e492e552cdd9d9f425bf502ac8939d313a Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Thu, 9 Apr 2009 13:25:03 +0000 Subject: [PATCH] [package] add hping3 (#4699) SVN-Revision: 15166 --- net/hping3/Makefile | 44 +++++++++++++++++++++++ net/hping3/patches/100-makefile.patch | 48 +++++++++++++++++++++++++ net/hping3/patches/101-endianness.patch | 36 +++++++++++++++++++ net/hping3/patches/102-lib_rename.patch | 11 ++++++ 4 files changed, 139 insertions(+) create mode 100644 net/hping3/Makefile create mode 100644 net/hping3/patches/100-makefile.patch create mode 100644 net/hping3/patches/101-endianness.patch create mode 100644 net/hping3/patches/102-lib_rename.patch diff --git a/net/hping3/Makefile b/net/hping3/Makefile new file mode 100644 index 0000000000..b52f07884b --- /dev/null +++ b/net/hping3/Makefile @@ -0,0 +1,44 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: $ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=hping3 +PKG_VERSION:=20051105 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.hping.org/ +PKG_MD5SUM:=ca4ea4e34bcc2162aedf25df8b2d1747 + +include $(INCLUDE_DIR)/package.mk + +define Package/hping3 + SECTION:=net + CATEGORY:=Network + TITLE:=TCP/IP packet assembler/analyzer + URL:=http://www.hping.org/ + DEPENDS:=+libpcap +libpthread +endef + +define Package/hping3/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. +endef + +define Build/Configure +endef + +define Package/hping3/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/hping3 $(1)/usr/sbin/hping3 +endef + +$(eval $(call BuildPackage,hping3)) diff --git a/net/hping3/patches/100-makefile.patch b/net/hping3/patches/100-makefile.patch new file mode 100644 index 0000000000..61f0cf4ffa --- /dev/null +++ b/net/hping3/patches/100-makefile.patch @@ -0,0 +1,48 @@ +--- hping3-20051105_orig/Makefile 2005-11-05 11:31:41.000000000 +0100 ++++ hping3-20051105/Makefile 2009-02-26 13:44:40.000000000 +0100 +@@ -6,15 +6,15 @@ + # $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 -I/usr/include/tcl8.4 -DUSE_TCL +-DEBUG= -g ++#CC= gcc ++#AR=/usr/bin/ar ++#RANLIB=/usr/bin/ranlib ++#CCOPT= -O2 -Wall ++#DEBUG= -g + #uncomment the following if you need libpcap based build under linux + #(not raccomanded) + COMPILE_TIME= +-INSTALL_MANPATH=/usr/local/man ++#INSTALL_MANPATH=/usr/local/man + PCAP=-lpcap + + ARSOBJ = ars.o apd.o split.o rapd.o +@@ -50,20 +50,16 @@ + $(RANLIB) $@ + + hping3: byteorder.h $(OBJ) +- $(CC) -o hping3 $(CCOPT) $(DEBUG) $(OBJ) -L/usr/local/lib $(PCAP) -ltcl8.4 -lm -lpthread +- @echo +- ./hping3 -v +- @echo "use \`make strip' to strip hping3 binary" +- @echo "use \`make install' to install hping3" ++ $(CC) -o hping3 $(CFLAGS) $(LDFLAGS) $(DEBUG) $(OBJ) $(PCAP) -lm -lpthread + + hping3-static: byteorder.h $(OBJ) +- $(CC) -static -o hping3-static $(CCOPT) $(DEBUG) $(OBJ) -L/usr/local/lib $(PCAP) -ltcl8.4 -lm -lpthread -ldl ++ $(CC) -static -o hping3-static $(CFLAGS) $(LDFLAGS) $(DEBUG) $(OBJ) $(PCAP) -lm -lpthread -ldl + + byteorder.h: + ./configure + + .c.o: +- $(CC) -c $(CCOPT) $(DEBUG) $(COMPILE_TIME) $< ++ $(CC) -c $(CFLAGS) $(LDFLAGS) $(DEBUG) $(COMPILE_TIME) $< + + clean: + rm -rf hping3 *.o libars.a diff --git a/net/hping3/patches/101-endianness.patch b/net/hping3/patches/101-endianness.patch new file mode 100644 index 0000000000..9bc710c2d7 --- /dev/null +++ b/net/hping3/patches/101-endianness.patch @@ -0,0 +1,36 @@ +--- hping3-20051105_orig/hping2.h 2004-06-04 09:22:38.000000000 +0200 ++++ hping3-20051105/hping2.h 2009-02-26 15:42:14.000000000 +0100 +@@ -13,6 +13,7 @@ + #ifndef _HPING2_H + #define _HPING2_H + ++#include + #include + #include + #include +@@ -248,10 +249,10 @@ + * IP header + */ + struct myiphdr { +-#if defined(__LITTLE_ENDIAN_BITFIELD) ++#if __BYTE_ORDER == __LITTLE_ENDIAN + __u8 ihl:4, + version:4; +-#elif defined (__BIG_ENDIAN_BITFIELD) ++#elif __BYTE_ORDER == __BIG_ENDIAN + __u8 version:4, + ihl:4; + #else +@@ -287,10 +288,10 @@ + __u16 th_dport; /* destination port */ + __u32 th_seq; /* sequence number */ + __u32 th_ack; /* acknowledgement number */ +-#if defined (__LITTLE_ENDIAN_BITFIELD) ++#if __BYTE_ORDER == __LITTLE_ENDIAN + __u8 th_x2:4, /* (unused) */ + th_off:4; /* data offset */ +-#elif defined (__BIG_ENDIAN_BITFIELD) ++#elif __BYTE_ORDER == __BIG_ENDIAN + __u8 th_off:4, /* data offset */ + th_x2:4; /* (unused) */ + #else diff --git a/net/hping3/patches/102-lib_rename.patch b/net/hping3/patches/102-lib_rename.patch new file mode 100644 index 0000000000..77943c1d93 --- /dev/null +++ b/net/hping3/patches/102-lib_rename.patch @@ -0,0 +1,11 @@ +--- hping3-20051105_orig/libpcap_stuff.c 2004-04-10 01:38:56.000000000 +0200 ++++ hping3-20051105/libpcap_stuff.c 2009-02-26 15:26:26.000000000 +0100 +@@ -17,7 +17,7 @@ + #include + #include + #include +-#include ++#include + + #include "globals.h" + -- 2.30.2