Requirements for adding new tools

Ralph Siemsen ralphs at netwinder.org
Thu Mar 30 08:52:42 PST 2006


Dag Wieers wrote:

> I'm very interested to have tcptraceroute functionality in busybox in 
> order to have bootable rescue images with the capability to check if 
> firewalls are configured correctly and trace where the problems are.
> 
> Is this a reasonable request or somehow (technically or 
> philosophically) impossible or undesirable ?

Are you just looking for tcptraceroute itself, or do you actually want 
it _in_ busybox's single executable?

Adding it (as a separate app) is easy, especially if you look at 
buildroot-derived projects that have already made the effort :)

Attached are Config.in and tcptraceroute.mk files, taken from the 
aspisos project.  If you create a packages/tcptraceroute and put these 
files in there, then edit packages/Config.in so that it sources the new 
subdirectory, that should be all that needs to be done.  (I haven't 
tried this against the latest SVN of buildroot, so they may need further 
modification).

There are a lot more "gems" hiding in various buildroot-derivative 
projects.  Should effort be made to get these merged into buildroot? 
This is a tough call, because the time to review each change, and then 
the ongoing maintenance to keep "allyesconfig" working increases for the 
builroot maintainers.  And do we really need all 18,999 packages that 
certain full-fledged distributions pride themselves for having?

OTOH, there are genuine useful bug fixes floating about that would 
probably benefit all buildrooters if they made their way into the main 
tree.  (I can hear you asking for specific examples, I will forward the 
next one I come across to the list, I promise!)

-R
-------------- next part --------------
config BR2_PACKAGE_TCPTRACEROUTE
	bool "tcptraceroute"
	default n
	select BR2_PACKAGE_LIBNET
	help
	  tcptraceroute is a traceroute implementation using TCP packets.

	  The more traditional traceroute(8) sends out either UDP or 
	  ICMP ECHO packets with a TTL of one, and increments the TTL until 
	  the destination has been reached. By printing the gateways that 
	  generate ICMP time exceeded messages along the way, it is able 
	  to determine the path packets are taking to reach the destination.

	  The problem is that with the widespread use of firewalls on 
	  the modern Internet, many of the packets that traceroute(8) 
	  sends out end up being filtered, making it impossible to completely 
	  trace the path to the destination. However, in many cases, these 
	  firewalls will permit inbound TCP packets to specific ports that 
	  hosts sitting behind the firewall are listening for connections on. 
	  By sending out TCP SYN packets instead of UDP or ICMP ECHO packets, 
	  tcptraceroute is able to bypass the most common firewall filters. 

	  http://michael.toren.net/code/tcptraceroute/
-------------- next part --------------
diff -N -r -c tcptraceroute-1.5beta6/configure tcptraceroute-1.5beta6-patched/configure
*** tcptraceroute-1.5beta6/configure	Tue Dec 28 03:39:43 2004
--- tcptraceroute-1.5beta6-patched/configure	Sun Aug  7 17:56:31 2005
***************
*** 4670,4943 ****
  done
  
  
