From 20f086de396da5e5dd55c2dd5879bc4696c77329 Mon Sep 17 00:00:00 2001 From: Stephen Walker Date: Sat, 29 Jan 2011 02:38:39 +0000 Subject: [PATCH] radvd: move the client option to the interface config, switch to lists for possible multiple values SVN-Revision: 25234 --- ipv6/radvd/files/radvd.config | 14 ++++------- ipv6/radvd/files/radvd.init | 46 +++++++++-------------------------- 2 files changed, 17 insertions(+), 43 deletions(-) diff --git a/ipv6/radvd/files/radvd.config b/ipv6/radvd/files/radvd.config index 58140dd17..1616c154e 100644 --- a/ipv6/radvd/files/radvd.config +++ b/ipv6/radvd/files/radvd.config @@ -3,12 +3,13 @@ config interface option AdvSendAdvert 1 option AdvManagedFlag 0 option AdvOtherConfigFlag 0 + list client '' option ignore 1 config prefix option interface 'lan' # If not specified, a non-link-local prefix of the interface is used - option prefix '' + list prefix '' option AdvOnLink 1 option AdvAutonomous 1 option AdvRouterAddr 0 @@ -16,21 +17,16 @@ config prefix config route option interface 'lan' - option prefix '' + list prefix '' option ignore 1 config rdnss option interface 'lan' # If not specified, the link-local address of the interface is used - option addr '' + list addr '' option ignore 1 config dnssl option interface 'lan' - option suffix '' - option ignore 1 - -config clients - option interface 'lan' - option client '' + list suffix '' option ignore 1 diff --git a/ipv6/radvd/files/radvd.init b/ipv6/radvd/files/radvd.init index 7e31264d2..dbbe52cc8 100644 --- a/ipv6/radvd/files/radvd.init +++ b/ipv6/radvd/files/radvd.init @@ -159,6 +159,18 @@ radvd_write_interface() { fi done + config_get clients "$cfg" client + if [ -n "$clients" ]; then + printf '\n\tclients\n\t{\n' + + for client in $clients; do + validate_ip6addr "$client" || continue + printf '\t\t%s;\n' "$client" + done + + printf '\t};\n' + fi + return 0 } @@ -352,38 +364,6 @@ radvd_write_dnssl() { return 0 } -radvd_write_clients() { - local cfg=$1 - validate_varname "$cfg" || return 0 - local ignore - local interfaces - local interface - local clients - local client - - config_get_bool ignore "$cfg" ignore 0 - [ "$ignore" -ne 0 ] && return 0 - - config_get interfaces "$cfg" interface - exist=0 - for interface in $interfaces; do - [ "$INTERFACE" = "$interface" ] && exist=1 - done - [ "$exist" -eq 0 ] && return 0 - - printf '\n\tclients\n\t{\n' - - config_get clients "$cfg" client - for client in $clients; do - validate_ip6addr "$client" || continue - printf '\t\t%s;\n' "$client" - done - - printf '\t};\n' - - return 0 -} - radvd_write_config() { include /lib/network @@ -393,7 +373,6 @@ radvd_write_config() { config_foreach radvd_add_interface route config_foreach radvd_add_interface RDNSS config_foreach radvd_add_interface DNSSL - config_foreach radvd_add_interface clients for INTERFACE in $RADVD_INTERFACES; do IFNAME=$(get_ifname "$INTERFACE") || continue @@ -403,7 +382,6 @@ radvd_write_config() { config_foreach radvd_write_route route config_foreach radvd_write_rdnss rdnss config_foreach radvd_write_dnssl dnssl - config_foreach radvd_write_clients clients printf '};\n\n' done -- 2.30.2