mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Add tracebox
This commit is contained in:
		
							parent
							
								
									bd646c5b69
								
							
						
					
					
						commit
						67f9b018cf
					
				
					 8 changed files with 201 additions and 0 deletions
				
			
		|  | @ -41,6 +41,7 @@ MY_DEPENDS := \ | |||
|     iftop \
 | ||||
|     tcpdump \
 | ||||
|     ethtool \
 | ||||
|     tracebox \
 | ||||
|     luci-proto-3g \
 | ||||
|     comgt-ncm luci-proto-ncm \
 | ||||
|     luci-app-mlvpn mlvpn \
 | ||||
|  |  | |||
							
								
								
									
										51
									
								
								tracebox/Makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								tracebox/Makefile
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,51 @@ | |||
| include $(TOPDIR)/rules.mk | ||||
| 
 | ||||
| PKG_NAME:=tracebox | ||||
| PKG_VERSION:=0.4.4 | ||||
| PKG_RELEASE:=1 | ||||
| 
 | ||||
| PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 | ||||
| PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) | ||||
| PKG_SOURCE_URL:=git@github.com:tracebox/tracebox.git | ||||
| PKG_MAINTAINER:=Gregory Detal <gregory.detal@uclouvain.be> | ||||
| 
 | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_VERSION:=v0.4.4 | ||||
| 
 | ||||
| PKG_FIXUP:=autoreconf | ||||
| 
 | ||||
| #include $(INCLUDE_DIR)/uclibc++.mk
 | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
| #include $(INCLUDE_DIR)/autotools.mk
 | ||||
| 
 | ||||
| define Package/tracebox | ||||
|   SECTION:=net | ||||
|   CATEGORY:=Network | ||||
|   TITLE:=tracebox | ||||
|   DEPENDS:=+liblua +libpcap +libpthread +librt +curl +libjson-c +libnetfilter-queue +libstdcpp | ||||
| endef | ||||
| 
 | ||||
| define Package/tracebox/description | ||||
|   Tracebox is a tool that allows to detect middleboxes on any paths, i.e., | ||||
| between a source and any destination. Tracebox can be viewed as a tool similar | ||||
| to traceroute as it uses ICMP replies to identify changes in the packets. | ||||
| endef | ||||
| 
 | ||||
| CONFIGURE_VARS += \
 | ||||
| 	ac_cv_header_lua_h=no \
 | ||||
| 	ax_header_version_match=yes | ||||
| 
 | ||||
| CONFIGURE_ARGS += --enable-sniffer --enable-curl --with-libpcap="$(STAGING_DIR)/usr/include/" | ||||
| #CONFIGURE_ARGS += --enable-sniffer --enable-curl
 | ||||
| #CONFIGURE_ARGS += --disable-shared --enable-static
 | ||||
| 
 | ||||
| EXTRA_CPPFLAGS += -fpermissive -Wno-variadic-macros | ||||
| 
 | ||||
| TARGET_CFLAGS += -D_GNU_SOURCE | ||||
| 
 | ||||
| define Package/tracebox/install | ||||
| 	$(INSTALL_DIR) $(1)/usr/sbin | ||||
| 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/tracebox/tracebox $(1)/usr/sbin/tracebox | ||||
| endef | ||||
| 
 | ||||
| $(eval $(call BuildPackage,tracebox)) | ||||
							
								
								
									
										33
									
								
								tracebox/patches/101-build-fixes.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								tracebox/patches/101-build-fixes.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,33 @@ | |||
| diff --git a/noinst/libcrafter/libcrafter/crafter/Fields/NumericFields.cpp b/noinst/libcrafter/libcrafter/crafter/Fields/NumericFields.cpp
 | ||||
| index 86b77e6..7de1eb7 100644
 | ||||
| --- a/noinst/libcrafter/libcrafter/crafter/Fields/NumericFields.cpp
 | ||||
| +++ b/noinst/libcrafter/libcrafter/crafter/Fields/NumericFields.cpp
 | ||||
| @@ -270,8 +270,15 @@ Int64Field::Int64Field(const std::string& name, size_t nword, size_t nbyte) :
 | ||||
|  	offset = nword * 4 + nbyte; | ||||
|  } | ||||
|   | ||||
| +static string genString(uint64_t val)
 | ||||
| +{
 | ||||
| +	char temp[21];
 | ||||
| +	sprintf(temp, "%llu", val);
 | ||||
| +	return temp;
 | ||||
| +}
 | ||||
| +
 | ||||
