ipstats_show_hw_stats() returns as soon as IFLA_OFFLOAD_XSTATS_HW_S_INFO
is absent, dropping the counters that the message does carry.
__ipstats_show_hw_stats() already copes with a NULL info attribute, so
let it, and skip the record only when neither attribute is present.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Alexander Zubkov <redacted>
---
v2:
- Trimmed the commit message.
ip/ipstats.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ip/ipstats.c b/ip/ipstats.c
index f7a5619f..4edfcebe 100644
--- a/ip/ipstats.c
+++ b/ip/ipstats.c
@@ -472,13 +472,16 @@ static int ipstats_show_hw_stats(struct ipstats_stat_show_attrs *attrs,
int err = 0;
at_hwsi = ipstats_stat_show_get_attr(attrs, group, hw_s_info, &err);
- if (at_hwsi == NULL)
+ if (at_hwsi == NULL && err != 0)
return err;
at_stats = ipstats_stat_show_get_attr(attrs, group, hw_stats, &err);
if (at_stats == NULL && err != 0)
return err;
+ if (at_hwsi == NULL && at_stats == NULL)
+ return 0;
+
return __ipstats_show_hw_stats(at_hwsi, at_stats, idx);
}
--
2.55.0