From: Hans Dedecker Date: Fri, 2 Jun 2017 13:38:10 +0000 (+0200) Subject: 464xlat: add ip rule logic in the proto shell handler X-Git-Url: http://git.openwrt.org/?p=feed%2Frouting.git;a=commitdiff_plain;h=eba05ae68203eafcccacefd546eac818cc0bb860 464xlat: add ip rule logic in the proto shell handler Integrate ip rule support for the prelocal routing table lookup in the 464xlat proto shell handler as netifd does not install anymore an ip rule for the prelocal routing table. The prelocal routing table ip rule needs to be installed before the local routing table ip rule so the 464xlat traffic with as destination the IPv6 anycast address is routed to the nat46 module otherwise the traffic will be dropped in the IPv6 local table. Signed-off-by: Hans Dedecker --- diff --git a/nat46/Makefile b/nat46/Makefile index 3af8718..1140bcf 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:=9 +PKG_VERSION:=10 PKG_RELEASE:=$(PKG_SOURCE_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz @@ -33,7 +33,7 @@ endef define Package/464xlat SECTION:=net CATEGORY:=Network - DEPENDS:=+kmod-nat46 + DEPENDS:=+kmod-nat46 +ip TITLE:=464xlat CLAT support endef diff --git a/nat46/files/464xlat.sh b/nat46/files/464xlat.sh index 2ec1094..4b3cd1c 100755 --- a/nat46/files/464xlat.sh +++ b/nat46/files/464xlat.sh @@ -43,6 +43,11 @@ proto_464xlat_setup() { return fi + ip -6 rule del from all lookup local + ip -6 rule add from all lookup local pref 1 + ip -6 rule add to $ip6addr lookup prelocal pref 0 + echo "$ip6addr" > /tmp/464-$cfg-anycast + proto_init_update "$link" 1 proto_add_ipv4_route "0.0.0.0" 0 "" "" 2048 proto_add_ipv6_route $ip6addr 128 "" "" "" "" 128 @@ -74,7 +79,20 @@ proto_464xlat_setup() { } proto_464xlat_teardown() { - 464xlatcfg "464-$1" + local cfg="$1" + local link="464-$cfg" + 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 + + if [ -z "$(ls /tmp/464-*-anycast 2>&-)" ]; then + ip -6 rule del from all lookup local + ip -6 rule add from all lookup local pref 0 + fi } proto_464xlat_init_config() {