From ae3c308186cf1913fa5064fc183d1ef016634aeb Mon Sep 17 00:00:00 2001
From: Florian Fainelli <florian@openwrt.org>
Date: Tue, 13 Dec 2005 13:01:01 +0000
Subject: [PATCH] Added dhcp6, an IPv6 implementation of the dhcp server and
 client Added support in package/rules.mk for zip files, just use
 PKG_CAT=unzip to uncompress the archive

SVN-Revision: 2649
---
 openwrt/package/Config.in                     |   1 +
 openwrt/package/Makefile                      |   2 +
 openwrt/package/dhcp6/Config.in               |   7 ++
 openwrt/package/dhcp6/Makefile                |  35 ++++++
 openwrt/package/dhcp6/ipkg/dhcp6.control      |   5 +
 openwrt/package/dhcp6/ipkg/files/conffiles    |   4 +
 .../dhcp6/patches/01-remove_debug.patch       | 118 ++++++++++++++++++
 openwrt/package/rules.mk                      |   6 +-
 openwrt/package/vnc-reflector/Config.in       |   2 +-
 9 files changed, 178 insertions(+), 2 deletions(-)
 create mode 100644 openwrt/package/dhcp6/Config.in
 create mode 100755 openwrt/package/dhcp6/Makefile
 create mode 100755 openwrt/package/dhcp6/ipkg/dhcp6.control
 create mode 100644 openwrt/package/dhcp6/ipkg/files/conffiles
 create mode 100644 openwrt/package/dhcp6/patches/01-remove_debug.patch

diff --git a/openwrt/package/Config.in b/openwrt/package/Config.in
index 5cd589491c..ad53b4aff5 100644
--- a/openwrt/package/Config.in
+++ b/openwrt/package/Config.in
@@ -151,6 +151,7 @@ source "package/xsupplicant/Config.in"
 comment "IPv6"
 source "package/6tunnel/Config.in"
 source "package/aiccu/Config.in"
+source "package/dhcp6/Config.in"
 source "package/miredo/Config.in"
 source "package/ndisc/Config.in"
 source "package/radvd/Config.in"
diff --git a/openwrt/package/Makefile b/openwrt/package/Makefile
index f906df6074..358e1d6c96 100644
--- a/openwrt/package/Makefile
+++ b/openwrt/package/Makefile
@@ -27,6 +27,7 @@ package-$(BR2_COMPILE_CYRUS_SASL) += cyrus-sasl
 package-$(BR2_COMPILE_DB) += libdb
 package-$(BR2_PACKAGE_DECO) += deco
 package-$(BR2_COMPILE_DHCP) += dhcp
+package-$(BR2_PACKAGE_DHCP6) += dhcp6
 package-$(BR2_PACKAGE_DHCP_FORWARDER) += dhcp-forwarder
 package-$(BR2_PACKAGE_DNSMASQ) += dnsmasq
 package-$(BR2_PACKAGE_DOSFSTOOLS) += dosfstools
@@ -248,6 +249,7 @@ bind-compile: openssl-compile
 curl-compile: openssl-compile zlib-compile
 cyrus-sasl-compile: openssl-compile
 deco-compile: ncurses-compile
+dhcp6-compile: ncurses-compile
 dropbear-compile: zlib-compile
 dsniff-compile: libnids-compile openssl-compile libgdbm-compile
 freetype-compile: zlib-compile
