1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
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 <debian@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>
|