|  void Int64Field::PrintValue(std::ostream& str) const { | ||||
| -	str << GetName() << " = " << dec << (uint64_t)human;
 | ||||
| +	str << GetName() << " = " << dec << genString(human);
 | ||||
|  } | ||||
|   | ||||
|  FieldInfo* Int64Field::Clone() const { | ||||
| diff --git a/noinst/libcrafter/libcrafter/crafter/Packet.h b/noinst/libcrafter/libcrafter/crafter/Packet.h
 | ||||
| index 2fa813d..25c0fa1 100644
 | ||||
| --- a/noinst/libcrafter/libcrafter/crafter/Packet.h
 | ||||
| +++ b/noinst/libcrafter/libcrafter/crafter/Packet.h
 | ||||
| @@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | ||||
|  #include <vector> | ||||
|  #include <sys/socket.h> | ||||
|  #include <pcap.h> | ||||
| +#include <pthread.h>
 | ||||
|   | ||||
|  #include "Crafter.h" | ||||
|  #include "Utils/RawSocket.h" | ||||
							
								
								
									
										19
									
								
								tracebox/patches/102-configure.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								tracebox/patches/102-configure.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,19 @@ | |||
| --- a/configure.ac	2018-07-20 16:15:42.284633906 +0200
 | ||||
| +++ b/configure.ac	2018-07-20 16:16:09.812296939 +0200
 | ||||
| @@ -162,16 +162,8 @@
 | ||||
|       ;; | ||||
|    *) | ||||
|       AC_MSG_RESULT($withval) | ||||
| -     if test -f $withval/pcap.h -a \
 | ||||
| -         -f $withval/libpcap.a -a \
 | ||||
| -         -d $withval/pcap; then
 | ||||
| -        owd=`pwd`
 | ||||
| -        if cd $withval; then withval=`pwd`; cd $owd; fi
 | ||||
|          PCAPINC="-I$withval -I$withval/bpf" | ||||
|          PCAPLIB="-L$withval -lpcap" | ||||
| -     else
 | ||||
| -        AC_ERROR(pcap.h, net/bpf.h, or libpcap.a not found in $withval)
 | ||||
| -     fi
 | ||||
|       ;; | ||||
|    esac ], | ||||
|  [ if test -f ${prefix}/include/pcap.h; then | ||||
							
								
								
									
										24
									
								
								tracebox/patches/103-configure.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								tracebox/patches/103-configure.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,24 @@ | |||
| --- a/noinst/libcrafter/libcrafter/configure.ac.anc	2018-07-20 16:45:10.760534965 +0200
 | ||||
| +++ b/noinst/libcrafter/libcrafter/configure.ac	2018-07-20 16:46:03.339973975 +0200
 | ||||
| @@ -29,21 +29,8 @@
 | ||||
|       ;; | ||||
|    *) | ||||
|       AC_MSG_RESULT($withval) | ||||
| -     if test -f $withval/pcap.h -a -f $withval/libpcap.a; then
 | ||||
| -        owd=`pwd`
 | ||||
| -        if cd $withval; then withval=`pwd`; cd $owd; fi
 | ||||
|  	PCAPINC="-I$withval -I$withval/bpf" | ||||
|  	PCAPLIB="-L$withval -lpcap" | ||||
| -     elif test -f $withval/include/pcap.h -a \
 | ||||
| -	       -f $withval/include/net/bpf.h -a \
 | ||||
| -	       -f $withval/lib/libpcap.a; then
 | ||||
| -	owd=`pwd`
 | ||||
| -	if cd $withval; then withval=`pwd`; cd $owd; fi
 | ||||
| -	PCAPINC="-I$withval/include"
 | ||||
| -	PCAPLIB="-L$withval/lib -lpcap"
 | ||||
| -     else
 | ||||
| -        AC_ERROR(pcap.h, net/bpf.h, or libpcap.a not found in $withval)
 | ||||
| -     fi
 | ||||
