Author: jow
Date: 2014-08-11 20:17:09 +0200 (Mon, 11 Aug 2014)
New Revision: 42140

Modified:
   branches/barrier_breaker/package/base-files/Makefile
   branches/barrier_breaker/package/base-files/files/lib/functions/network.sh
Log:
BB: 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 <[email protected]>

Backport of r42139

Modified: branches/barrier_breaker/package/base-files/Makefile
===================================================================
--- branches/barrier_breaker/package/base-files/Makefile        2014-08-11 
18:15:18 UTC (rev 42139)
+++ branches/barrier_breaker/package/base-files/Makefile        2014-08-11 
18:17:09 UTC (rev 42140)
@@ -11,7 +11,7 @@
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=155
+PKG_RELEASE:=156
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
 PKG_BUILD_DEPENDS:=opkg/host

Modified: 
branches/barrier_breaker/package/base-files/files/lib/functions/network.sh
===================================================================
--- branches/barrier_breaker/package/base-files/files/lib/functions/network.sh  
2014-08-11 18:15:18 UTC (rev 42139)
+++ branches/barrier_breaker/package/base-files/files/lib/functions/network.sh  
2014-08-11 18:17:09 UTC (rev 42140)
@@ -29,7 +29,18 @@
 # 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
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to