Skip to content

Add emit/parsing round-trip test cases and fix bugs found by them - #39

Merged
cathay4t merged 7 commits into
rust-netlink:mainfrom
cathay4t:main
Oct 12, 2026
Merged

cathay4t merged 7 commits into
rust-netlink:mainfrom
cathay4t:main

Conversation

@cathay4t

Copy link
Copy Markdown
Member

No description provided.

Add public `EthtoolBit`, `EthtoolBitset` and `EthtoolBitsetValue` types
to model ethtool bitsets: the verbose form (list of bits with names) and
the compact form (value/mask words), with byte exact emitting support.

Signed-off-by: Gris Ge <cnfourt@gmail.com>
Replace `EthtoolFeatureBit` with the new `EthtoolBitset` type. Feature
bitset parsing now supports the compact form
(`ETHTOOL_FLAG_COMPACT_BITSETS`) used by `ethtool -k`, keeps index 0,
name-less bits and the `ETHTOOL_A_BITSET_SIZE`/`ETHTOOL_A_BITSET_NOMASK`
attributes, and parsed bitsets are emitted instead of panicking with
`todo!()`.

Signed-off-by: Gris Ge <cnfourt@gmail.com>
`EthtoolLinkModeAttr::Ours`/`Peer` now carry `EthtoolBitset` and are
emitted with the `NLA_F_NESTED` flag like the kernel does.

Signed-off-by: Gris Ge <cnfourt@gmail.com>
`EthtoolTsInfoAttr` timestamping, tx types and rx filters bitsets now
carry `EthtoolBitset` and are emitted with the `NLA_F_NESTED` flag like
the kernel does.

Signed-off-by: Gris Ge <cnfourt@gmail.com>
`EthtoolFecAttr::Modes` now carries `EthtoolBitset`; modes and stats are
emitted with the `NLA_F_NESTED` flag. `EthtoolFecStat` values became
`Vec<u64>` to keep total and per lane counters, and the empty
`ETHTOOL_A_FEC_STAT_CORR_BITS` case no longer fails to parse.

The obsolete `bitset_util` helpers are removed.

Signed-off-by: Gris Ge <cnfourt@gmail.com>
`EthtoolPauseStatAttr::Tx` was emitted with the RX attribute id.

Signed-off-by: Gris Ge <cnfourt@gmail.com>
Use nlmon captured kernel packets from virtio-net, veth and netdevsim
to test features, link modes, tsinfo, rings, channels, coalesce, pause
and FEC parsing. Every test parses the kernel reply, asserts the
expected attributes and verifies byte exact emitting, following the
workflow of netlink-packet-route's tests.

The tests live in `src/tests` as unit tests, gated to little-endian
hosts because the captured inlined data is little-endian.

Signed-off-by: Gris Ge <cnfourt@gmail.com>
@cathay4t cathay4t changed the title Enable emit/parsing round-trip test cases and fix bugs found by them Add emit/parsing round-trip test cases and fix bugs found by them Oct 12, 2026
@cathay4t
cathay4t merged commit f8d34b9 into rust-netlink:main Oct 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant