summaryrefslogtreecommitdiff
path: root/package/base-files/files
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-08-11 18:15:18 +0000
committerJo-Philipp Wich <jow@openwrt.org>2014-08-11 18:15:18 +0000
commitf63509ac89d9b955a048846641a2937600066904 (patch)
tree69933448f8d8f13205f862dddf8d25d56bcb0533 /package/base-files/files
parentaa9e69908eccdee69d3a804e4fa69d386fc0e66f (diff)
downloadmtk-20170518-f63509ac89d9b955a048846641a2937600066904.zip
mtk-20170518-f63509ac89d9b955a048846641a2937600066904.tar.gz
mtk-20170518-f63509ac89d9b955a048846641a2937600066904.tar.bz2
base-files: /lib/functions/network.sh: fix network_get_ipaddr6
When looking for the first ipaddr also consider the current prefix just like network_get_ipaddrs6 does. If ipv6-address was empty the function did not return the first ipaddr even if the list was non-empty. fixes commit 83e9122f88a002871d5cdf421cf6aa6052b7e006 Signed-off-by: Henning Schild <henning@hennsch.de> SVN-Revision: 42139
Diffstat (limited to 'package/base-files/files')
-rw-r--r--package/base-files/files/lib/functions/network.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/package/base-files/files/lib/functions/network.sh b/package/base-files/files/lib/functions/network.sh
index 86ab890..f4cf2b5 100644
--- a/package/base-files/files/lib/functions/network.sh
+++ b/package/base-files/files/lib/functions/network.sh
@@ -29,7 +29,18 @@ network_get_ipaddr() {
# 1: destination variable
# 2: interface
network_get_ipaddr6() {
- __network_ifstatus "$1" "$2" "['ipv6-address'][0].address";
+ local __addr
+
+ if __network_ifstatus "__addr" "$2" "['ipv6-address','ipv6-prefix-assignment'][0].address"; then
+ case "$__addr" in
+ *:) export "$1=${__addr}1" ;;
+ *) export "$1=${__addr}" ;;
+ esac
+ return 0
+ fi
+
+ unset $1
+ return 1
}
# determine first IPv4 subnet of given logical interface