diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2016-10-25 22:50:04 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2016-10-26 17:53:53 +0200 |
commit | 311682905edb56abd31c7ece3664910586070b91 (patch) | |
tree | dd4f12731e869dc46c9fe32604333f8f6e587ad8 /package/network/config/ipip | |
parent | 9097dc5ad844c336020be11085e1c8c80390ac9c (diff) | |
download | mtk-20170518-311682905edb56abd31c7ece3664910586070b91.zip mtk-20170518-311682905edb56abd31c7ece3664910586070b91.tar.gz mtk-20170518-311682905edb56abd31c7ece3664910586070b91.tar.bz2 |
ipip: Support fqdn as remote tunnel endpoint
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'package/network/config/ipip')
-rw-r--r-- | package/network/config/ipip/Makefile | 4 | ||||
-rwxr-xr-x | package/network/config/ipip/files/ipip.sh | 15 |
2 files changed, 16 insertions, 3 deletions
diff --git a/package/network/config/ipip/Makefile b/package/network/config/ipip/Makefile index 5aa722d..9bdb13c 100644 --- a/package/network/config/ipip/Makefile +++ b/package/network/config/ipip/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ipip PKG_VERSION:=1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=GPL-2.0 include $(INCLUDE_DIR)/package.mk @@ -19,7 +19,7 @@ define Package/ipip CATEGORY:=Network MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com> TITLE:=IP in IP Tunnel config support - DEPENDS:= +kmod-ipip + DEPENDS:= +kmod-ipip +resolveip endef define Package/ipip/description diff --git a/package/network/config/ipip/files/ipip.sh b/package/network/config/ipip/files/ipip.sh index 51c503f..f1c94d6 100755 --- a/package/network/config/ipip/files/ipip.sh +++ b/package/network/config/ipip/files/ipip.sh @@ -9,16 +9,29 @@ proto_ipip_setup() { local cfg="$1" + local remoteip local df ipaddr peeraddr tunlink ttl tos zone mtu json_get_vars df ipaddr peeraddr tunlink ttl tos zone mtu [ -z "$peeraddr" ] && { - proto_notify_error "$cfg" "MISSING_ADDRESS" + proto_notify_error "$cfg" "MISSING_PEER_ADDRESS" proto_block_restart "$cfg" return } + remoteip=$(resolveip -t 10 -4 "$peeraddr") + + if [ -z "$remoteip" ]; then + proto_notify_error "$cfg" "PEER_RESOLVE_FAIL" + return + fi + + for ip in $remoteip; do + peeraddr=$ip + break + done + ( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" ) [ -z "$ipaddr" ] && { |