Skip to content

Commit

Permalink
6in4: Support fqdn as remote tunnel endpoint
Browse files Browse the repository at this point in the history
Same as fqdn support in GRE (commit a79f3d1) and IPIP (commit 3116829)

Signed-off-by: Aleksandr V. Piskunov <[email protected]>
Link: openwrt/openwrt#15961
Signed-off-by: Hauke Mehrtens <[email protected]>
  • Loading branch information
notgood authored and hauke committed Sep 22, 2024
1 parent cdb535a commit 6b5aea7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package/network/ipv6/6in4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
PKGARCH:=all
Expand Down
15 changes: 14 additions & 1 deletion package/network/ipv6/6in4/files/6in4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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" ] && {
Expand Down

0 comments on commit 6b5aea7

Please sign in to comment.