[openwrt/openwrt] odhcp6c: change sendopts option into list

LEDE Commits lede-commits at lists.infradead.org
Thu Feb 8 04:14:57 PST 2018


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

commit d8acbb86a1002eb711bf624d9097057548723222
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Mon Feb 5 09:57:48 2018 +0100

    odhcp6c: change sendopts option into list
    
    Commit a26045049b added support for sendopts as a string; since multiple
    sendopts values can be specified it makes more sense to model it as a
    list of strings.
    
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 package/network/ipv6/odhcp6c/Makefile        |  2 +-
 package/network/ipv6/odhcp6c/files/dhcpv6.sh | 14 ++++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/package/network/ipv6/odhcp6c/Makefile b/package/network/ipv6/odhcp6c/Makefile
index 674d12f..ac793f1 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:=6
+PKG_RELEASE:=7
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcp6c.git
diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
index 82b329d..bc7f01d 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
@@ -27,7 +27,7 @@ proto_dhcpv6_init_config() {
 	proto_config_add_string 'ifaceid:ip6addr'
 	proto_config_add_string "userclass"
 	proto_config_add_string "vendorclass"
-	proto_config_add_string "sendopts"
+	proto_config_add_array "sendopts:list(string)"
 	proto_config_add_boolean delegate
 	proto_config_add_int "soltimeout"
 	proto_config_add_boolean fakeroutes
@@ -41,8 +41,7 @@ proto_dhcpv6_setup() {
 	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 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
 
 	# Configure
 	local opts=""
@@ -76,9 +75,12 @@ proto_dhcpv6_setup() {
 		append opts "-r$opt"
 	done
 
-	for opt in $sendopts; do
-		append opts "-x$opt"
-	done
+	sendopts_cb() {
+		local val="$1"
+		append opts "-x$val"
+	}
+
+	json_for_each_item sendopts_cb sendopts
 
 	append opts "-t${soltimeout:-120}"
 



More information about the lede-commits mailing list