Skip to content

Commit 55f8f16

Browse files
committed
warn, when there's no default interface
1 parent 2c92a87 commit 55f8f16

File tree

1 file changed

+17
-12
lines changed
  • tailscale/rootfs/etc/s6-overlay/s6-rc.d/forwarding

1 file changed

+17
-12
lines changed

tailscale/rootfs/etc/s6-overlay/s6-rc.d/forwarding/run

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,22 @@ function setup_forwarding() {
7575
fi
7676
}
7777

78-
# Tailscale's IP addresses
79-
if ! from_address_ipv4=$(/opt/tailscale ip -4); then
80-
bashio::log.warning "Failed to retrieve Tailscale's IPv4 address"
81-
fi
82-
if ! from_address_ipv6=$(/opt/tailscale ip -6); then
83-
bashio::log.warning "Failed to retrieve Tailscale's IPv6 address"
84-
fi
78+
if ! bashio::api.supervisor GET "/network/interface/default/info" false > /dev/null; then
79+
bashio::log.warning \
80+
"The host has no primary (default) interface, can't forward incoming tailnet connections to the host"
81+
else
82+
# Tailscale's IP addresses
83+
if ! from_address_ipv4=$(/opt/tailscale ip -4); then
84+
bashio::log.warning "Failed to retrieve Tailscale's IPv4 address"
85+
fi
86+
if ! from_address_ipv6=$(/opt/tailscale ip -6); then
87+
bashio::log.warning "Failed to retrieve Tailscale's IPv6 address"
88+
fi
8589

86-
# Host's IP addresses
87-
to_address_ipv4=$(get_host_address "ipv4")
88-
to_address_ipv6=$(get_host_address "ipv6")
90+
# Host's IP addresses
91+
to_address_ipv4=$(get_host_address "ipv4")
92+
to_address_ipv6=$(get_host_address "ipv6")
8993

90-
setup_forwarding "iptables" "IPv4" "${from_address_ipv4}" "32" "${to_address_ipv4}"
91-
setup_forwarding "ip6tables" "IPv6" "${from_address_ipv6}" "128" "${to_address_ipv6}"
94+
setup_forwarding "iptables" "IPv4" "${from_address_ipv4}" "32" "${to_address_ipv4}"
95+
setup_forwarding "ip6tables" "IPv6" "${from_address_ipv6}" "128" "${to_address_ipv6}"
96+
fi

0 commit comments

Comments
 (0)