[openwrt/openwrt] 6in4: Support fqdn as remote tunnel endpoint
LEDE Commits
lede-commits at lists.infradead.org
Sun Sep 22 07:30:02 PDT 2024
hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/6b5aea74293fe93e8abac411f9d974e8876e3252
commit 6b5aea74293fe93e8abac411f9d974e8876e3252
Author: Aleksandr V. Piskunov <aleksandr.v.piskunov at gmail.com>
AuthorDate: Tue Jul 16 16:44:35 2024 +0300
6in4: Support fqdn as remote tunnel endpoint
Same as fqdn support in GRE (commit a79f3d11b3) and IPIP (commit 311682905e)
Signed-off-by: Aleksandr V. Piskunov <aleksandr.v.piskunov at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/15961
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
package/network/ipv6/6in4/Makefile | 2 +-
package/network/ipv6/6in4/files/6in4.sh | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/package/network/ipv6/6in4/Makefile b/package/network/ipv6/6in4/Makefile
index edbb7d71a0..3c7dd4609b 100644
--- a/package/network/ipv6/6in4/Makefile
+++ b/package/network/ipv6/6in4/Makefile
@@ -16,7 +16,7 @@ include $(INCLUDE_DIR)/package.mk
define Package/6in4
SECTION:=net
CATEGORY:=Network
- DEPENDS:=@IPV6 +kmod-sit +uclient-fetch
+ DEPENDS:=@IPV6 +kmod-sit +uclient-fetch +resolveip
TITLE:=IPv6-in-IPv4 configuration support
MAINTAINER:=Jo-Philipp Wich <jo at mein.io>
PKGARCH:=all
diff --git a/package/network/ipv6/6in4/files/6in4.sh b/package/network/ipv6/6in4/files/6in4.sh
index 99b2b76312..e500c6dec8 100755
--- a/package/network/ipv6/6in4/files/6in4.sh
+++ b/package/network/ipv6/6in4/files/6in4.sh
@@ -44,6 +44,7 @@ proto_6in4_setup() {
local cfg="$1"
local iface="$2"
local link="6in4-$cfg"
+ local remoteip
local mtu ttl tos ipaddr peeraddr ip6addr ip6prefix ip6prefixes tunlink tunnelid username password updatekey device
json_get_vars mtu ttl tos ipaddr peeraddr ip6addr tunlink tunnelid username password updatekey device
@@ -52,11 +53,23 @@ proto_6in4_setup() {
[ -n "$device" ] && link="$device"
[ -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" ] && {
More information about the lede-commits
mailing list