- # Is this Solaris?
- echo "$as_me:$LINENO: checking for Solaris" >&5
- echo $ECHO_N "checking for Solaris... $ECHO_C" >&6
- if test "$cross_compiling" = yes; then
-   { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
- echo "$as_me: error: cannot run test program while cross compiling" >&2;}
-    { (exit 1); exit 1; }; }
- else
-   cat >conftest.$ac_ext <<_ACEOF
- #line $LINENO "configure"
- #include "confdefs.h"
- 
- #ifdef F77_DUMMY_MAIN
- #  ifdef __cplusplus
-      extern "C"
- #  endif
-    int F77_DUMMY_MAIN() { return 1; }
- #endif
- int
- main ()
- {
- 
- #if defined (__SVR4) && defined (__sun)
- 	exit(0);
- #else
- 	exit(-1);
- #endif
- 
-   ;
-   return 0;
- }
- 
- _ACEOF
- rm -f conftest$ac_exeext
- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-   (eval $ac_link) 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-   (eval $ac_try) 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); }; }; then
- 
- 		echo "$as_me:$LINENO: result: yes" >&5
- echo "${ECHO_T}yes" >&6
- 
- cat >>confdefs.h <<\_ACEOF
- #define HAVE_SOLARIS 1
- _ACEOF
- 
- 		HAVE_SOLARIS=yes
- 
- else
-   echo "$as_me: program exited with status $ac_status" >&5
- echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ( exit $ac_status )
- 
- 		echo "$as_me:$LINENO: result: no" >&5
- echo "${ECHO_T}no" >&6
- 
- fi
- rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
- fi
- 
- # Is this BSDI?
- echo "$as_me:$LINENO: checking for BSDI" >&5
- echo $ECHO_N "checking for BSDI... $ECHO_C" >&6
- if test "$cross_compiling" = yes; then
-   { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
- echo "$as_me: error: cannot run test program while cross compiling" >&2;}
-    { (exit 1); exit 1; }; }
- else
-   cat >conftest.$ac_ext <<_ACEOF
- #line $LINENO "configure"
- #include "confdefs.h"
- 
- #ifdef F77_DUMMY_MAIN
- #  ifdef __cplusplus
-      extern "C"
- #  endif
-    int F77_DUMMY_MAIN() { return 1; }
- #endif
- int
- main ()
- {
- 
- #if defined (__bsdi__)
- 	exit(0);
- #else
- 	exit(-1);
- #endif
- 
-   ;
-   return 0;
- }
- 
- _ACEOF
- rm -f conftest$ac_exeext
- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-   (eval $ac_link) 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-   (eval $ac_try) 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); }; }; then
- 
- 		echo "$as_me:$LINENO: result: yes" >&5
- echo "${ECHO_T}yes" >&6
- 
- cat >>confdefs.h <<\_ACEOF
- #define HAVE_BSDI 1
- _ACEOF
- 
- 		HAVE_BSDI=yes
- 
- else
-   echo "$as_me: program exited with status $ac_status" >&5
- echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ( exit $ac_status )
- 
- 		echo "$as_me:$LINENO: result: no" >&5
- echo "${ECHO_T}no" >&6
- 
- fi
- rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
- fi
- 
- # Is this NetBSD?
- echo "$as_me:$LINENO: checking for NetBSD" >&5
- echo $ECHO_N "checking for NetBSD... $ECHO_C" >&6
- if test "$cross_compiling" = yes; then
-   { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
- echo "$as_me: error: cannot run test program while cross compiling" >&2;}
-    { (exit 1); exit 1; }; }
- else
-   cat >conftest.$ac_ext <<_ACEOF
- #line $LINENO "configure"
- #include "confdefs.h"
- 
- #ifdef F77_DUMMY_MAIN
- #  ifdef __cplusplus
-      extern "C"
- #  endif
-    int F77_DUMMY_MAIN() { return 1; }
- #endif
- int
- main ()
- {
- 
- #if defined (__NetBSD__)
- 	exit(0);
- #else
- 	exit(-1);
- #endif
- 
-   ;
-   return 0;
- }
- 
- _ACEOF
- rm -f conftest$ac_exeext
- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-   (eval $ac_link) 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-   (eval $ac_try) 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); }; }; then
- 
- 		echo "$as_me:$LINENO: result: yes" >&5
- echo "${ECHO_T}yes" >&6
- 
- cat >>confdefs.h <<\_ACEOF
- #define HAVE_NETBSD 1
- _ACEOF
- 
- 		HAVE_NETBSD=yes
- 
- else
-   echo "$as_me: program exited with status $ac_status" >&5
- echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ( exit $ac_status )
- 
- 		echo "$as_me:$LINENO: result: no" >&5
- echo "${ECHO_T}no" >&6
- 
- fi
- rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
- fi
- 
- # Is this MacOS X?
- echo "$as_me:$LINENO: checking for MacOS X" >&5
- echo $ECHO_N "checking for MacOS X... $ECHO_C" >&6
- if test "$cross_compiling" = yes; then
-   { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
- echo "$as_me: error: cannot run test program while cross compiling" >&2;}
-    { (exit 1); exit 1; }; }
- else
-   cat >conftest.$ac_ext <<_ACEOF
- #line $LINENO "configure"
- #include "confdefs.h"
- 
- #ifdef F77_DUMMY_MAIN
- #  ifdef __cplusplus
-      extern "C"
- #  endif
-    int F77_DUMMY_MAIN() { return 1; }
- #endif
- int
- main ()
- {
- 
- #if defined (__APPLE__) && defined (__MACH__)
- 	exit(0);
- #else
- 	exit(-1);
- #endif
- 
-   ;
-   return 0;
- }
- 
- _ACEOF
- rm -f conftest$ac_exeext
- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-   (eval $ac_link) 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-   (eval $ac_try) 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); }; }; then
- 
- 		echo "$as_me:$LINENO: result: yes" >&5
- echo "${ECHO_T}yes" >&6
- 
- cat >>confdefs.h <<\_ACEOF
- #define HAVE_MACOSX 1
- _ACEOF
- 
- 		HAVE_MACOSX=yes
- 
- else
-   echo "$as_me: program exited with status $ac_status" >&5
- echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ( exit $ac_status )
- 
- 		echo "$as_me:$LINENO: result: no" >&5
- echo "${ECHO_T}no" >&6
- 
- fi
- rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
- fi
- 
  # Handle --enable-noselect-default
  # Check whether --enable-noselect-default or --disable-noselect-default was given.
  if test "${enable_noselect_default+set}" = set; then
