Skip to content

Commit

Permalink
execute only after TS is up
Browse files Browse the repository at this point in the history
  • Loading branch information
lmagyar committed May 23, 2024
1 parent b60032b commit cdf8745
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,6 @@ declare login_server
declare tags
declare keyexpiry

# Linux optimizations for subnet routers and exit nodes
# Based on: https://tailscale.com/kb/1320/performance-best-practices#linux-optimizations-for-subnet-routers-and-exit-nodes
# Note: Changes made via ethtool are not persistent and will be lost after the machine shuts down
# Note: Executing it before "tailscale up" to avoid warning messages
# Note: Everything fails silently, we do a best effort only.
if interface=$( \
curl -sf --unix-socket /var/run/tailscale/tailscaled.sock http://local-tailscaled.sock/localapi/v0/check-udp-gro-forwarding \
| jq -rc '.Warning' \
| sed -nr 's/^UDP GRO forwarding is suboptimally configured on (\S+),.*$/\1/p') \
&& bashio::var.has_value "${interface}";
then
bashio::log.info "Allow UDP GRO for forwarding on ${interface}"
ethtool -K "${interface}" rx-udp-gro-forwarding on rx-gro-list off &> /dev/null || true
fi

# Default options
options+=(--hostname "$(bashio::info.hostname)")

Expand Down Expand Up @@ -125,6 +110,20 @@ done

bashio::log.info "Tailscale is running"

# Linux optimizations for subnet routers and exit nodes
# Based on: https://tailscale.com/kb/1320/performance-best-practices#linux-optimizations-for-subnet-routers-and-exit-nodes
# Note: Changes made via ethtool are not persistent and will be lost after the machine shuts down
# Note: Everything fails silently, we do a best effort only.
if interface=$( \
curl -sf --unix-socket /var/run/tailscale/tailscaled.sock http://local-tailscaled.sock/localapi/v0/check-udp-gro-forwarding \
| jq -rc '.Warning' \
| sed -nr 's/^UDP GRO forwarding is suboptimally configured on (\S+),.*$/\1/p') \
&& bashio::var.has_value "${interface}";
then
bashio::log.info "Allow UDP GRO for forwarding on ${interface}"
ethtool -K "${interface}" rx-udp-gro-forwarding on rx-gro-list off &> /dev/null || true
fi

# Delete previously created persistent tailscale serve configuration ONCE
# After add-on's serve (proxy and funnel) service is a longrun service, we do not modify the serve state permanently
# This step can be removed in a later version with the file in the data folder also
Expand Down

0 comments on commit cdf8745

Please sign in to comment.