diff options
Diffstat (limited to 'package/ndisc')
23 files changed, 930 insertions, 0 deletions
diff --git a/package/ndisc/Config.in b/package/ndisc/Config.in new file mode 100644 index 000000000..e7cafd5ee --- /dev/null +++ b/package/ndisc/Config.in @@ -0,0 +1,45 @@ +#menu "ndisc6............................ IPv6 discovery tools" + +config ADK_COMPILE_NDISC6 + tristate + default n + depends ADK_IPV6 + depends ADK_PACKAGE_NDISC6 || ADK_PACKAGE_RDISC6 || ADK_PACKAGE_TCPTRACEROUTE6 + +config ADK_PACKAGE_NDISC6 + prompt "ndisc6............................ An ICMPv6 neighbour discovery tool" + tristate + default n + depends ADK_IPV6 + select ADK_COMPILE_NDISC6 + help + + An ICMPv6 neighbour discovery tools + + http://people.via.ecp.fr/~rem/ndisc6/ + +config ADK_PACKAGE_RDISC6 + prompt "rdisc6............................ An ICMPv6 router discovery tool" + tristate + default n + depends ADK_IPV6 + select ADK_COMPILE_NDISC6 + help + + An ICMPv6 router discovery tool + + http://people.via.ecp.fr/~rem/ndisc6/ + +config ADK_PACKAGE_TCPTRACEROUTE6 + prompt "tcptraceroute6.................... A TCP/IPv6-based traceroute implementation" + tristate + default n + depends ADK_IPV6 + select ADK_COMPILE_NDISC6 + help + + A TCP/IPv6-based traceroute implementation + + http://people.via.ecp.fr/~rem/ndisc6/ + +#endmenu diff --git a/package/ndisc/Makefile b/package/ndisc/Makefile new file mode 100644 index 000000000..23ca866f6 --- /dev/null +++ b/package/ndisc/Makefile @@ -0,0 +1,35 @@ +# $Id$ +#- +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include ${TOPDIR}/rules.mk + +PKG_NAME:= ndisc6 +PKG_VERSION:= 0.9.8 +PKG_RELEASE:= 1 +PKG_MD5SUM:= cb8d70564b8d40aae95e19592c6be183 +MASTER_SITES:= http://www.remlab.net/files/ndisc6/ +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 + +include ${TOPDIR}/mk/package.mk + +$(eval $(call PKG_template,NDISC6,ndisc6,${PKG_VERSION}-${PKG_RELEASE},${ARCH})) +$(eval $(call PKG_template,RDISC6,rdisc6,${PKG_VERSION}-${PKG_RELEASE},${ARCH})) +$(eval $(call PKG_template,TCPTRACEROUTE6,tcptraceroute6,${PKG_VERSION}-${PKG_RELEASE},${ARCH})) + +CONFIGURE_STYLE:= gnu +BUILD_STYLE:= auto +INSTALL_STYLE:= auto +MAKE_FLAGS+= CC="${TARGET_CC}" +TCLFAGS+= -std=c99 + +post-install: + ${INSTALL_DIR} ${IDIR_NDISC6}/usr/bin + ${INSTALL_BIN} ${WRKINST}/usr/bin/ndisc6 ${IDIR_NDISC6}/usr/bin/ + ${INSTALL_DIR} ${IDIR_RDISC6}/usr/bin + ${INSTALL_BIN} ${WRKINST}//usr/bin/rdisc6 ${IDIR_RDISC6}/usr/bin/ + ${INSTALL_DIR} ${IDIR_TCPTRACEROUTE6}/usr/bin + ${INSTALL_BIN} ${WRKINST}/usr/bin/tcptraceroute6 ${IDIR_TCPTRACEROUTE6}/usr/bin/ + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/ndisc/extra/rdnssd/strverscmp.c b/package/ndisc/extra/rdnssd/strverscmp.c new file mode 100644 index 000000000..6276bca0f --- /dev/null +++ b/package/ndisc/extra/rdnssd/strverscmp.c @@ -0,0 +1,131 @@ +/* Compare strings while treating digits characters numerically. + Copyright (C) 1997, 2000, 2002, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include <ctype.h> + +/* states: S_N: normal, S_I: comparing integral part, S_F: comparing + fractional parts, S_Z: idem but with leading Zeroes only */ +#define S_N 0x0 +#define S_I 0x4 +#define S_F 0x8 +#define S_Z 0xC + +/* result_type: CMP: return diff; LEN: compare using len_diff/diff */ +#define CMP 2 +#define LEN 3 + + +/* ISDIGIT differs from isdigit, as follows: + - Its arg may be any int or unsigned int; it need not be an unsigned char. + - It's guaranteed to evaluate its argument exactly once. + - It's typically faster. + POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to + ISDIGIT_LOCALE unless it's important to use the locale's definition + of `digit' even when the host does not conform to POSIX. */ +#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) + +#undef __strverscmp +#undef strverscmp + +#ifndef weak_alias +# define __strverscmp strverscmp +#endif + +/* Compare S1 and S2 as strings holding indices/version numbers, + returning less than, equal to or greater than zero if S1 is less than, + equal to or greater than S2 (for more info, see the texinfo doc). +*/ + +int +__strverscmp (const char *s1, const char *s2) +{ + const unsigned char *p1 = (const unsigned char *) s1; + const unsigned char *p2 = (const unsigned char *) s2; + unsigned char c1, c2; + int state; + int diff; + + /* Symbol(s) 0 [1-9] others (padding) + Transition (10) 0 (01) d (00) x (11) - */ + static const unsigned int next_state[] = + { + /* state x d 0 - */ + /* S_N */ S_N, S_I, S_Z, S_N, + /* S_I */ S_N, S_I, S_I, S_I, + /* S_F */ S_N, S_F, S_F, S_F, + /* S_Z */ S_N, S_F, S_Z, S_Z + }; + + static const int result_type[] = + { + /* state x/x x/d x/0 x/- d/x d/d d/0 d/- + 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */ + + /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, + CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, + /* S_I */ CMP, -1, -1, CMP, 1, LEN, LEN, CMP, + 1, LEN, LEN, CMP, CMP, CMP, CMP, CMP, + /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, + CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, + /* S_Z */ CMP, 1, 1, CMP, -1, CMP, CMP, CMP, + -1, CMP, CMP, CMP + }; + + if (p1 == p2) + return 0; + + c1 = *p1++; + c2 = *p2++; + /* Hint: '0' is a digit too. */ + state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0)); + + while ((diff = c1 - c2) == 0 && c1 != '\0') + { + state = next_state[state]; + c1 = *p1++; + c2 = *p2++; + state |= (c1 == '0') + (ISDIGIT (c1) != 0); + } + + state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))]; + + switch (state) + { + case CMP: + return diff; + + case LEN: + while (ISDIGIT (*p1++)) + if (!ISDIGIT (*p2++)) + return 1; + + return ISDIGIT (*p2) ? -1 : diff; + + default: + return state; + } +} +#ifdef weak_alias +weak_alias (__strverscmp, strverscmp) +#endif diff --git a/package/ndisc/ipkg/ndisc6.control b/package/ndisc/ipkg/ndisc6.control new file mode 100644 index 000000000..40b935e91 --- /dev/null +++ b/package/ndisc/ipkg/ndisc6.control @@ -0,0 +1,4 @@ +Package: ndisc6 +Priority: optional +Section: net +Description: ICMPv6 Neighbour Discovery tool diff --git a/package/ndisc/ipkg/rdisc6.control b/package/ndisc/ipkg/rdisc6.control new file mode 100644 index 000000000..4724d6914 --- /dev/null +++ b/package/ndisc/ipkg/rdisc6.control @@ -0,0 +1,4 @@ +Package: rdisc6 +Priority: optional +Section: net +Description: ICMPv6 Router Discovery tool diff --git a/package/ndisc/ipkg/tcptraceroute6.control b/package/ndisc/ipkg/tcptraceroute6.control new file mode 100644 index 000000000..625fe80c1 --- /dev/null +++ b/package/ndisc/ipkg/tcptraceroute6.control @@ -0,0 +1,4 @@ +Package: tcptraceroute6 +Priority: optional +Section: net +Description: A TCP/IPv6-based traceroute implementation diff --git a/package/ndisc/patches/patch-rdnssd_Makefile_am b/package/ndisc/patches/patch-rdnssd_Makefile_am new file mode 100644 index 000000000..932423ecd --- /dev/null +++ b/package/ndisc/patches/patch-rdnssd_Makefile_am @@ -0,0 +1,13 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/rdnssd/Makefile.am 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/rdnssd/Makefile.am 2009-05-10 19:45:05.000000000 +0200 +@@ -27,7 +27,8 @@ conf_SCRIPTS = merge-hook + # rdnssd + rdnssd_SOURCES = rdnssd.c rdnssd.h \ + icmp.c \ +- netlink.c ++ netlink.c \ ++ strverscmp.c + rdnssd_LDADD = $(LIBRT) \ + @top_builddir@/compat/libcompat.a + diff --git a/package/ndisc/patches/patch-rdnssd_Makefile_in b/package/ndisc/patches/patch-rdnssd_Makefile_in new file mode 100644 index 000000000..125d20098 --- /dev/null +++ b/package/ndisc/patches/patch-rdnssd_Makefile_in @@ -0,0 +1,30 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/rdnssd/Makefile.in 2008-05-01 14:52:45.000000000 +0200 ++++ ndisc6-0.9.8/rdnssd/Makefile.in 2009-05-10 19:45:05.000000000 +0200 +@@ -58,7 +58,7 @@ CONFIG_CLEAN_FILES = + am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(confdir)" + sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) + PROGRAMS = $(sbin_PROGRAMS) +-am_rdnssd_OBJECTS = rdnssd.$(OBJEXT) icmp.$(OBJEXT) netlink.$(OBJEXT) ++am_rdnssd_OBJECTS = rdnssd.$(OBJEXT) icmp.$(OBJEXT) netlink.$(OBJEXT) strverscmp.$(OBJEXT) + rdnssd_OBJECTS = $(am_rdnssd_OBJECTS) + am__DEPENDENCIES_1 = + rdnssd_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@@ -211,7 +211,8 @@ conf_SCRIPTS = merge-hook + # rdnssd + rdnssd_SOURCES = rdnssd.c rdnssd.h \ + icmp.c \ +- netlink.c ++ netlink.c \ ++ strverscmp.c + + rdnssd_LDADD = $(LIBRT) \ + @top_builddir@/compat/libcompat.a +@@ -334,6 +335,7 @@ distclean-compile: + + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icmp.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netlink.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strverscmp.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdnssd.Po@am__quote@ + + .c.o: diff --git a/package/ndisc/patches/patch-rdnssd_icmp_c b/package/ndisc/patches/patch-rdnssd_icmp_c new file mode 100644 index 000000000..78cbd8e43 --- /dev/null +++ b/package/ndisc/patches/patch-rdnssd_icmp_c @@ -0,0 +1,20 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/rdnssd/icmp.c 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/rdnssd/icmp.c 2009-05-10 19:43:19.000000000 +0200 +@@ -47,6 +47,7 @@ + + static int icmp_recv (int fd) + { ++ struct cmsghdr *cmsg; + struct nd_router_advert icmp6; + uint8_t buf[65536 - sizeof (icmp6)], cbuf[CMSG_SPACE (sizeof (int))]; + struct iovec iov[2] = +@@ -74,7 +75,7 @@ static int icmp_recv (int fd) + || (icmp6.nd_ra_code != 0)) /* unknown ICMPv6 code */ + return -1; + +- for (struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); ++ for (cmsg = CMSG_FIRSTHDR (&msg); + cmsg != NULL; + cmsg = CMSG_NXTHDR (&msg, cmsg)) + { diff --git a/package/ndisc/patches/patch-rdnssd_rdnssd_c b/package/ndisc/patches/patch-rdnssd_rdnssd_c new file mode 100644 index 000000000..48a261495 --- /dev/null +++ b/package/ndisc/patches/patch-rdnssd_rdnssd_c @@ -0,0 +1,78 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/rdnssd/rdnssd.c 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/rdnssd/rdnssd.c 2009-05-10 19:42:36.000000000 +0200 +@@ -76,6 +76,7 @@ static struct + + static void write_resolv(const char *resolvpath) + { ++ size_t i; + FILE *resolv; + int rval; + char tmpfile[strlen(resolvpath) + sizeof(".tmp")]; +@@ -89,7 +90,7 @@ static void write_resolv(const char *res + return; + } + +- for (size_t i = 0; i < servers.count; i++) { ++ for (i = 0; i < servers.count; i++) { + char addr[INET6_ADDRSTRLEN]; + inet_ntop(AF_INET6, &servers.list[i].addr, addr, INET6_ADDRSTRLEN); + +@@ -132,6 +133,7 @@ static int rdnss_older (const void *a, c + static void rdnss_update (const struct in6_addr *addr, unsigned int ifindex, time_t expiry) + { + size_t i; ++ unsigned int j; + + /* Does this entry already exist? */ + for (i = 0; i < servers.count; i++) +@@ -165,12 +167,12 @@ static void rdnss_update (const struct i + qsort (servers.list, servers.count, sizeof (rdnss_t), rdnss_older); + + #ifndef NDEBUG +- for (unsigned i = 0; i < servers.count; i++) ++ for (j = 0; j < servers.count; j++) + { + char buf[INET6_ADDRSTRLEN]; +- inet_ntop (AF_INET6, &servers.list[i].addr, buf, ++ inet_ntop (AF_INET6, &servers.list[j].addr, buf, + sizeof (buf)); +- syslog (LOG_DEBUG, "%u: %48s expires at %u\n", i, buf, ++ syslog (LOG_DEBUG, "%u: %48s expires at %u\n", j, buf, + (unsigned)servers.list[i].expiry); + } + #endif +@@ -178,6 +180,7 @@ static void rdnss_update (const struct i + + int parse_nd_opts (const struct nd_opt_hdr *opt, size_t opts_len, unsigned int ifindex) + { ++ struct in6_addr *addr; + for (; opts_len >= sizeof(struct nd_opt_hdr); + opts_len -= opt->nd_opt_len << 3, + opt = (const struct nd_opt_hdr *) +@@ -206,7 +209,7 @@ int parse_nd_opts (const struct nd_opt_h + + lifetime = now + ntohl(rdnss_opt->nd_opt_rdnss_lifetime); + +- for (struct in6_addr *addr = (struct in6_addr *) (rdnss_opt + 1); ++ for (addr = (struct in6_addr *) (rdnss_opt + 1); + nd_opt_len >= 2; addr++, nd_opt_len -= 2) + rdnss_update(addr, ifindex, lifetime); + +@@ -255,6 +258,7 @@ static void ignore_handler (int signum) + + static int worker (int pipe, const char *resolvpath, const char *username) + { ++ bool ready; + sigset_t emptyset; + int rval = 0, sock = -1; + const rdnss_src_t *src; +@@ -283,7 +287,7 @@ static int worker (int pipe, const char + + sigemptyset (&emptyset); + +- for (bool ready = false; termsig == 0;) ++ for (ready = false; termsig == 0;) + { + struct pollfd pfd = + { .fd = sock, .events = POLLIN, .revents = 0 }; diff --git a/package/ndisc/patches/patch-rdnssd_rdnssd_c.orig b/package/ndisc/patches/patch-rdnssd_rdnssd_c.orig new file mode 100644 index 000000000..be06580f6 --- /dev/null +++ b/package/ndisc/patches/patch-rdnssd_rdnssd_c.orig @@ -0,0 +1,61 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/rdnssd/rdnssd.c 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/rdnssd/rdnssd.c 2009-05-10 19:41:53.000000000 +0200 +@@ -76,6 +76,7 @@ static struct + + static void write_resolv(const char *resolvpath) + { ++ size_t i; + FILE *resolv; + int rval; + char tmpfile[strlen(resolvpath) + sizeof(".tmp")]; +@@ -89,7 +90,7 @@ static void write_resolv(const char *res + return; + } + +- for (size_t i = 0; i < servers.count; i++) { ++ for (i = 0; i < servers.count; i++) { + char addr[INET6_ADDRSTRLEN]; + inet_ntop(AF_INET6, &servers.list[i].addr, addr, INET6_ADDRSTRLEN); + +@@ -132,6 +133,7 @@ static int rdnss_older (const void *a, c + static void rdnss_update (const struct in6_addr *addr, unsigned int ifindex, time_t expiry) + { + size_t i; ++ unsigned int j; + + /* Does this entry already exist? */ + for (i = 0; i < servers.count; i++) +@@ -165,12 +167,12 @@ static void rdnss_update (const struct i + qsort (servers.list, servers.count, sizeof (rdnss_t), rdnss_older); + + #ifndef NDEBUG +- for (unsigned i = 0; i < servers.count; i++) ++ for (j = 0; j < servers.count; j++) + { + char buf[INET6_ADDRSTRLEN]; +- inet_ntop (AF_INET6, &servers.list[i].addr, buf, ++ inet_ntop (AF_INET6, &servers.list[j].addr, buf, + sizeof (buf)); +- syslog (LOG_DEBUG, "%u: %48s expires at %u\n", i, buf, ++ syslog (LOG_DEBUG, "%u: %48s expires at %u\n", j, buf, + (unsigned)servers.list[i].expiry); + } + #endif +@@ -178,6 +180,7 @@ static void rdnss_update (const struct i + + int parse_nd_opts (const struct nd_opt_hdr *opt, size_t opts_len, unsigned int ifindex) + { ++ struct in6_addr *addr; + for (; opts_len >= sizeof(struct nd_opt_hdr); + opts_len -= opt->nd_opt_len << 3, + opt = (const struct nd_opt_hdr *) +@@ -206,7 +209,7 @@ int parse_nd_opts (const struct nd_opt_h + + lifetime = now + ntohl(rdnss_opt->nd_opt_rdnss_lifetime); + +- for (struct in6_addr *addr = (struct in6_addr *) (rdnss_opt + 1); ++ for (addr = (struct in6_addr *) (rdnss_opt + 1); + nd_opt_len >= 2; addr++, nd_opt_len -= 2) + rdnss_update(addr, ifindex, lifetime); + diff --git a/package/ndisc/patches/patch-src_addrinfo_c b/package/ndisc/patches/patch-src_addrinfo_c new file mode 100644 index 000000000..74dbe928d --- /dev/null +++ b/package/ndisc/patches/patch-src_addrinfo_c @@ -0,0 +1,21 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/src/addrinfo.c 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/src/addrinfo.c 2009-05-10 19:14:46.000000000 +0200 +@@ -53,7 +53,7 @@ gai_perror (int errval, const char *msg) + static int + printnames (const char *name, int family, int aflags, int nflags, bool single) + { +- struct addrinfo hints, *res; ++ struct addrinfo hints, *res, *ptr; + + memset (&hints, 0, sizeof (hints)); + hints.ai_family = family; +@@ -67,7 +67,7 @@ printnames (const char *name, int family + return -1; + } + +- for (struct addrinfo *ptr = res; ptr != NULL; ptr = ptr->ai_next) ++ for (ptr = res; ptr != NULL; ptr = ptr->ai_next) + { + char hostname[NI_MAXHOST]; + diff --git a/package/ndisc/patches/patch-src_ndisc_c b/package/ndisc/patches/patch-src_ndisc_c new file mode 100644 index 000000000..af3abf1d3 --- /dev/null +++ b/package/ndisc/patches/patch-src_ndisc_c @@ -0,0 +1,35 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/src/ndisc.c 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/src/ndisc.c 2009-05-10 19:16:53.000000000 +0200 +@@ -375,12 +375,13 @@ parseroute (const uint8_t *opt) + static int + parserdnss (const uint8_t *opt) + { ++ unsigned int i; + uint8_t optlen = opt[1]; + if (((optlen & 1) == 0) || (optlen < 3)) + return -1; + + optlen /= 2; +- for (unsigned i = 0; i < optlen; i++) ++ for (i = 0; i < optlen; i++) + { + char str[INET6_ADDRSTRLEN]; + +@@ -521,6 +522,7 @@ static ssize_t + recvfromLL (int fd, void *buf, size_t len, int flags, + struct sockaddr_in6 *addr) + { ++ struct cmsghdr *cmsg; + char cbuf[CMSG_SPACE (sizeof (int))]; + struct iovec iov = + { +@@ -542,7 +544,7 @@ recvfromLL (int fd, void *buf, size_t le + return val; + + /* ensures the hop limit is 255 */ +- for (struct cmsghdr *cmsg = CMSG_FIRSTHDR (&hdr); ++ for (cmsg = CMSG_FIRSTHDR (&hdr); + cmsg != NULL; + cmsg = CMSG_NXTHDR (&hdr, cmsg)) + { diff --git a/package/ndisc/patches/patch-src_ndisc_c.orig b/package/ndisc/patches/patch-src_ndisc_c.orig new file mode 100644 index 000000000..8bc600948 --- /dev/null +++ b/package/ndisc/patches/patch-src_ndisc_c.orig @@ -0,0 +1,20 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/src/ndisc.c 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/src/ndisc.c 2009-05-10 19:16:18.000000000 +0200 +@@ -521,6 +521,7 @@ static ssize_t + recvfromLL (int fd, void *buf, size_t len, int flags, + struct sockaddr_in6 *addr) + { ++ struct cmsghdr *cmsg; + char cbuf[CMSG_SPACE (sizeof (int))]; + struct iovec iov = + { +@@ -542,7 +543,7 @@ recvfromLL (int fd, void *buf, size_t le + return val; + + /* ensures the hop limit is 255 */ +- for (struct cmsghdr *cmsg = CMSG_FIRSTHDR (&hdr); ++ for (cmsg = CMSG_FIRSTHDR (&hdr); + cmsg != NULL; + cmsg = CMSG_NXTHDR (&hdr, cmsg)) + { diff --git a/package/ndisc/patches/patch-src_tcpspray_c b/package/ndisc/patches/patch-src_tcpspray_c new file mode 100644 index 000000000..9ac8bad90 --- /dev/null +++ b/package/ndisc/patches/patch-src_tcpspray_c @@ -0,0 +1,48 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/src/tcpspray.c 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/src/tcpspray.c 2009-05-10 19:13:52.000000000 +0200 +@@ -60,7 +60,7 @@ static unsigned verbose = 0; + + static int tcpconnect (const char *host, const char *serv) + { +- struct addrinfo hints, *res; ++ struct addrinfo hints, *res, *p; + + memset (&hints, 0, sizeof (hints)); + hints.ai_family = family; +@@ -78,7 +78,7 @@ static int tcpconnect (const char *host, + + val = -1; + +- for (struct addrinfo *p = res; (p != NULL) && (val == -1); p = p->ai_next) ++ for (p = res; (p != NULL) && (val == -1); p = p->ai_next) + { + val = socket (p->ai_family, p->ai_socktype, p->ai_protocol); + if (val == -1) +@@ -127,6 +127,8 @@ static int + tcpspray (const char *host, const char *serv, unsigned long n, size_t blen, + unsigned delay_us, const char *fillname, bool echo) + { ++ unsigned int i, j; ++ + if (serv == NULL) + serv = echo ? "echo" : "discard"; + +@@ -172,7 +174,7 @@ tcpspray (const char *host, const char * + switch (child) + { + case 0: +- for (unsigned i = 0; i < n; i++) ++ for (i = 0; i < n; i++) + { + ssize_t val = recv (fd, block, blen, MSG_WAITALL); + if (val != (ssize_t)blen) +@@ -208,7 +210,7 @@ tcpspray (const char *host, const char * + struct timespec start, end; + mono_gettime (&start); + +- for (unsigned i = 0; i < n; i++) ++ for (j = 0; j < n; j++) + { + ssize_t val = write (fd, block, blen); + if (val != (ssize_t)blen) diff --git a/package/ndisc/patches/patch-src_tcpspray_c.orig b/package/ndisc/patches/patch-src_tcpspray_c.orig new file mode 100644 index 000000000..15106ea1c --- /dev/null +++ b/package/ndisc/patches/patch-src_tcpspray_c.orig @@ -0,0 +1,31 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/src/tcpspray.c 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/src/tcpspray.c 2009-05-10 19:11:15.000000000 +0200 +@@ -60,7 +60,7 @@ static unsigned verbose = 0; + + static int tcpconnect (const char *host, const char *serv) + { +- struct addrinfo hints, *res; ++ struct addrinfo hints, *res, *p; + + memset (&hints, 0, sizeof (hints)); + hints.ai_family = family; +@@ -78,7 +78,7 @@ static int tcpconnect (const char *host, + + val = -1; + +- for (struct addrinfo *p = res; (p != NULL) && (val == -1); p = p->ai_next) ++ for (p = res; (p != NULL) && (val == -1); p = p->ai_next) + { + val = socket (p->ai_family, p->ai_socktype, p->ai_protocol); + if (val == -1) +@@ -172,7 +172,8 @@ tcpspray (const char *host, const char * + switch (child) + { + case 0: +- for (unsigned i = 0; i < n; i++) ++ unsigned int i; ++ for (i = 0; i < n; i++) + { + ssize_t val = recv (fd, block, blen, MSG_WAITALL); + if (val != (ssize_t)blen) diff --git a/package/ndisc/patches/patch-src_tcptraceroute_c b/package/ndisc/patches/patch-src_tcptraceroute_c new file mode 100644 index 000000000..584f46472 --- /dev/null +++ b/package/ndisc/patches/patch-src_tcptraceroute_c @@ -0,0 +1,20 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/src/tcptraceroute.c 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/src/tcptraceroute.c 2009-05-10 19:15:28.000000000 +0200 +@@ -114,6 +114,7 @@ static const char bin_name[] = RLTRACERO + + int main (int argc, char *argv[]) + { ++ int i; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); +@@ -130,7 +131,7 @@ int main (int argc, char *argv[]) + + /* Prepare big enough buffers */ + unsigned len = 0; +- for (int i = 1; i < argc; i++) ++ for (i = 1; i < argc; i++) + len += strlen (argv[i]); + + char optbuf[3 * len + argc], *buf = optbuf; diff --git a/package/ndisc/patches/patch-src_trace-tcp_c b/package/ndisc/patches/patch-src_trace-tcp_c new file mode 100644 index 000000000..071b6d437 --- /dev/null +++ b/package/ndisc/patches/patch-src_trace-tcp_c @@ -0,0 +1,11 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/src/trace-tcp.c 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/src/trace-tcp.c 2009-05-10 19:38:11.000000000 +0200 +@@ -24,6 +24,7 @@ + + #undef _GNU_SOURCE + #define _BSD_SOURCE 1 ++#define __FAVOR_BSD 1 + + #include <string.h> + #include <inttypes.h> diff --git a/package/ndisc/patches/patch-src_trace-udp_c b/package/ndisc/patches/patch-src_trace-udp_c new file mode 100644 index 000000000..5c8c52bb8 --- /dev/null +++ b/package/ndisc/patches/patch-src_trace-udp_c @@ -0,0 +1,11 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/src/trace-udp.c 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/src/trace-udp.c 2009-05-10 19:38:18.000000000 +0200 +@@ -24,6 +24,7 @@ + + #undef _GNU_SOURCE + #define _BSD_SOURCE 1 ++#define __FAVOR_BSD 1 + + #include <string.h> + #include <stdbool.h> diff --git a/package/ndisc/patches/patch-src_traceroute_c b/package/ndisc/patches/patch-src_traceroute_c new file mode 100644 index 000000000..c98acfc20 --- /dev/null +++ b/package/ndisc/patches/patch-src_traceroute_c @@ -0,0 +1,128 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/src/traceroute.c 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/src/traceroute.c 2009-05-10 19:31:06.000000000 +0200 +@@ -149,6 +149,7 @@ static ssize_t + recv_payload (int fd, void *buf, size_t len, + struct sockaddr_in6 *addr, int *hlim) + { ++ struct cmsghdr *cmsg; + char cbuf[CMSG_SPACE (sizeof (int))]; + struct iovec iov = + { +@@ -170,7 +171,7 @@ recv_payload (int fd, void *buf, size_t + return val; + + /* ensures the hop limit is 255 */ +- for (struct cmsghdr *cmsg = CMSG_FIRSTHDR (&hdr); ++ for (cmsg = CMSG_FIRSTHDR (&hdr); + cmsg != NULL; + cmsg = CMSG_NXTHDR (&hdr, cmsg)) + if ((cmsg->cmsg_level == IPPROTO_IPV6) +@@ -625,14 +626,16 @@ static void + display (const tracetest_t *tab, unsigned min_ttl, unsigned max_ttl, + unsigned retries) + { +- for (unsigned ttl = min_ttl; ttl <= max_ttl; ttl++) ++ unsigned int ttl, col; ++ ++ for (ttl = min_ttl; ttl <= max_ttl; ttl++) + { + struct sockaddr_in6 hop = { .sin6_family = AF_UNSPEC }; + const tracetest_t *line = tab + retries * (ttl - min_ttl); + + printf ("%2d ", ttl); + +- for (unsigned col = 0; col < retries; col++) ++ for (col = 0; col < retries; col++) + { + const tracetest_t *test = line + col; + if (test->result == TRACE_TIMEOUT) +@@ -821,6 +824,7 @@ static void setup_socket (int fd) + + static int setsock_rth (int fd, int type, const char **segv, int segc) + { ++ int i; + uint8_t hdr[inet6_rth_space (type, segc)]; + inet6_rth_init (hdr, sizeof (hdr), type, segc); + +@@ -829,7 +833,7 @@ static int setsock_rth (int fd, int type + hints.ai_family = AF_INET6; + hints.ai_flags = AI_IDN; + +- for (int i = 0; i < segc; i++) ++ for (i = 0; i < segc; i++) + { + struct addrinfo *res; + +@@ -868,7 +872,8 @@ static struct + + static int prepare_sockets (void) + { +- for (unsigned i = 0; i < sizeof (protofd) / sizeof (protofd[0]); i++) ++ unsigned int i; ++ for (i = 0; i < sizeof (protofd) / sizeof (protofd[0]); i++) + { + protofd[i].fd = socket (AF_INET6, SOCK_RAW, protofd[i].protocol); + if (protofd[i].fd == -1) +@@ -883,8 +888,9 @@ static int prepare_sockets (void) + + static int get_socket (int protocol) + { ++ unsigned int i; + errno = EPROTONOSUPPORT; +- for (unsigned i = 0; i < sizeof (protofd) / sizeof (protofd[0]); i++) ++ for (i = 0; i < sizeof (protofd) / sizeof (protofd[0]); i++) + if (protofd[i].protocol == protocol) + { + int fd = protofd[i].fd; +@@ -902,7 +908,8 @@ static int get_socket (int protocol) + + static void drop_sockets (void) + { +- for (unsigned i = 0; i < sizeof (protofd) / sizeof (protofd[0]); i++) ++ unsigned int i; ++ for (i = 0; i < sizeof (protofd) / sizeof (protofd[0]); i++) + if (protofd[i].fd != -1) + close (protofd[i].fd); + } +@@ -914,6 +921,8 @@ traceroute (const char *dsthost, const c + unsigned timeout, unsigned delay, unsigned retries, + size_t packet_len, int min_ttl, int max_ttl) + { ++ unsigned int i, j, step, progress; ++ + /* Creates ICMPv6 socket to collect error packets */ + int icmpfd = get_socket (IPPROTO_ICMPV6); + if (icmpfd == -1) +@@ -1020,7 +1029,7 @@ traceroute (const char *dsthost, const c + .filter = f, + }; + +- for (unsigned i = 0; i < 4; i++) ++ for (i = 0; i < 4; i++) + { + /* A = icmp->ip6_dst.s6_addr32[i]; */ + pc->code = BPF_LD + BPF_W + BPF_ABS; +@@ -1076,7 +1085,7 @@ traceroute (const char *dsthost, const c + tracetest_t tab[(1 + max_ttl - min_ttl) * retries]; + memset (tab, 0, sizeof (tab)); + +- for (unsigned step = 1, progress = 0; ++ for (step = 1, progress = 0; + step < (1 + max_ttl - min_ttl) + retries; + step++) + { +@@ -1093,10 +1102,10 @@ traceroute (const char *dsthost, const c + mono_nanosleep (&delay_ts); + + /* Sends requests */ +- for (unsigned i = 0; i < retries; i++) ++ for (j = 0; j < retries; j++) + { +- int attempt = (retries - 1) - i; +- int hlim = min_ttl + step + i - retries; ++ int attempt = (retries - 1) - j; ++ int hlim = min_ttl + step + j - retries; + + if ((hlim > max_ttl) || (hlim < min_ttl)) + continue; diff --git a/package/ndisc/patches/patch-src_traceroute_c.orig b/package/ndisc/patches/patch-src_traceroute_c.orig new file mode 100644 index 000000000..a7ff0cd44 --- /dev/null +++ b/package/ndisc/patches/patch-src_traceroute_c.orig @@ -0,0 +1,128 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/src/traceroute.c 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/src/traceroute.c 2009-05-10 19:29:37.000000000 +0200 +@@ -149,6 +149,7 @@ static ssize_t + recv_payload (int fd, void *buf, size_t len, + struct sockaddr_in6 *addr, int *hlim) + { ++ struct cmsghdr *cmsg; + char cbuf[CMSG_SPACE (sizeof (int))]; + struct iovec iov = + { +@@ -170,7 +171,7 @@ recv_payload (int fd, void *buf, size_t + return val; + + /* ensures the hop limit is 255 */ +- for (struct cmsghdr *cmsg = CMSG_FIRSTHDR (&hdr); ++ for (cmsg = CMSG_FIRSTHDR (&hdr); + cmsg != NULL; + cmsg = CMSG_NXTHDR (&hdr, cmsg)) + if ((cmsg->cmsg_level == IPPROTO_IPV6) +@@ -625,14 +626,16 @@ static void + display (const tracetest_t *tab, unsigned min_ttl, unsigned max_ttl, + unsigned retries) + { +- for (unsigned ttl = min_ttl; ttl <= max_ttl; ttl++) ++ unsigned int ttl, col; ++ ++ for (ttl = min_ttl; ttl <= max_ttl; ttl++) + { + struct sockaddr_in6 hop = { .sin6_family = AF_UNSPEC }; + const tracetest_t *line = tab + retries * (ttl - min_ttl); + + printf ("%2d ", ttl); + +- for (unsigned col = 0; col < retries; col++) ++ for (col = 0; col < retries; col++) + { + const tracetest_t *test = line + col; + if (test->result == TRACE_TIMEOUT) +@@ -821,6 +824,7 @@ static void setup_socket (int fd) + + static int setsock_rth (int fd, int type, const char **segv, int segc) + { ++ int i; + uint8_t hdr[inet6_rth_space (type, segc)]; + inet6_rth_init (hdr, sizeof (hdr), type, segc); + +@@ -829,7 +833,7 @@ static int setsock_rth (int fd, int type + hints.ai_family = AF_INET6; + hints.ai_flags = AI_IDN; + +- for (int i = 0; i < segc; i++) ++ for (i = 0; i < segc; i++) + { + struct addrinfo *res; + +@@ -868,7 +872,8 @@ static struct + + static int prepare_sockets (void) + { +- for (unsigned i = 0; i < sizeof (protofd) / sizeof (protofd[0]); i++) ++ unsigned int i; ++ for (i = 0; i < sizeof (protofd) / sizeof (protofd[0]); i++) + { + protofd[i].fd = socket (AF_INET6, SOCK_RAW, protofd[i].protocol); + if (protofd[i].fd == -1) +@@ -883,8 +888,9 @@ static int prepare_sockets (void) + + static int get_socket (int protocol) + { ++ unsigned int i; + errno = EPROTONOSUPPORT; +- for (unsigned i = 0; i < sizeof (protofd) / sizeof (protofd[0]); i++) ++ for (i = 0; i < sizeof (protofd) / sizeof (protofd[0]); i++) + if (protofd[i].protocol == protocol) + { + int fd = protofd[i].fd; +@@ -902,7 +908,8 @@ static int get_socket (int protocol) + + static void drop_sockets (void) + { +- for (unsigned i = 0; i < sizeof (protofd) / sizeof (protofd[0]); i++) ++ unsigned int i; ++ for (i = 0; i < sizeof (protofd) / sizeof (protofd[0]); i++) + if (protofd[i].fd != -1) + close (protofd[i].fd); + } +@@ -914,6 +921,8 @@ traceroute (const char *dsthost, const c + unsigned timeout, unsigned delay, unsigned retries, + size_t packet_len, int min_ttl, int max_ttl) + { ++ unsigned int i, j, step; ++ + /* Creates ICMPv6 socket to collect error packets */ + int icmpfd = get_socket (IPPROTO_ICMPV6); + if (icmpfd == -1) +@@ -1020,7 +1029,7 @@ traceroute (const char *dsthost, const c + .filter = f, + }; + +- for (unsigned i = 0; i < 4; i++) ++ for (i = 0; i < 4; i++) + { + /* A = icmp->ip6_dst.s6_addr32[i]; */ + pc->code = BPF_LD + BPF_W + BPF_ABS; +@@ -1076,7 +1085,7 @@ traceroute (const char *dsthost, const c + tracetest_t tab[(1 + max_ttl - min_ttl) * retries]; + memset (tab, 0, sizeof (tab)); + +- for (unsigned step = 1, progress = 0; ++ for (step = 1, progress = 0; + step < (1 + max_ttl - min_ttl) + retries; + step++) + { +@@ -1093,10 +1102,10 @@ traceroute (const char *dsthost, const c + mono_nanosleep (&delay_ts); + + /* Sends requests */ +- for (unsigned i = 0; i < retries; i++) ++ for (j = 0; j < retries; j++) + { +- int attempt = (retries - 1) - i; +- int hlim = min_ttl + step + i - retries; ++ int attempt = (retries - 1) - j; ++ int hlim = min_ttl + step + j - retries; + + if ((hlim > max_ttl) || (hlim < min_ttl)) + continue; diff --git a/package/ndisc/patches/patch-src_traceroute_h b/package/ndisc/patches/patch-src_traceroute_h new file mode 100644 index 000000000..d47efc0c3 --- /dev/null +++ b/package/ndisc/patches/patch-src_traceroute_h @@ -0,0 +1,26 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/src/traceroute.h 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/src/traceroute.h 2009-05-10 19:23:51.000000000 +0200 +@@ -24,9 +24,9 @@ + typedef ssize_t (*trace_send_t) (int fd, unsigned ttl, unsigned n, + size_t plen, uint16_t port); + +-typedef ssize_t (*trace_parser_t) (const void *restrict data, size_t len, +- int *restrict ttl, +- unsigned *restrict n, uint16_t port); ++typedef ssize_t (*trace_parser_t) (const data, size_t len, ++ int ttl, ++ unsigned n, uint16_t port); + + typedef struct tracetype + { +@@ -34,7 +34,8 @@ typedef struct tracetype + int protocol; + int checksum_offset; + trace_send_t send_probe; +- trace_parser_t parse_resp, parse_err; ++ trace_parser_t parse_resp; ++ trace_parser_t parse_err; + } tracetype; + + # ifdef __cplusplus diff --git a/package/ndisc/patches/patch-src_traceroute_h.orig b/package/ndisc/patches/patch-src_traceroute_h.orig new file mode 100644 index 000000000..48da9765a --- /dev/null +++ b/package/ndisc/patches/patch-src_traceroute_h.orig @@ -0,0 +1,26 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- ndisc6-0.9.8.orig/src/traceroute.h 2008-05-01 14:52:28.000000000 +0200 ++++ ndisc6-0.9.8/src/traceroute.h 2009-05-10 19:23:18.000000000 +0200 +@@ -24,9 +24,9 @@ + typedef ssize_t (*trace_send_t) (int fd, unsigned ttl, unsigned n, + size_t plen, uint16_t port); + +-typedef ssize_t (*trace_parser_t) (const void *restrict data, size_t len, +- int *restrict ttl, +- unsigned *restrict n, uint16_t port); ++typedef ssize_t (*trace_parser_t) (const void data, size_t len, ++ int ttl, ++ unsigned n, uint16_t port); + + typedef struct tracetype + { +@@ -34,7 +34,8 @@ typedef struct tracetype + int protocol; + int checksum_offset; + trace_send_t send_probe; +- trace_parser_t parse_resp, parse_err; ++ trace_parser_t parse_resp; ++ trace_parser_t parse_err; + } tracetype; + + # ifdef __cplusplus |