--- /dev/null
+#
+# Copyright (C) 2006-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=aiccu
+PKG_VERSION:=20070115
+PKG_RELEASE:=10
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.sixxs.net/archive/sixxs/aiccu/unix
+PKG_MD5SUM:=c9bcc83644ed788e22a7c3f3d4021350
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/aiccu
+ SECTION:=net
+ CATEGORY:=Network
+ DEPENDS:=+libpthread +ip +kmod-sit +kmod-tun
+ TITLE:=SixXS Automatic IPv6 Connectivity Client Utility
+ URL:=http://www.sixxs.net/tools/aiccu/
+endef
+
+define Build/Configure
+ $(SED) "s,strip,/bin/true," $(PKG_BUILD_DIR)/unix-console/Makefile
+endef
+
+define Build/Compile
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ CC="$(TARGET_CC)" OS_NAME="Linux" OS_VERSION="$(LINUX_VERSION)" \
+ EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
+ EXTRA_LDFLAGS="$(TARGET_LDFLAGS) -pthread" \
+ DEBUG=0
+endef
+
+define Package/aiccu/conffiles
+/etc/config/aiccu
+endef
+
+define Package/aiccu/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/unix-console/$(PKG_NAME) $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,aiccu))
--- /dev/null
+--- aiccu/unix-console/Makefile.orig 2007-09-02 23:19:39.000000000 +0200
++++ aiccu/unix-console/Makefile 2007-09-02 23:20:11.000000000 +0200
+@@ -25,7 +25,8 @@
+ # CWARNS += -Wpacked
+
+ #CFLAGS += $(CWARNS) -D_GNU_SOURCE -D_DEBUG -g3 -O0
+-CFLAGS += $(CWARNS) -D_GNU_SOURCE
++CFLAGS += $(CWARNS) $(EXTRA_CFLAGS) -D_GNU_SOURCE
++LDFLAGS += $(EXTRA_LDFLAGS)
+ CC = @gcc
+ RM = rm
+
+@@ -40,25 +41,25 @@
+ # GnuTLS Support ?
+ # Used by TIC to secure that communication
+ # Currently defaultly builds only on Linux, but other platforms might easily also support it
+-ifeq ($(shell uname | grep -c "Linux"),1)
++ifneq ($(HAVE_GNUTLS),)
+ CFLAGS += -D AICCU_GNUTLS
+ LDFLAGS += -lgnutls
+ endif
+
+ # Linux
+-ifeq ($(shell uname | grep -c "Linux"),1)
++ifeq ($(OS_NAME),Linux)
+ CFLAGS += -D_LINUX -D HAS_IFHEAD -D AICCU_TYPE="\"linux\""
+ SRCS += ../common/aiccu_linux.c
+ OBJS += ../common/aiccu_linux.o
+-LDFLAGS += -lpthread -lresolv
++LDFLAGS += -pthread -lresolv
+ endif
+
+ # FreeBSD
+-ifeq ($(shell uname | grep -c "FreeBSD"),1)
++ifeq ($(OS_NAME),FreeBSD)
+ CFLAGS += -D_FREEBSD
+
+ # FreeBSD 4.x
+-ifeq ($(shell uname -r | cut -c 1),4)
++ifeq ($(shell echo $(OS_VERSION) | cut -c 1),4)
+ CFLAGS += -D AICCU_TYPE="\"freebsd4\""
+ SRCS += ../common/aiccu_freebsd4.c
+ OBJS += ../common/aiccu_freebsd4.o
+@@ -71,7 +72,7 @@
+ endif
+
+ # DragonFlyBSD
+-ifeq ($(shell uname | grep -c "DragonFly"),1)
++ifeq ($(OS_NAME),DragonFly)
+ CFLAGS += -D_DFBSD -D NEED_IFHEAD -D AICCU_TYPE="\"dragonfly\""
+ SRCS += ../common/aiccu_freebsd4.c
+ OBJS += ../common/aiccu_freebsd4.o
+@@ -79,7 +80,7 @@
+ endif
+
+ # NetBSD
+-ifeq ($(shell uname | grep -c "NetBSD"),1)
++ifeq ($(OS_NAME),NetBSD)
+ CFLAGS += -D_NETBSD -D AICCU_TYPE="\"kame\""
+
+ # Check if net/if_tun.h has TUNSIFHEAD and enable support for it
+@@ -97,10 +98,10 @@
+ endif
+
+ # OpenBSD
+-ifeq ($(shell uname | grep -c "OpenBSD"),1)
++ifeq ($(OS_NAME),OpenBSD)
+ CFLAGS += -D_OPENBSD -D HAS_IFHEAD
+ # 2.7-2.9
+-ifeq ($(shell uname -r | cut -c 1),2)
++ifeq ($(shell echo $(OS_VERSION) | cut -c 1),2)
+ CFLAGS += -D AICCU_TYPE="\"openbsd2\""
+ SRCS += ../common/aiccu_openbsd2.c
+ OBJS += ../common/aiccu_openbsd2.o
+@@ -114,7 +115,7 @@
+ endif
+
+ # Darwin
+-ifeq ($(shell uname | grep -c "Darwin"),1)
++ifeq ($(OS_NAME),Darwin)
+ CFLAGS += -D_DARWIN -D NEED_IFHEAD -D AICCU_TYPE="\"darwin\""
+ SRCS += ../common/aiccu_darwin.c
+ OBJS += ../common/aiccu_darwin.o
+@@ -122,7 +123,7 @@
+ endif
+
+ # SunOS / Solaris
+-ifeq ($(shell uname | grep -c "SunOS"),1)
++ifeq ($(OS_NAME),SunOS)
+ CFLAGS += -D_SUNOS -D AICCU_TYPE="\"sunos\""
+ SRCS += ../common/aiccu_sunos.c
+ OBJS += ../common/aiccu_sunos.o
+@@ -130,7 +131,7 @@
+ endif
+
+ # AIX
+-ifeq ($(shell uname | grep -c "AIX"),1)
++ifeq ($(OS_NAME),AIX)
+ CC = @/usr/vac/bin/xlc_r
+ CFLAGS = -qthreaded -q64 -qlanglvl=stdc99 -bmaxdata:0xD0000000 -D_64BIT -g -qdbxextra -qfullpath -qheapdebug -qformat=all -qcheck=all
+ CFLAGS += -D AICCU_CONSOLE
--- /dev/null
+diff -Nru aiccu.old/common/dn_skipname.c aiccu/common/dn_skipname.c
+--- aiccu.old/common/dn_skipname.c 1970-01-01 02:00:00.000000000 +0200
++++ aiccu/common/dn_skipname.c 2006-11-04 00:50:23.000000000 +0200
+@@ -0,0 +1,51 @@
++#include <errno.h>
++#include <resolv.h>
++
++/* Ripped from glibc 2.4 sources. */
++
++/*
++ * ns_name_skip(ptrptr, eom)
++ * Advance *ptrptr to skip over the compressed name it points at.
++ * return:
++ * 0 on success, -1 (with errno set) on failure.
++ */
++int ns_name_skip(const u_char **ptrptr, const u_char *eom)
++{
++ const u_char *cp;
++ u_int n;
++
++ cp = *ptrptr;
++ while (cp < eom && (n = *cp++) != 0)
++ {
++ /* Check for indirection. */
++ switch (n & NS_CMPRSFLGS) {
++ case 0: /* normal case, n == len */
++ cp += n;
++ continue;
++ case NS_CMPRSFLGS: /* indirection */
++ cp++;
++ break;
++ default: /* illegal type */
++ errno = EMSGSIZE;
++ return (-1);
++ }
++ break;
++ }
++ if (cp > eom)
++ {
++ errno = EMSGSIZE;
++ return (-1);
++ }
++ *ptrptr = cp;
++ return (0);
++}
++
++int dn_skipname(const u_char *ptr, const u_char *eom)
++{
++ const u_char *saveptr = ptr;
++
++ if(ns_name_skip(&ptr, eom) == -1)
++ return (-1);
++ return (ptr - saveptr);
++}
++
+diff -Nru aiccu.old/unix-console/Makefile aiccu/unix-console/Makefile
+--- aiccu.old/unix-console/Makefile 2006-11-04 00:51:20.000000000 +0200
++++ aiccu/unix-console/Makefile 2006-11-04 00:48:51.000000000 +0200
+@@ -10,9 +10,9 @@
+ # $Date: 2006-07-25 09:20:48 $
+ # **********************************************************/
+
+-SRCS = main.c ../common/tun.c ../common/aiccu.c ../common/hash_md5.c ../common/hash_sha1.c ../common/common.c ../common/heartbeat.c ../common/tic.c ../common/ayiya.c ../common/aiccu_test.c ../common/resolver.c
++SRCS = main.c ../common/tun.c ../common/aiccu.c ../common/hash_md5.c ../common/hash_sha1.c ../common/common.c ../common/heartbeat.c ../common/tic.c ../common/ayiya.c ../common/aiccu_test.c ../common/resolver.c ../common/dn_skipname.c
+ INCS = ../common/tun.h ../common/aiccu.h ../common/hash_md5.h ../common/hash_sha1.h ../common/common.h ../common/heartbeat.h ../common/tic.h ../common/ayiya.h ../common/resolver.h
+-OBJS = main.o ../common/tun.o ../common/aiccu.o ../common/hash_md5.o ../common/hash_sha1.o ../common/common.o ../common/heartbeat.o ../common/tic.o ../common/ayiya.o ../common/aiccu_test.o ../common/resolver.o
++OBJS = main.o ../common/tun.o ../common/aiccu.o ../common/hash_md5.o ../common/hash_sha1.o ../common/common.o ../common/heartbeat.o ../common/tic.o ../common/ayiya.o ../common/aiccu_test.o ../common/resolver.o ../common/dn_skipname.o
+
+ # New features not fully implemented and thus disabled for now
+ #CFLAGS += -D NEWSTUFF_TSP -D NEWSTUFF_TEEPEE
--- /dev/null
+--- aiccu/common/resolver.c.orig 2007-09-02 23:10:58.000000000 +0200
++++ aiccu/common/resolver.c 2007-09-02 23:11:01.000000000 +0200
+@@ -26,7 +26,7 @@
+
+ int getrrs(const char *label, int rrtype, void gotrec(unsigned int num, int type, const char *record))
+ {
+-#ifdef _LINUX
++#if defined(_LINUX) && !defined(__UCLIBC__)
+ struct __res_state res;
+ #endif
+ unsigned char answer[8192];
+@@ -38,7 +38,7 @@
+ uint16_t type = 0, class = 0;
+ uint32_t ttl = 0;
+
+-#ifdef _LINUX
++#if defined(_LINUX) && !defined(__UCLIBC__)
+ memset(&res, 0, sizeof(res));
+ res.options = RES_DEBUG;
+ res_ninit(&res);
+@@ -47,7 +47,7 @@
+ #endif
+
+ memset(answer, 0, sizeof(answer));
+-#ifdef _LINUX
++#if defined(_LINUX) && !defined(__UCLIBC__)
+ ret = res_nquery(&res, label, C_IN, rrtype, answer, sizeof(answer));
+ #else
+ ret = res_query(label, C_IN, rrtype, answer, sizeof(answer));