summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2018-08-18 17:16:13 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2018-08-18 17:16:13 +0200
commitbf85573c4e88fc8e7f23a32c17a4f7b6118819fd (patch)
tree7779fc1e369233b197b0bdceb92e2945fb522a8f
parentbe6355d272a2c300636723c146c0bbf9be080eae (diff)
downloadchd_openwrt-bf85573c4e88fc8e7f23a32c17a4f7b6118819fd.zip
chd_openwrt-bf85573c4e88fc8e7f23a32c17a4f7b6118819fd.tar.gz
chd_openwrt-bf85573c4e88fc8e7f23a32c17a4f7b6118819fd.tar.bz2
Fix wrong wanip6ll generation and add fence instead of genereating a broken config file
-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