Thread (14 messages) flat view 14 messages, 4 authors, 15d ago
COLD15d

Revision v2 of 3 in this series.

Revisions (3)
  1. v1 [diff vs current]
  2. v2 current
  3. v3 [diff vs current]

[PATCH iproute2 v2 0/2] ip: ipstats: Fix statistics split across netlink messages

From: Alexander Zubkov <hidden>
Date: 2026-09-08 18:19:14

The kernel can split the statistics of one interface across several
netlink messages, and "ip stats" formats each of them on its own, so the
interface is shown twice and part of its statistics is lost. Easy to hit
with "group offload subgroup l3_stats" on a box with many netdevices:

    109: vlan859: group offload subgroup l3_stats on used on

    109: vlan859: group offload subgroup l3_stats

Patch 1 merges such messages before formatting them, patch 2 is an
unrelated cleanup.

What the merge rests on, for whoever touches it next:

 - Only the last attribute of one message and the first of the next can
   be two halves of one nest.

 - A leaf is emitted in one piece, so a leaf attribute seen in both
   messages is a layout the kernel does not produce, and the merge is
   refused.

 - An array is only ever split between two of its elements. Were an
   element itself split, the result would not be distinguishable from a
   longer array of shorter elements, and no reader could reassemble it.

 - At the outer level ipstats_stat_ifla_max[] tells which attributes are
   nests. One level in there is no such table, and none is needed: the
   children of the two halves are whole either way, whether they are an
   array, split only between elements, or attributes indexed by type, of
   which there is at most one of each. Appending them is then what the
   kernel would have sent unsplit.

 - Where the merge does not apply, the two messages are formatted
   separately, which is the behaviour this patch set replaces rather
   than a new failure mode.

v2:
 - Comments and commit messages trimmed, the merge reworked around the
   two border attributes that can actually be halves of one nest.

Alexander Zubkov (2):
  ip: ipstats: Merge statistics split across several netlink messages
  ip: ipstats: Do not hide HW statistics when hw_stats_info is missing

 ip/ipstats.c | 266 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 258 insertions(+), 8 deletions(-)

-- 
2.55.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help