diff --git a/openwrt/package/dhcp6/Config.in b/openwrt/package/dhcp6/Config.in
new file mode 100644
index 0000000000..f00e281e4d
--- /dev/null
+++ b/openwrt/package/dhcp6/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_DHCP6
+	prompt "dhcp6............................. IPv6 DHCP server and client"
+	tristate
+	default m if CONFIG_DEVEL
+	select BR2_PACKAGE_LIBNCURSES
+	help
+		This is the first ever open source implementation of Dynamic Host Configuration Protocol for IPv6 (DHCPv6) server and client on Linux Operating System. The server provides leases (durations or lifetimes) on IPv6 addresses to the clients who request for it
diff --git a/openwrt/package/dhcp6/Makefile b/openwrt/package/dhcp6/Makefile
new file mode 100755
index 0000000000..aef4f5cf09
--- /dev/null
+++ b/openwrt/package/dhcp6/Makefile
@@ -0,0 +1,35 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=dhcp6
+PKG_VERSION:=1.0
+PKG_RELEASE:=1
+PKG_MD5SUM:=86193dfa62137db3ea459543db4f1102
+PKG_SOURCE_URL:=@SF/dhcpv6-linux
+PKG_SOURCE:=dhcpv6-linux-$(PKG_VERSION).zip
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_CAT:=unzip
+
+PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
+
+include $(TOPDIR)/package/rules.mk
+
+$(eval $(call PKG_template,DHCP6,$(PKG_NAME),$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+
+$(PKG_BUILD_DIR)/.configured:
+	touch $@
+
+$(PKG_BUILD_DIR)/.built:
+	$(MAKE) CC=$(TARGET_CC) STAGING_DIR=$(STAGING_DIR) -C $(PKG_BUILD_DIR)/server
+	$(MAKE) CC=$(TARGET_CC) STAGING_DIR=$(STAGING_DIR) -C $(PKG_BUILD_DIR)/client
+	install -d $(PKG_INSTALL_DIR)/usr/sbin $(PKG_INSTALL_DIR)/etc/dhcp{d6,6}
+	install -m0755 $(PKG_BUILD_DIR)/client/cli $(PKG_INSTALL_DIR)/usr/sbin/dhcp6client
+	install -m0755 $(PKG_BUILD_DIR)/server/serv $(PKG_INSTALL_DIR)/usr/sbin/dhcpd6
+	install -m0755 $(PKG_BUILD_DIR)/server/*.conf $(PKG_INSTALL_DIR)/etc/dhcpd6/
+	install -m0755 $(PKG_BUILD_DIR)/client/*.conf $(PKG_INSTALL_DIR)/etc/dhcp6/
+	touch $@
+
+$(IPKG_DHCP6):
+	mkdir -p $(IDIR_DHCP6)
+	cp -fpR $(PKG_INSTALL_DIR)/* $(IDIR_DHCP6)/
+	$(RSTRIP) $(IDIR_DHCP6)
+	$(IPKG_BUILD) $(IDIR_DHCP6) $(PACKAGE_DIR)
diff --git a/openwrt/package/dhcp6/ipkg/dhcp6.control b/openwrt/package/dhcp6/ipkg/dhcp6.control
new file mode 100755
index 0000000000..cc030a0e2b
--- /dev/null
+++ b/openwrt/package/dhcp6/ipkg/dhcp6.control
@@ -0,0 +1,5 @@
+Package: dhcp6
+Section: net
+Architecture: mipsel
+Priority: optional
+Description: This is the first ever open source implementation of Dynamic Host Configuration Protocol for IPv6 (DHCPv6) server and client on Linux Operating System. The server provides leases (durations or lifetimes) on IPv6 addresses to the clients who request for it. 
diff --git a/openwrt/package/dhcp6/ipkg/files/conffiles b/openwrt/package/dhcp6/ipkg/files/conffiles
new file mode 100644
index 0000000000..267baa94d9
--- /dev/null
+++ b/openwrt/package/dhcp6/ipkg/files/conffiles
@@ -0,0 +1,4 @@
+/etc/dhcpd6/dhcpd6.conf
+/etc/dhcpd6/leases6.conf
+/etc/dhcpd6/partial_leases6.conf
+/etc/dhcp6/sollicit.conf
diff --git a/openwrt/package/dhcp6/patches/01-remove_debug.patch b/openwrt/package/dhcp6/patches/01-remove_debug.patch
new file mode 100644
index 0000000000..d39eeb1261
--- /dev/null
+++ b/openwrt/package/dhcp6/patches/01-remove_debug.patch
@@ -0,0 +1,118 @@
+diff -urN orig/dhcp6-1.0/client/Makefile dhcp6-1.0/client/Makefile
+--- orig/dhcp6-1.0/client/Makefile	2025-06-28 23:21:40.000000000 +0200
++++ dhcp6-1.0/client/Makefile	2005-12-13 13:43:11.000000000 +0100
+@@ -1,42 +1,40 @@
+-
+-CC = gcc
+ STD_HEADERS = stdhead.h head.h struct.h options_type.h message_type.h states.h timer_val.h constants.h macros.h status_codes.h
+ OBJECT_FILES = client.o solicit.o clilib.o parse.o request.o decline.o renew.o rebind.o release.o
+ HEADER_FILES = solicit.h clilib.h parse.h request.h decline.h renew.h rebind.h release.h
+-
++IFLAGS = -I$(STAGING_DIR)/usr/include
+ 
+ dhcpv6_client : dhcpv6_client.c cli
+-	$(CC) -g3 dhcpv6_client.c -o dhcpv6_client
++	$(CC) $(IFLAGS) dhcpv6_client.c -o dhcpv6_client
+ 
+ cli : $(OBJECT_FILES)
+-	$(CC) -g3 $(OBJECT_FILES) -o cli -lncurses
++	$(CC) $(IFLAGS) $(OBJECT_FILES) -o cli -L$(STAGING_DIR)/usr/lib -lncurses
+ 
+ client.o : client.c $(STD_HEADERS) $(HEADER_FILES)
+-	$(CC) -g3 -c client.c -o client.o
++	$(CC) $(IFLAGS) -c client.c -o client.o
+ 
+ release.o : release.c release.h clilib.h
+-	$(CC) -g3 -c release.c -o release.o
++	$(CC) $(IFLAGS) -c release.c -o release.o
+ 
+ rebind.o : rebind.c rebind.h clilib.h
+-	$(CC) -g3 -c rebind.c -o rebind.o
++	$(CC)  $(IFLAGS) -c rebind.c -o rebind.o
+ 
+ renew.o : renew.c renew.h clilib.h
+-	$(CC) -g3 -c renew.c -o renew.o
++	$(CC) $(IFLAGS) -c renew.c -o renew.o
+ 
+ request.o : request.c request.h clilib.h
+-	$(CC) -g3 -c request.c -o request.o
++	$(CC) $(IFLAGS) -c request.c -o request.o
+ 
+ decline.o : decline.c decline.h clilib.h parse.h solicit.h
+-	$(CC) -g3 -c decline.c -o decline.o
++	$(CC) $(IFLAGS) -c decline.c -o decline.o
+ 
+ solicit.o : solicit.c solicit.h clilib.h parse.h
+-	$(CC) -g3 -c solicit.c -o solicit.o
++	$(CC) $(IFLAGS) -c solicit.c -o solicit.o
+ 
+ clilib.o : clilib.c clilib.h parse.h
+-	$(CC) -g3 -c clilib.c -o clilib.o
++	$(CC) $(IFLAGS) -c clilib.c -o clilib.o
+ 
+ parse.o : parse.c parse.h clilib.h
+-	$(CC) -g3 -c parse.c -o parse.o
++	$(CC) $(IFLAGS) -c parse.c -o parse.o
+ 
+ clean :
+ 	rm -f *.o cli dhcpv6_client
+diff -urN orig/dhcp6-1.0/client/clilib.c dhcp6-1.0/client/clilib.c
+--- orig/dhcp6-1.0/client/clilib.c	2025-06-28 23:21:40.000000000 +0200
++++ dhcp6-1.0/client/clilib.c	2005-12-13 13:42:43.000000000 +0100
+@@ -554,7 +554,7 @@
+ 
+ void generate_trans_id (u_int32_t *trans_id)
+ {
+-    extern u_int32_t g_trans_id;
++    extern int g_trans_id;
+     time_t t;
+     srand (time (&t));
+     *trans_id = 0;
+@@ -890,9 +890,7 @@
+ 		    break;
+ 
+ 		default :
+-#if DEBUG == 3
+ 		    printf ("Unrecognized DUID type\n");
+-#endif
+ 	    }
+ 
+ 	    next_opt = (struct OPTIONS *) malloc (sizeof (struct OPTIONS));
+diff -urN orig/dhcp6-1.0/server/Makefile dhcp6-1.0/server/Makefile
+--- orig/dhcp6-1.0/server/Makefile	2002-06-28 14:50:04.000000000 +0200
++++ dhcp6-1.0/server/Makefile	2005-12-13 11:35:53.000000000 +0100
+@@ -1,27 +1,26 @@
+-CC = gcc
+ STD_HEADERS = stdhead.h head.h struct.h options_type.h message_type.h macros.h status_codes.h constants.h
+ OBJECT_FILES = server.o lib.o advertise.o parse.o leases.o reply.o
+ 
+ serv: $(OBJECT_FILES)
+-	$(CC) -g3 $(OBJECT_FILES) -o serv
++	$(CC) $(OBJECT_FILES) -o serv
+ 
+ lib.o: lib.c lib.h $(STD_HEADERS)
+-	$(CC) -g3 -c lib.c -o lib.o
++	$(CC) -c lib.c -o lib.o
+ 
+ parse.o: parse.c parse.h $(STD_HEADERS)
+-	$(CC) -g3 -c parse.c -o parse.o
++	$(CC) -c parse.c -o parse.o
+ 
+ leases.o: leases.c leases.h $(STD_HEADERS)
+-	$(CC) -g3 -c leases.c -o leases.o
++	$(CC) -c leases.c -o leases.o
+ 
+ advertise.o: advertise.c advertise.h $(STD_HEADERS)
+-	$(CC) -g3 -c advertise.c -o advertise.o
++	$(CC) -c advertise.c -o advertise.o
+ 
+ reply.o: reply.c reply.h $(STD_HEADERS)
+-	$(CC) -g3 -c reply.c -o reply.o
++	$(CC) -c reply.c -o reply.o
+ 
+ server.o: server.c lib.h advertise.h reply.h leases.h parse.h $(STD_HEADERS)
+-	$(CC) -g3 -c server.c -o server.o
++	$(CC) -c server.c -o server.o
+ 
+ clean: 
+ 	rm -f *.o serv
diff --git a/openwrt/package/rules.mk b/openwrt/package/rules.mk
index 18f53bdc3d..9bbf4fa48f 100644
--- a/openwrt/package/rules.mk
+++ b/openwrt/package/rules.mk
@@ -45,7 +45,11 @@ ifneq ($(strip $(PKG_CAT)),)
 $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
 	rm -rf $(PKG_BUILD_DIR)
 	mkdir -p $(PKG_BUILD_DIR)
-	$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) -
+	if [ "$(PKG_CAT)" = "unzip" ]; then \
+		unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE) ; \
+	else \
+		$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) - ; \
+	fi						  
 	if [ -d ./patches ]; then \
 		$(PATCH) $(PKG_BUILD_DIR) ./patches ; \
 	fi
diff --git a/openwrt/package/vnc-reflector/Config.in b/openwrt/package/vnc-reflector/Config.in
index 84a158c399..19dfebf4bd 100755
--- a/openwrt/package/vnc-reflector/Config.in
+++ b/openwrt/package/vnc-reflector/Config.in
@@ -1,5 +1,5 @@
 config BR2_PACKAGE_VNC_REFLECTOR
-        tristate "vnc-reflector....................... VNC proxy for multiple clients"
+        tristate "vnc-reflector - VNC proxy"
 	default m if CONFIG_DEVEL
 	depends on BR2_PACKAGE_JPEG
 	depends on BR2_PACKAGE_ZLIB
-- 
GitLab