Skip to content

Commit

Permalink
fix-host-connectivity: don't add rule if it already exist
Browse files Browse the repository at this point in the history
  • Loading branch information
cmj2002 committed Aug 15, 2024
1 parent 2ffe606 commit f1e1a49
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions healthcheck/fix-host-connectivity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,17 @@ fi

# add excluded networks to nft table cloudflare-warp and routing table
for network in $networks; do
if ! sudo nft list table inet cloudflare-warp | grep -q "saddr $network accept"; then
echo "[fix-host-connectivity] Adding $network to input chain of nft table cloudflare-warp ."
sudo nft add rule inet cloudflare-warp input ip saddr $network accept
fi
if ! sudo nft list table inet cloudflare-warp | grep -q "daddr $network accept"; then
echo "[fix-host-connectivity] Adding $network to output chain of nft table cloudflare-warp ."
sudo nft add rule inet cloudflare-warp output ip daddr $network accept
fi
if ! ip rule list | grep -q "$network lookup main"; then
# stop packet from using routing table created by CloudflareWARP
echo "[fix-host-connectivity] Adding routing rule for $network."
sudo ip rule add to $network lookup main priority 10
fi
done

0 comments on commit f1e1a49

Please sign in to comment.