--- 4670,4675 ----
-------------- next part --------------
#############################################################
#
# tcptraceroute
#
#############################################################

TCPTRACEROUTE_SOURCE_URL=http://michael.toren.net/code/tcptraceroute/
TCPTRACEROUTE_SOURCE=tcptraceroute-1.5beta6.tar.gz
TCPTRACEROUTE_DIR=$(BUILD_DIR)/tcptraceroute-1.5beta6
TCPTRACEROUTE_TARGET_BINARY:=usr/bin/tcptraceroute

$(DL_DIR)/$(TCPTRACEROUTE_SOURCE):
	 $(WGET) -P $(DL_DIR) $(TCPTRACEROUTE_SOURCE_URL)/$(TCPTRACEROUTE_SOURCE) 

$(TCPTRACEROUTE_DIR)/.unpacked: $(DL_DIR)/$(TCPTRACEROUTE_SOURCE)
	zcat $(DL_DIR)/$(TCPTRACEROUTE_SOURCE) | tar -C $(BUILD_DIR) -xvf -
	toolchain/patch-kernel.sh $(TCPTRACEROUTE_DIR) package/tcptraceroute/ tcptraceroute\*.patch
	touch $(TCPTRACEROUTE_DIR)/.unpacked

$(TCPTRACEROUTE_DIR)/.configured: $(TCPTRACEROUTE_DIR)/.unpacked
	(cd $(TCPTRACEROUTE_DIR); rm -rf config.cache; \
		BUILD_CC=$(TARGET_CC) HOSTCC=$(HOSTCC) \
		$(TARGET_CONFIGURE_OPTS) \
		CFLAGS="$(TARGET_CFLAGS)" \
		./configure \
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--prefix=$(STAGING_DIR) \
		--exec-prefix=/usr \
		--bindir=/usr/bin \
		--sbindir=/usr/sbin \
		--sysconfdir=/etc \
		--datadir=/usr/share \
		--localstatedir=/var \
		--mandir=/usr/man \
		--infodir=/usr/info \
		--libdir=$(STAGING_DIR)/lib \
		--with-shared \
		--without-debug \
		$(DISABLE_NLS) \
	);
	touch  $(TCPTRACEROUTE_DIR)/.configured


$(TCPTRACEROUTE_DIR)/tcptraceroute: $(TCPTRACEROUTE_DIR)/.configured
	$(MAKE) \
                AR=$(TARGET_CROSS)ar \
                AS=$(TARGET_CROSS)as \
                LD=$(TARGET_CROSS)ld \
                NM=$(TARGET_CROSS)nm \
                CC=$(TARGET_CROSS)gcc \
                GCC=$(TARGET_CROSS)gcc \
                CXX=$(TARGET_CROSS)g++ \
                RANLIB=$(TARGET_CROSS)ranlib \
		CFLAGS="$(TARGET_CFLAGS)" \
		LDFLAGS="-L$(STAGING_DIR)/lib" \
		LIBS="-lpcap -lnet" \
		INCLS="-I. -I$(STAGING_DIR)/include" \
		-C $(TCPTRACEROUTE_DIR)

$(TARGET_DIR)/$(TCPTRACEROUTE_TARGET_BINARY): $(TCPTRACEROUTE_DIR)/tcptraceroute
	install $(TCPTRACEROUTE_DIR)/tcptraceroute $(TARGET_DIR)/usr/bin/

tcptraceroute: uclibc libnet $(TARGET_DIR)/$(TCPTRACEROUTE_TARGET_BINARY)

tcptraceroute-source: $(DL_DIR)/$(TCPTRACEROUTE_SOURCE)

tcptraceroute-clean:
	-$(MAKE) -C $(TCPTRACEROUTE_DIR) clean

tcptraceroute-uninstall:
	#$(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(TCPTRACEROUTE_DIR) uninstall

tcptraceroute-dirclean:
	rm -rf $(TCPTRACEROUTE_DIR)

#############################################################
#
## Toplevel Makefile options
#
##############################################################
ifeq ($(strip $(BR2_PACKAGE_TCPTRACEROUTE)),y)
TARGETS+=tcptraceroute
endif


More information about the busybox mailing list