[LEDE-DEV] [RFC PATCH 1/2] odhcp6c: support multiple additional user prefixes
Hans Dedecker
dedeckeh at gmail.com
Mon Feb 19 07:00:06 PST 2018
On Wed, Feb 14, 2018 at 2:58 PM, Jo-Philipp Wich <jo at mein.io> wrote:
> 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>
Acked-by: Hans Dedecker <dedeckeh at gmail.com>
> ---
> 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 9989f80f1a..8abb63317f 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 03efaf7211..3171013966 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 5c2ee6b988..54e51065f6 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"
> --
> 2.15.1
>
More information about the Lede-dev
mailing list