ipip: Support fqdn as remote tunnel endpoint
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
This commit is contained in:
parent
9097dc5ad8
commit
311682905e
2 changed files with 16 additions and 3 deletions
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=ipip
|
PKG_NAME:=ipip
|
||||||
PKG_VERSION:=1
|
PKG_VERSION:=1
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
PKG_LICENSE:=GPL-2.0
|
PKG_LICENSE:=GPL-2.0
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
@ -19,7 +19,7 @@ define Package/ipip
|
||||||
CATEGORY:=Network
|
CATEGORY:=Network
|
||||||
MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
|
MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
|
||||||
TITLE:=IP in IP Tunnel config support
|
TITLE:=IP in IP Tunnel config support
|
||||||
DEPENDS:= +kmod-ipip
|
DEPENDS:= +kmod-ipip +resolveip
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/ipip/description
|
define Package/ipip/description
|
||||||
|
|
|
@ -9,16 +9,29 @@
|
||||||
|
|
||||||
proto_ipip_setup() {
|
proto_ipip_setup() {
|
||||||
local cfg="$1"
|
local cfg="$1"
|
||||||
|
local remoteip
|
||||||
|
|
||||||
local df ipaddr peeraddr tunlink ttl tos zone mtu
|
local df ipaddr peeraddr tunlink ttl tos zone mtu
|
||||||
json_get_vars df ipaddr peeraddr tunlink ttl tos zone mtu
|
json_get_vars df ipaddr peeraddr tunlink ttl tos zone mtu
|
||||||
|
|
||||||
[ -z "$peeraddr" ] && {
|
[ -z "$peeraddr" ] && {
|
||||||
proto_notify_error "$cfg" "MISSING_ADDRESS"
|
proto_notify_error "$cfg" "MISSING_PEER_ADDRESS"
|
||||||
proto_block_restart "$cfg"
|
proto_block_restart "$cfg"
|
||||||
return
|
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" )
|
( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" )
|
||||||
|
|
||||||
[ -z "$ipaddr" ] && {
|
[ -z "$ipaddr" ] && {
|
||||||
|
|
Loading…
Reference in a new issue