Skip to content

Commit 989c19f

Browse files
authored
Fix format string bug in GetPodMTU error logging (#3471)
Changed error log in GetPodMTU to use podMTU (string input) instead of mtu (int result) when logging parse failures. This fixes the format string mismatch that causes: {"level":"error","ts":"2025-10-02T23:03:58.442+0200","caller":"routed-eni-cni-plugin/cni.go:163","msg":"Failed to parse pod MTU %!s(int=0): strconv.Atoi: parsing \"\": invalid syntax"} in the output of "make unit-test".
1 parent 5c08a6f commit 989c19f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/networkutils/network.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ func GetEthernetMTU() int {
13881388
func GetPodMTU(podMTU string) int {
13891389
mtu, err := strconv.Atoi(podMTU)
13901390
if err != nil {
1391-
log.Errorf("Failed to parse pod MTU %s: %v", mtu, err)
1391+
log.Errorf("Failed to parse pod MTU %s: %v", podMTU, err)
13921392
return defaultMTU
13931393
}
13941394

0 commit comments

Comments
 (0)