[package] add hping3 (#4699)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@15166 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2009-04-09 13:25:03 +00:00
parent fc9a6b9f51
commit a410615192
4 changed files with 139 additions and 0 deletions

44
net/hping3/Makefile Normal file
View File

@ -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))

View File

@ -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

View File

@ -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 <endian.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -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

View File

@ -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 <stdlib.h>
#include <sys/ioctl.h>
#include <pcap.h>
-#include <net/bpf.h>
+#include <pcap-bpf.h>
#include "globals.h"