summaryrefslogtreecommitdiff
path: root/packages/ndisc6
diff options
context:
space:
mode:
authorJamie Lenehan <lenehan@twibble.org>2006-08-14 09:03:21 +0000
committerJamie Lenehan <lenehan@twibble.org>2006-08-14 09:03:21 +0000
commit29067741a826654398e69fdae4239ac21694871e (patch)
tree3b80546e11b9323ee1c41a5e99c7008fe8991e52 /packages/ndisc6
parent96df979cd661c26737e6f9f77f6d56702f4ef456 (diff)
ndisc6: Add ndisc6 which contains tools for IPV6 neighbor discover, IPV6
router discovery, an IPv4/IPv6 performance measurement tool, and an IPv6 UDP+TCP traceroute implementation.
Diffstat (limited to 'packages/ndisc6')
-rw-r--r--packages/ndisc6/.mtn2git_empty0
-rw-r--r--packages/ndisc6/files/.mtn2git_empty0
-rw-r--r--packages/ndisc6/files/acinclude.m4197
-rw-r--r--packages/ndisc6/files/autoconf-older-version.patch14
-rw-r--r--packages/ndisc6/ndisc6_0.6.7.bb62
5 files changed, 273 insertions, 0 deletions
diff --git a/packages/ndisc6/.mtn2git_empty b/packages/ndisc6/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/ndisc6/.mtn2git_empty
diff --git a/packages/ndisc6/files/.mtn2git_empty b/packages/ndisc6/files/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/ndisc6/files/.mtn2git_empty
diff --git a/packages/ndisc6/files/acinclude.m4 b/packages/ndisc6/files/acinclude.m4
new file mode 100644
index 0000000000..5360fff5d2
--- /dev/null
+++ b/packages/ndisc6/files/acinclude.m4
@@ -0,0 +1,197 @@
+# _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
+# ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
+# --------------------------------------------------------------
+# Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99')
+# by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails,
+# try again with each compiler option in the space-separated OPTION-LIST; if one
+# helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE,
+# else ACTION-IF-UNAVAILABLE.
+AC_DEFUN([_AC_C_STD_TRY],
+[AC_MSG_CHECKING([for $CC option to accept ISO ]m4_translit($1, [c], [C]))
+AC_CACHE_VAL(ac_cv_prog_cc_$1,
+[ac_cv_prog_cc_$1=no
+ac_save_CC=$CC
+AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
+for ac_arg in '' $4
+do
+ CC="$ac_save_CC $ac_arg"
+ _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg])
+ test "x$ac_cv_prog_cc_$1" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+])# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_$1" in
+ x)
+ AC_MSG_RESULT([none needed]) ;;
+ xno)
+ AC_MSG_RESULT([unsupported]) ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_$1"
+ AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;;
+esac
+AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6])
+])# _AC_C_STD_TRY
+
+# _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
+# ----------------------------------------------------------------
+# If the C compiler is not in ISO C99 mode by default, try to add an
+# option to output variable CC to make it so. This macro tries
+# various options that select ISO C99 on some system or another. It
+# considers the compiler to be in ISO C99 mode if it handles mixed
+# code and declarations, _Bool, inline and restrict.
+AC_DEFUN([_AC_PROG_CC_C99],
+[_AC_C_STD_TRY([c99],
+[[#include <stdarg.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <stdio.h>
+
+struct incomplete_array
+{
+ int datasize;
+ double data[];
+};
+
+struct named_init {
+ int number;
+ const wchar_t *name;
+ double average;
+};
+
+typedef const char *ccp;
+
+static inline int
+test_restrict(ccp restrict text)
+{
+ // See if C++-style comments work.
+ // Iterate through items via the restricted pointer.
+ // Also check for declarations in for loops.
+ for (unsigned int i = 0; *(text+i) != '\0'; ++i)
+ continue;
+ return 0;
+}
+
+// Check varargs and va_copy work.
+static void
+test_varargs(const char *format, ...)
+{
+ va_list args;
+ va_start(args, format);
+ va_list args_copy;
+ va_copy(args_copy, args);
+
+ const char *str;
+ int number;
+ float fnumber;
+
+ while (*format)
+ {
+ switch (*format++)
+ {
+ case 's': // string
+ str = va_arg(args_copy, const char *);
+ break;
+ case 'd': // int
+ number = va_arg(args_copy, int);
+ break;
+ case 'f': // float
+ fnumber = (float) va_arg(args_copy, double);
+ break;
+ default:
+ break;
+ }
+ }
+ va_end(args_copy);
+ va_end(args);
+}
+]],
+[[
+ // Check bool and long long datatypes.
+ _Bool success = false;
+ long long int bignum = -1234567890LL;
+ unsigned long long int ubignum = 1234567890uLL;
+
+ // Check restrict.
+ if (test_restrict("String literal") != 0)
+ success = true;
+ char *restrict newvar = "Another string";
+
+ // Check varargs.
+ test_varargs("s, d' f .", "string", 65, 34.234);
+
+ // Check incomplete arrays work.
+ struct incomplete_array *ia =
+ malloc(sizeof(struct incomplete_array) + (sizeof(double) * 10));
+ ia->datasize = 10;
+ for (int i = 0; i < ia->datasize; ++i)
+ ia->data[i] = (double) i * 1.234;
+
+ // Check named initialisers.
+ struct named_init ni = {
+ .number = 34,
+ .name = L"Test wide string",
+ .average = 543.34343,
+ };
+
+ ni.number = 58;
+
+ int dynamic_array[ni.number];
+ dynamic_array[43] = 543;
+
+ // work around unused variable warnings
+ return bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x';
+]],
+dnl Try
+dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999)
+dnl AIX -qlanglvl=extc99 (unused restrictive mode: -qlanglvl=stdc99)
+dnl Intel ICC -c99
+dnl IRIX -c99
+dnl Solaris (unused because it causes the compiler to assume C99 semantics for
+dnl library functions, and this is invalid before Solaris 10: -xc99)
+dnl Tru64 -c99
+dnl with extended modes being tried first.
+[[-std=gnu99 -c99 -qlanglvl=extc99]], [$1], [$2])[]dnl
+])# _AC_PROG_CC_C99
+
+# AC_PROG_CC_C99
+# --------------
+AC_DEFUN([AC_PROG_CC_C99],
+[ AC_REQUIRE([AC_PROG_CC])dnl
+ _AC_PROG_CC_C99
+])
+
+# AC_USE_SYSTEM_EXTENSIONS
+# ------------------------
+# Enable extensions on systems that normally disable them,
+# typically due to standards-conformance issues.
+AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+[
+ AC_BEFORE([$0], [AC_COMPILE_IFELSE])
+ AC_BEFORE([$0], [AC_RUN_IFELSE])
+
+ AC_REQUIRE([AC_GNU_SOURCE])
+ AC_REQUIRE([AC_AIX])
+ AC_REQUIRE([AC_MINIX])
+
+ AH_VERBATIM([__EXTENSIONS__],
+[/* Enable extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif])
+ AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+ [ac_cv_safe_to_define___extensions__],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+# define __EXTENSIONS__ 1
+ AC_INCLUDES_DEFAULT])],
+ [ac_cv_safe_to_define___extensions__=yes],
+ [ac_cv_safe_to_define___extensions__=no])])
+ test $ac_cv_safe_to_define___extensions__ = yes &&
+ AC_DEFINE([__EXTENSIONS__])
+ AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+])
diff --git a/packages/ndisc6/files/autoconf-older-version.patch b/packages/ndisc6/files/autoconf-older-version.patch
new file mode 100644
index 0000000000..0ab0fd13bb
--- /dev/null
+++ b/packages/ndisc6/files/autoconf-older-version.patch
@@ -0,0 +1,14 @@
+Patch the required version back to 2.59
+We'll include the missing macros via acinclude.m4
+
+--- ndisc6-0.6.7/configure.ac~ 2006-08-14 16:46:06.000000000 +1000
++++ ndisc6-0.6.7/configure.ac 2006-08-14 16:46:06.000000000 +1000
+@@ -21,7 +21,7 @@
+
+ AC_COPYRIGHT([Copyright (C) 2005-2006 Remi Denis-Courmont])
+ AC_INIT(ndisc6, 0.6.7, rdenis@simphalempin.com)
+-AC_PREREQ(2.59c)
++AC_PREREQ(2.59)
+ INVOCATION="$0 $*"
+
+ AS_MESSAGE(checking system...)
diff --git a/packages/ndisc6/ndisc6_0.6.7.bb b/packages/ndisc6/ndisc6_0.6.7.bb
new file mode 100644
index 0000000000..a9e2118b39
--- /dev/null
+++ b/packages/ndisc6/ndisc6_0.6.7.bb
@@ -0,0 +1,62 @@
+SECTION = "console/network"
+DESCRIPTION = "This package includes some useful diagnostics tools for \
+IPv6 networks, including ndisc6, rdisc6, tcptraceroute6 and traceroute6."
+SECTION = "console/network"
+MAINTAINER = "Jamie Lenehan <lenehan@twibble.org>"
+HOMEPAGE = "http://www.simphalempin.com/dev/ndisc6/"
+LICENSE = "GPL"
+PR = "r0"
+
+# The tcptraceroute6 and tracert6 commands depend on rltraceroute6 to
+# perform the actual trace operation.
+RDEPENDS_${PN}-tcptraceroute6 = "${PN}-rltraceroute6"
+RDEPENDS_${PN}-tracert6 = "${PN}-rltraceroute6"
+
+SRC_URI = "http://www.remlab.net/files/ndisc6/ndisc6-${PV}.tar.bz2 \
+ file://autoconf-older-version.patch;patch=1 \
+ file://acinclude.m4"
+
+inherit autotools
+
+# Split into seperate packages since we normal don't want them all
+# The main package is left empty and therefore not created.
+PACKAGES += "${PN}-ndisc6 ${PN}-tcpspray6 ${PN}-rdisc6 \
+ ${PN}-tcptraceroute6 ${PN}-rltraceroute6 ${PN}-tracert6"
+FILES_${PN} = ""
+FILES_${PN}-ndisc6 = "${bindir}/ndisc6"
+FILES_${PN}-tcpspray6 = "${bindir}/tcpspray6"
+FILES_${PN}-rdisc6 = "${bindir}/rdisc6"
+FILES_${PN}-tcptraceroute6 = "${bindir}/tcptraceroute6"
+FILES_${PN}-rltraceroute6 = "${bindir}/rltraceroute6"
+FILES_${PN}-tracert6 = "${bindir}/tracert6"
+
+DESCRIPTION_${PN}-ndisc6 = "ICMPv6 Neighbor Discovery tool. \
+Performs IPv6 neighbor discovery in userland. Replaces arping from the \
+IPv4 world."
+DESCRIPTION_${PN}-rdisc6 = "ICMPv6 Router Discovery tool. \
+Queries IPv6 routers on the network for advertised prefixes. Can be used \
+to detect rogue IPv6 routers, monitor legitimate IPv6 routers."
+DESCRITPION_${PN}-tcpspray6 = "Performs bandwidth measurements of TCP \
+sessions between the local system and a remote echo server in either IPv6 \
+or IPv4."
+
+
+
+# Add some macros from the autoconf 2.60 which to let us build with
+# autoconf 2.59. This can be removed when/if we update to autoconf
+# 2.60
+do_configure_prepend() {
+ cp ${WORKDIR}/acinclude.m4 ${S}
+}
+
+
+# Enable SUID bit for applications that need it
+pkg_postinst_${PN}-rltraceroute6 () {
+ chmod 4555 ${bindir}/rltraceroute6
+}
+pkg_postinst_${PN}-ndisc6 () {
+ chmod 4555 ${bindir}/ndisc6
+}
+pkg_postinst_${PN}-rdisc6 () {
+ chmod 4555 ${bindir}/rdisc6
+}