Package: netdiag
Version: 1.0-13
Severity: wishlist

Hello there,

this package has three FTBFS against GNU/kFreeBSD,
so I will try to document the present situation.

netwatch: Will require heavy patching to work, since it
          uses NETLINK with Linux. FTBFS remains.

statnet: Also needs substantial patching, since SOCK_RAW
         in GNU/kFreeBSD can not replace SOCK_PACKET.
         A simple patch produces a compilable source,
         i.e., removes a FTBFS. The executable will fail
         at execution time.

netload: Relies on "/proc/net/dev" for number crunching.
         This file is presently not working properly in
         GNU/kFreeBSD. The executable is compilable and
         will work once "/proc/net/dev" contains the
         updated statistics that is expected from GNU/Linux.

strobe, tcpspray: Work out of the box.

tcpblast: Upstream makes mistakes in distinguishing IPv4
          and IPv6, which are forgivable with GNU/Linux,
          bit not so with GNU/kFreeBSD. Once these are
          mended the attempted functionality is present.

trafshow: An elementary patch removes the FTBFS and produces
          a functional utility.


Using the attached patch, and inhibiting all traces of "netwatch"
in "debian/rules", the package can be built also on GNU/kFreeBSD,
but as said aboev, "statnet" and "netload" presently remain useless.


Best regards,
Mats Erik Andersson, DM
Description: Adaptions to GNU/kFreeBSD.
 statnet: A replacement macro helps to get
 compilable code, but it still fails at execution.
 SOCK_RAW cannot replace SOCK_PACKET, so heavy
 rewriting would be necessary.
 .
 tcpblast: The upstream code is corrupt also for
 GNU/Linux, but that kernel is more forgiving.
 The correction implements a working service
 also for GNU/kFreeBSD.
 .
 trafshow: A simple addition of _BSD_SOURCE is
 sufficient to restore functionality for
 GNU/kFreeBSD.
 .
 netload: This executable is functional in itself,
 but fails since "/proc/net/dev" is presently broken
 in GNU/kFreeBSD.
 .
 netwatch: The code uses NETLINK with Linux, so can
 not be easily ported. No hope of even compiling
 the source in GNU/kFreeBSD.
Author: Mats Erik Andersson <deb...@gisladisker.se>
Forwarded: no
Last-Update: 2010-12-29

--- netdiag-1.0.debian/statnet-3.8/statnet.c
+++ netdiag-1.0/statnet-3.8/statnet.c
@@ -25,6 +25,9 @@
 #ifndef DIPC_SIG_READER
 #define DIPC_SIG_READER SIGURG	/* for compilation on non-DIPC systems */
 #endif
+#ifndef SIGPWR
+#define SIGPWR SIGINFO		/* fallback for GNU/kFreeBSD */
+#endif
 #ifndef DIPC_SIG_WRITER
 #define DIPC_SIG_WRITER SIGPWR	/* for compilation on non-DIPC systems */
 #endif
--- netdiag-1.0.debian/statnet-3.8/statnetd.c
+++ netdiag-1.0/statnet-3.8/statnetd.c
@@ -27,6 +27,9 @@
 #ifndef DIPC_SIG_READER
 #define DIPC_SIG_READER SIGURG	/* for compilation on non-DIPC systems */
 #endif
+#ifndef SIGPWR
+#define SIGPWR SIGINFO		/* fallback for GNU/kFreeBSD */
+#endif
 #ifndef DIPC_SIG_WRITER
 #define DIPC_SIG_WRITER SIGPWR	/* for compilation on non-DIPC systems */
 #endif
--- netdiag-1.0.debian/tcpblast-20011111/tcpblast.c
+++ netdiag-1.0/tcpblast-20011111/tcpblast.c
@@ -601,9 +601,12 @@
 			case 'S':
 				  opt_source = 1;
 #ifdef HAVE_INET_PTON
+				  if (family != PF_UNSPEC)
+					  af = family;
+
 				  errpton = inet_pton(af, optarg, &source);
 #ifdef HAVE_IN6_ADDR
-				  if (errpton <= 0) {
+				  if ((errpton <= 0) && (family == PF_UNSPEC)) {
 					  af = AF_INET6;
 					  errpton = inet_pton(af, optarg, &source6);
 				  }
@@ -714,10 +717,11 @@
 		f = socket(ai->ai_family, ai->ai_socktype, 0);
 		if (f < 0) continue;
 		sndbuf(f, setbufsize, name);
-		setmaxseg(f, maxseg, name);
-		if (af == AF_INET)  bind_local (f, af, lport, source);
+		if (tcp)
+			setmaxseg(f, maxseg, name);
+		if (ai->ai_family == AF_INET)  bind_local (f, ai->ai_family, lport, source);
 #ifdef HAVE_IN6_ADDR
-		if (af == AF_INET6) bind_local6(f, af, lport, source6);
+		if (ai->ai_family == AF_INET6) bind_local6(f, ai->ai_family, lport, source6);
 #endif /* HAVE_IN6_ADDR */
 		if (connect(f, (struct sockaddr *) ai->ai_addr, ai->ai_addrlen) < 0) {
 			close(f); f = -1; continue;
--- netdiag-1.0.debian/trafshow-5.2.3/parse_ip.c
+++ netdiag-1.0/trafshow-5.2.3/parse_ip.c
@@ -11,6 +11,10 @@
 #include <config.h>
 #endif
 
+#ifdef __FreeBSD_kernel__
+#  define _BSD_SOURCE 1
+#endif
+
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>

Attachment: signature.asc
Description: Digital signature

Reply via email to