From 909a292a8df1d92c9fccbe83197bf5f7e6f61eef Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 29 May 2024 20:46:02 -0700 Subject: [PATCH] util/linuxfw: don't try cleaning iptables on gokrazy It just generates log spam. Updates #12277 Change-Id: I5f65c0859e86de0a5349f9d26c9805e7c26b9371 Signed-off-by: Brad Fitzpatrick --- util/linuxfw/iptables_runner.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/linuxfw/iptables_runner.go b/util/linuxfw/iptables_runner.go index e2e04af9c..507f6cd48 100644 --- a/util/linuxfw/iptables_runner.go +++ b/util/linuxfw/iptables_runner.go @@ -20,6 +20,7 @@ "tailscale.com/net/tsaddr" "tailscale.com/types/logger" "tailscale.com/util/multierr" + "tailscale.com/version/distro" ) // isNotExistError needs to be overridden in tests that rely on distinguishing @@ -653,6 +654,11 @@ func (i *iptablesRunner) DelMagicsockPortRule(port uint16, network string) error // IPTablesCleanUp removes all Tailscale added iptables rules. // Any errors that occur are logged to the provided logf. func IPTablesCleanUp(logf logger.Logf) { + if distro.Get() == distro.Gokrazy { + // Gokrazy uses nftables and doesn't have the "iptables" command. + // Avoid log spam on cleanup. (#12277) + return + } err := clearRules(iptables.ProtocolIPv4, logf) if err != nil { logf("linuxfw: clear iptables: %v", err)