[openwrt/openwrt] odhcp6c: support multiple additional user prefixes

LEDE Commits lede-commits at lists.infradead.org
Sat Feb 24 12:04:21 PST 2018


dedeckeh pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/66222dd92b3bdb0f035a4ab0370796cfdcdf8593

commit 66222dd92b3bdb0f035a4ab0370796cfdcdf8593
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Wed Feb 14 14:58:07 2018 +0100

    odhcp6c: support multiple additional user prefixes
    
    Support configuration in the form...
    
        list ip6prefix 2001:db8:1234::/64
        list ip6prefix 2001:db8:5678::/64
    
    ... to allow specifying multiple additional IPv6 prefixes.
    
    Implements feature request FS#1361.
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/network/ipv6/odhcp6c/Makefile            |  2 +-
 package/network/ipv6/odhcp6c/files/dhcpv6.script |  4 +++-
 package/network/ipv6/odhcp6c/files/dhcpv6.sh     | 13 +++++++++----
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/package/network/ipv6/odhcp6c/Makefile b/package/network/ipv6/odhcp6c/Makefile
index 9989f80..8abb633 100644
--- a/package/network/ipv6/odhcp6c/Makefile
+++ b/package/network/ipv6/odhcp6c/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=odhcp6c
-PKG_RELEASE:=8
+PKG_RELEASE:=9
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcp6c.git
diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.script b/package/network/ipv6/odhcp6c/files/dhcpv6.script
index 03efaf7..3171013 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.script
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.script
@@ -48,7 +48,9 @@ setup_interface () {
 		fi
 	done
 
-	[ -n "$USERPREFIX" ] && proto_add_ipv6_prefix "$USERPREFIX"
+	for prefix in $USERPREFIX; do
+		proto_add_ipv6_prefix "$prefix"
+	done
 
 	# Merge addresses
 	for entry in $RA_ADDRESSES; do
diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
index 5c2ee6b..54e5106 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
@@ -16,7 +16,7 @@ proto_dhcpv6_init_config() {
 	proto_config_add_string 'forceprefix:bool'
 	proto_config_add_string 'extendprefix:bool'
 	proto_config_add_string 'norelease:bool'
-	proto_config_add_string 'ip6prefix:ip6addr'
+	proto_config_add_array 'ip6prefix:list(ip6addr)'
 	proto_config_add_string iface_dslite
 	proto_config_add_string zone_dslite
 	proto_config_add_string iface_map
@@ -36,12 +36,17 @@ proto_dhcpv6_init_config() {
 	proto_config_add_int "ra_holdoff"
 }
 
+proto_dhcpv6_add_prefix() {
+	append "$3" "$1"
+}
+
 proto_dhcpv6_setup() {
 	local config="$1"
 	local iface="$2"
 
-	local reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass sendopts delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff
-	json_get_vars reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff
+	local reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease ip6prefix ip6prefixes iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass sendopts delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff
+	json_get_vars reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff
+	json_for_each_item proto_dhcpv6_add_prefix ip6prefix ip6prefixes
 
 	# Configure
 	local opts=""
@@ -84,7 +89,7 @@ proto_dhcpv6_setup() {
 
 	append opts "-t${soltimeout:-120}"
 
-	[ -n "$ip6prefix" ] && proto_export "USERPREFIX=$ip6prefix"
+	[ -n "$ip6prefixes" ] && proto_export "USERPREFIX=$ip6prefixes"
 	[ -n "$iface_dslite" ] && proto_export "IFACE_DSLITE=$iface_dslite"
 	[ -n "$iface_map" ] && proto_export "IFACE_MAP=$iface_map"
 	[ -n "$iface_464xlat" ] && proto_export "IFACE_464XLAT=$iface_464xlat"



More information about the lede-commits mailing list