[packages] radvd: move the client option to the interface config, switch to lists...
authorswalker <swalker@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 29 Jan 2011 02:38:39 +0000 (02:38 +0000)
committerswalker <swalker@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 29 Jan 2011 02:38:39 +0000 (02:38 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@25234 3c298f89-4303-0410-b956-a3cf2f4a3e73

ipv6/radvd/files/radvd.config
ipv6/radvd/files/radvd.init

index 58140dd..1616c15 100644 (file)
@@ -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
index 7e31264..dbbe52c 100644 (file)
@@ -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