[source] gre: Support fqdn as remote tunnel endpoint
LEDE Commits
lede-commits at lists.infradead.org
Tue Oct 4 02:51:23 PDT 2016
blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/a79f3d11b3d7e4441544a2401f129bd055e84034
commit a79f3d11b3d7e4441544a2401f129bd055e84034
Author: Hans Dedecker <dedeckeh at gmail.com>
AuthorDate: Mon Oct 3 10:56:45 2016 +0200
gre: Support fqdn as remote tunnel endpoint
Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
package/network/config/gre/Makefile | 6 +++---
package/network/config/gre/files/gre.sh | 30 ++++++++++++++++++++++++++++--
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/package/network/config/gre/Makefile b/package/network/config/gre/Makefile
index 12257a8..2e05ffc 100644
--- a/package/network/config/gre/Makefile
+++ b/package/network/config/gre/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=gre
PKG_VERSION:=1
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
@@ -32,7 +32,7 @@ endef
define Package/grev4
$(call Package/gre/Default)
TITLE:=Generic Routing Encapsulation (IPv4) config support
- DEPENDS:=@(PACKAGE_gre) +kmod-gre
+ DEPENDS:=@(PACKAGE_gre) +kmod-gre +resolveip
endef
define Package/grev4/description
@@ -42,7 +42,7 @@ endef
define Package/grev6
$(call Package/gre/Default)
TITLE:=Generic Routing Encapsulation (IPv6) config support
- DEPENDS:=@(PACKAGE_gre) @IPV6 +kmod-gre6
+ DEPENDS:=@(PACKAGE_gre) @IPV6 +kmod-gre6 +resolveip
endef
define Package/grev6/description
diff --git a/package/network/config/gre/files/gre.sh b/package/network/config/gre/files/gre.sh
index cab52d3..3f472c4 100755
--- a/package/network/config/gre/files/gre.sh
+++ b/package/network/config/gre/files/gre.sh
@@ -44,16 +44,29 @@ gre_generic_setup() {
gre_setup() {
local cfg="$1"
local mode="$2"
+ local remoteip
local ipaddr peeraddr
json_get_vars df ipaddr peeraddr tunlink
[ -z "$peeraddr" ] && {
- proto_notify_error "$cfg" "MISSING_ADDRESS"
+ proto_notify_error "$cfg" "MISSING_PEER_ADDRESS"
proto_block_restart "$cfg"
exit
}
+ remoteip=$(resolveip -t 10 -4 "$peeraddr")
+
+ if [ -z "$remoteip" ]; then
+ proto_notify_error "$cfg" "PEER_RESOLVE_FAIL"
+ exit
+ fi
+
+ for ip in $remoteip; do
+ peeraddr=$ip
+ break
+ done
+
( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" )
[ -z "$ipaddr" ] && {
@@ -101,16 +114,29 @@ proto_gretap_setup() {
grev6_setup() {
local cfg="$1"
local mode="$2"
+ local remoteip6
local ip6addr peer6addr weakif
json_get_vars ip6addr peer6addr tunlink weakif
[ -z "$peer6addr" ] && {
- proto_notify_error "$cfg" "MISSING_ADDRESS"
+ proto_notify_error "$cfg" "MISSING_PEER_ADDRESS"
proto_block_restart "$cfg"
exit
}
+ remoteip6=$(resolveip -t 10 -6 "$peer6addr")
+
+ if [ -z "$remoteip6" ]; then
+ proto_notify_error "$cfg" "PEER_RESOLVE_FAIL"
+ exit
+ fi
+
+ for ip6 in $remoteip6; do
+ peer6addr=$ip6
+ break
+ done
+
( proto_add_host_dependency "$cfg" "$peer6addr" "$tunlink" )
[ -z "$ip6addr" ] && {
More information about the lede-commits
mailing list