Skip to content

Releases: one-d-wide/netlink-bindings

Release v0.3.0

12 Mar 16:00

Choose a tag to compare

Hightlights

  • All upstream specifications are now supported 🚀
  • Multicast notifications are implemented, see the examples.
  • Struct API is simplified using native structs.
  • Spelling of operation types is simplified, see Migration.
  • Attribute sets are reused between operations, improving fresh compile time up to 70%.

Migration

  • For structs, Push prefix is dropped. Accessing native-endian fields: st.get_field() -> st.field. For explicit-endian fields .get_field() and .set_field() proxies are still available.
  • Redundant "request" suffix is dropped: .op_*_{do,dump}_request() -> .op_*_{do,dump}(), same for Op*Request -> Op*.
  • Operation types are now don't have attribute access methods themselves, which was previously gated behind transparent: true. If you was previously using them: PushOpNewruleDoRequest (operation type itself) -> PushRuleAttrs (its respective attribute type).
  • PROTOCOL name constant is now of type &str, with its &Cstr alias renamed to PROTOCOL_CSTR.

Tools

  • Added ./scripts/collect_subsystems.sh to automatically update the lists of subsystems.
  • Added CONTRIBUTING.md containing documentation for the repo itself.

Release v0.2.4

11 Feb 15:57

Choose a tag to compare

New netlink subsystems

  • inet-diag, unix-diag - socket diagnostics.

New examples

  • tc-prio - add, show, and delete traffic control queueing discipline.
  • tcp-rtt - dump socket information, including RTT of a TCP socket.

New codegen options

  • operations[].no_ack: true - operation doesn't support ack on success. This option only affects chained requests.
  • definitions[].shrinkable: true - C struct is padded with zeros or truncated when needed, e.g. the struct was expanded between the kernel versions. The default behavior is to return a decoding error.
  • operations[].{do,dump}.{request,reply}.attribute-set: <attrset> - attribute-set can be specific to request/response, needed for certain netlink-raw families.
  • operations[].rust-filter - Rust closure to differentiate between netlink-raw operations when value isn't enough. Only used in reverse-lookup. The closure is of type fn(&[u8]) -> bool, it checks message payload, which usually starts with subsystem-specific header struct.
  • operations[].rust-filter-{request,reply} - Same, but applied only for requests and replies respectively.
  • definitions[].attributes[].display-hint: <type>[] - display as a C-like array, useful when it may encode data beyond a single type.
  • definitions[].attributes[].display-hint: string - display bytes a raw string.
  • definitions[].members.type: cbitfield - a new type to support C bitfields. Needs sub-type: {u8,u16,u32} and bits: <n>.

New experimental options

  • experimental.struct-type: {buf,cstruct} - how to represent a struct: an opaque wrapper on [u8; n] buffer or a repr(C) struct.
  • experimental.struct-prefix: false - disable "Push" prefix for structs.
  • experimental.struct-explicit-padding: true - always add padding fields, even if it would otherwise be silently inserted due to alignment.
  • experimental.attr-binary-write: true - generate .write_*() -> impl Write methods for attributes of binary type.

Bug fixes

  • Header length wasn't reliably updated for sub commands, mostly affecting tc subsystem.
  • Struct size wasn't calculated correctly in nested struct.
  • A parsing error was mistakenly returned if last nested attribute wasn't known to the spec.

Changes in tooling

  • ./scripts/regenerate.sh now accepts subsystem filters, and doesn't re-generate when nothing changed.

If you interested in the development of this project, also check out the RFC on improving struct representation.

Release v0.2.3

19 Nov 14:54

Choose a tag to compare

New netlink families

  • nl80211 (with examples)
  • netdev
  • devlink

Fixes

  • Make NetlinkReplyChain spawn-compatible (implement Send trait).
  • Correct attribute indexing in subset-of attrsets.
  • Annotate enum/flags inside indexed-array when Debug-printing.

Other changes

  • New codegen options: transparent, fallback-attrs. See the description.
  • Interface dumps are only generated for small specifications.