From 857733863c70b6bf3e9a114a2a03c617d7981f1e Mon Sep 17 00:00:00 2001 From: Git Sagar Date: Sun, 7 Jun 2026 00:42:56 +0530 Subject: [PATCH] netcfg: suppress RTNETLINK errors from policy route cleanup Use runQuiet for ip rule/route del commands that may fail harmlessly when no existing rule exists (e.g. first run after deploy). Co-Authored-By: Claude Opus 4.6 (1M context) --- pkg/netcfg/netcfg.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/netcfg/netcfg.go b/pkg/netcfg/netcfg.go index 2c46837..47ead19 100644 --- a/pkg/netcfg/netcfg.go +++ b/pkg/netcfg/netcfg.go @@ -99,7 +99,7 @@ func ConfigurePolicyRoute(ifname string, lease *dhcp.Lease, table int) func() { clientIP := lease.ClientIP.String() gw := lease.Gateway.String() - run("ip", "rule", "del", "table", t) + runQuiet("ip", "rule", "del", "table", t) run("ip", "route", "replace", "default", "via", gw, "dev", ifname, "table", t) if err := run("ip", "rule", "add", "from", clientIP, "table", t); err != nil { log.Printf("warning: policy rule: %v", err) @@ -108,8 +108,8 @@ func ConfigurePolicyRoute(ifname string, lease *dhcp.Lease, table int) func() { } return func() { - run("ip", "rule", "del", "table", t) - run("ip", "route", "del", "default", "table", t) + runQuiet("ip", "rule", "del", "table", t) + runQuiet("ip", "route", "del", "default", "table", t) log.Printf("policy route: cleaned up table %s", t) } } @@ -233,3 +233,7 @@ func run(name string, args ...string) error { cmd.Stderr = os.Stderr return cmd.Run() } + +func runQuiet(name string, args ...string) error { + return exec.Command(name, args...).Run() +}