Page MenuHomeFreeBSD

netlink: refactor KPI for generict Netlink modules
AcceptedPublic

Authored by glebius on Tue, Feb 4, 8:00 PM.

Details

Reviewers
kp
melifaro
Group Reviewers
network
Summary

Now that the family and group are completely private to netlink_generic.c,
provide a simple and robust KPI, that would require very simple guarantees
from both KPI and the module:

  • Strings are used only for family and group registration, that return ID: uint16_t genl_register_family(const char *name, ... uint32_t genl_register_group(uint16_t family, const char *name, ...
  • Once created families and groups are guaranteed to not disappear and be addressable by their ID.
  • All subsequent calls, including deregistration shall use ID.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62255
Build 59139: arc lint + arc unit

Event Timeline

There's a typo in the title ('generict').

sys/netlink/netlink_generic.c
98

I'm not sure if there are real-world implications, but it feels a little icky to do this check after we've already used family_id to access the families array.

Given that it's an assert it's probably fine.

Should we also assert that family_id - GENL_MIN_ID >= 0?

This revision is now accepted and ready to land.Wed, Feb 5, 8:00 AM