|       ;; | ||||
|    esac ], | ||||
|  [ if test -f ${prefix}/include/pcap.h; then | ||||
							
								
								
									
										31
									
								
								tracebox/patches/104-ns_name_compress.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								tracebox/patches/104-ns_name_compress.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,31 @@ | |||
| --- a/noinst/libcrafter/libcrafter/crafter/Protocols/DNSQuery.cpp	2018-07-20 17:28:21.252256760 +0200
 | ||||
| +++ b/noinst/libcrafter/libcrafter/crafter/Protocols/DNSQuery.cpp	2018-07-20 17:28:35.092103432 +0200
 | ||||
| @@ -85,7 +85,7 @@
 | ||||
|   | ||||
|  size_t DNS::DNSQuery::Compress() { | ||||
|  	/* Put data into the buffer */ | ||||
| -	int nbytes = ns_name_compress(qname.c_str(), cqname, sizeof(cqname) , NULL,
 | ||||
| +	int nbytes = dn_comp(qname.c_str(), cqname, sizeof(cqname) , NULL,
 | ||||
|  			NULL); | ||||
|  	if(nbytes == -1) | ||||
|  		throw std::runtime_error("DNS::DNSQuery::Compress() : Error compressing the domain name provided"); | ||||
| --- a/noinst/libcrafter/libcrafter/crafter/Protocols/DNSAnswer.cpp	2018-07-20 17:37:46.614513337 +0200
 | ||||
| +++ b/noinst/libcrafter/libcrafter/crafter/Protocols/DNSAnswer.cpp	2018-07-20 17:38:24.298131516 +0200
 | ||||
| @@ -209,7 +209,7 @@
 | ||||
|   | ||||
|  size_t DNS::DNSAnswer::CompressName() { | ||||
|  	/* Put data into the buffer */ | ||||
| -	int nbytes = ns_name_compress(qname.c_str(), cqname, sizeof(cqname), NULL,
 | ||||
| +	int nbytes = dn_comp(qname.c_str(), cqname, sizeof(cqname), NULL,
 | ||||
|  			NULL); | ||||
|  	if(nbytes == -1) | ||||
|  		throw std::runtime_error("DNSAnswer::CompressName() : Error compressing the domain name provided"); | ||||
| @@ -224,7 +224,7 @@
 | ||||
|  size_t DNS::DNSAnswer::CompressRData() { | ||||
|  	if (rdata.find_first_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIKKLMNOPQRSTUVWXYZ") != std::string::npos) { | ||||
|  		/* Put data into the buffer */ | ||||
| -		int nbytes = ns_name_compress(rdata.c_str(), crdata, sizeof(crdata),
 | ||||
| +		int nbytes = dn_comp(rdata.c_str(), crdata, sizeof(crdata),
 | ||||
|  				NULL,  NULL); | ||||
|  		if(nbytes == -1) | ||||
|  			throw std::runtime_error("DNSAnswer::CompressRData() : Error compressing the domain name provided"); | ||||
							
								
								
									
										32
									
								
								tracebox/patches/202-fix-lua-include-hpp.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								tracebox/patches/202-fix-lua-include-hpp.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,32 @@ | |||
| --- a/src/tracebox/lua.cc	2018-07-20 18:03:00.439624791 +0200
 | ||||
| +++ b/src/tracebox/lua.cc	2018-07-20 18:03:38.035263456 +0200
 | ||||
| @@ -6,7 +6,12 @@
 | ||||
|   */ | ||||
|   | ||||
|   | ||||
| +extern "C" {
 | ||||
| +#include "lua.h"
 | ||||
| +#include "lualib.h"
 | ||||
| +#include "lauxlib.h"
 | ||||
| +}
 | ||||
|  #include "lua/lua_packet.hpp" | ||||
|  #include "config.h" | ||||
|   | ||||
|  extern lua_State* l_init(); | ||||
| --- a/src/tracebox/lua/lua_base.hpp	2018-08-06 09:43:49.589813406 +0200
 | ||||
| +++ b/src/tracebox/lua/lua_base.hpp	2018-08-06 09:44:27.773454118 +0200
 | ||||
| @@ -13,8 +13,12 @@
 | ||||
|  #include <crafter.h> | ||||
|   | ||||
|  #define LUA_COMPAT_ALL | ||||
| -#include <lua.hpp>
 | ||||
| -#include <lua.h>
 | ||||
| +extern "C" {
 | ||||
| +#include "lua.h"
 | ||||
| +#include "lualib.h"
 | ||||
| +#include "lauxlib.h"
 | ||||
| +}
 | ||||
| +
 | ||||
|   | ||||
|  #include "config.h" | ||||
|   | ||||
							
								
								
									
										10
									
								
								tracebox/patches/204-fix-lua-namespace-crafter.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								tracebox/patches/204-fix-lua-namespace-crafter.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| --- a/src/tracebox/lua.cc	2018-07-20 20:04:08.984285796 +0200
 | ||||
| +++ b/src/tracebox/lua.cc	2018-07-20 20:04:22.336156705 +0200
 | ||||
| @@ -12,6 +12,7 @@
 | ||||
|  #include "lauxlib.h" | ||||
|  } | ||||
|  #include "config.h" | ||||
| +#include "PartialHeader.h"
 | ||||
|   | ||||
|  extern lua_State* l_init(); | ||||
|   | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue