From 75f6a1d5969b0a6f65e7bfaea266336e77373633 Mon Sep 17 00:00:00 2001 From: Ingo Becker Date: Fri, 25 Nov 2022 17:49:02 +0100 Subject: [PATCH] Fix swapped NetInput/-Output stats Fix swapped NetInput and NetOutput container stats. This resulted in `podman stats` showing outgoing traffic as NetInput and incoming traffic as NetOutput. This change might be visible or cause problems for users who are actively relying on those stats for monitoring reasons. [NO NEW TEST NEEDED] Signed-off-by: Ingo Becker --- libpod/stats_freebsd.go | 4 ++-- libpod/stats_linux.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libpod/stats_freebsd.go b/libpod/stats_freebsd.go index fcc0985597..e2ec9516cf 100644 --- a/libpod/stats_freebsd.go +++ b/libpod/stats_freebsd.go @@ -82,8 +82,8 @@ func (c *Container) getPlatformContainerStats(stats *define.ContainerStats, prev // Handle case where the container is not in a network namespace if netStats != nil { - stats.NetInput = netStats.TxBytes - stats.NetOutput = netStats.RxBytes + stats.NetInput = netStats.RxBytes + stats.NetOutput = netStats.TxBytes } else { stats.NetInput = 0 stats.NetOutput = 0 diff --git a/libpod/stats_linux.go b/libpod/stats_linux.go index aad9d70516..5eb0449383 100644 --- a/libpod/stats_linux.go +++ b/libpod/stats_linux.go @@ -72,8 +72,8 @@ func (c *Container) getPlatformContainerStats(stats *define.ContainerStats, prev stats.PerCPU = cgroupStats.CpuStats.CpuUsage.PercpuUsage // Handle case where the container is not in a network namespace if netStats != nil { - stats.NetInput = netStats.TxBytes - stats.NetOutput = netStats.RxBytes + stats.NetInput = netStats.RxBytes + stats.NetOutput = netStats.TxBytes } else { stats.NetInput = 0 stats.NetOutput = 0