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@mein.io>
openwrt-18.06
Jo-Philipp Wich 2018-02-14 14:58:07 +01:00 committed by Hans Dedecker
parent 0f54d96d24
commit 66222dd92b
3 changed files with 13 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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"