summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild-openwrt-dev.sh6
-rwxr-xr-xbuild-openwrt.sh6
2 files changed, 10 insertions, 2 deletions
diff --git a/build-openwrt-dev.sh b/build-openwrt-dev.sh
index 9f2021c..4338bfa 100755
--- a/build-openwrt-dev.sh
+++ b/build-openwrt-dev.sh
@@ -52,7 +52,11 @@ lanip4addr=$3
ip6prefix=$4
wanip6addr=${ip6prefix}1/56
lanip6addr=${ip6prefix%%0::}1::1/64
-wanip6ll=$(echo $ip6prefix | sed -e 's#.*:\(....:....\)::$#fe80::\1/64#')
+wanip6ll=$(echo $ip6prefix | sed -ne 's#.*:\([0-9a-f]\{1,4\}:[0-9a-f]\{1,4\}\)::$#fe80::\1/64#pi')
+if [ -z "$wanip6ll" ]
+then echo "Error while generating link-local WAN IPv6 address"
+ exit 2
+fi
if [ '$1$' = "${5:0:3}" ]
then root_password=$5
diff --git a/build-openwrt.sh b/build-openwrt.sh
index e5c1019..939d21d 100755
--- a/build-openwrt.sh
+++ b/build-openwrt.sh
@@ -52,7 +52,11 @@ lanip4addr=$3
ip6prefix=$4
wanip6addr=${ip6prefix}1/56
lanip6addr=${ip6prefix%%0::}1::1/64
-wanip6ll=$(echo $ip6prefix | sed -e 's#.*:\(....:....\)::$#fe80::\1/64#')
+wanip6ll=$(echo $ip6prefix | sed -ne 's#.*:\([0-9a-f]\{1,4\}:[0-9a-f]\{1,4\}\)::$#fe80::\1/64#pi')
+if [ -z "$wanip6ll" ]
+then echo "Error while generating link-local WAN IPv6 address"
+ exit 2
+fi
if [ '$1$' = "${5:0:3}" ]
then root_password=$5