summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Dedecker2018-01-16 09:29:20 +0000
committerHans Dedecker2018-01-16 14:35:57 +0000
commit013b91dc6d5817ad99f39cc2527df375e3524b33 (patch)
tree2543375e280650eff1a6183935f76fe6fc30ad16
parentd464bf11b84056a87fc8fcab90111dd50d13886a (diff)
downloadrouting-013b91dc6d5817ad99f39cc2527df375e3524b33.tar.gz
nat46: harden 464xlat teardown logic
Quit the teardown function in case the file 464-$cfg-anycast is not present as it means no clean up of ip rules is required. It fixes error traces like "cat: can't open '/tmp/464-wan6_4-anycast': No such file or directory" and "Error: inet6 prefix is expected rather than "lookup"." At the same time remove the unused variable anycast_active. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r--nat46/Makefile2
-rwxr-xr-xnat46/files/464xlat.sh5
2 files changed, 4 insertions, 3 deletions
diff --git a/nat46/Makefile b/nat46/Makefile
index 1140bcf..6933d29 100644
--- a/nat46/Makefile
+++ b/nat46/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=nat46
-PKG_VERSION:=10
+PKG_VERSION:=11
PKG_RELEASE:=$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
diff --git a/nat46/files/464xlat.sh b/nat46/files/464xlat.sh
index 4b3cd1c..1d52e2c 100755
--- a/nat46/files/464xlat.sh
+++ b/nat46/files/464xlat.sh
@@ -81,13 +81,14 @@ proto_464xlat_setup() {
proto_464xlat_teardown() {
local cfg="$1"
local link="464-$cfg"
+
+ [ -f /tmp/464-$cfg-anycast ] || return
local ip6addr=$(cat /tmp/464-$cfg-anycast)
- local anycast_active
464xlatcfg "$link"
rm -rf /tmp/464-$cfg-anycast
- ip -6 rule del to $ip6addr lookup prelocal
+ [ -n "$ip6addr" ] && ip -6 rule del to $ip6addr lookup prelocal
if [ -z "$(ls /tmp/464-*-anycast 2>&-)" ]; then
ip -6 rule del from all lookup local