Expand description
A module for managing Netlink multicast group memberships.
A Netlink socket can subscribe to any number of multicast groups, as defined
by the Netlink protocol family that the socket is connected to. There are
two modes of specifying the multicast group memberships. Mode 1 is referred
to as “legacy” throughout this module because it was replaced by mode 2,
referred to as “modern”, in Linux 2.6.14.
Mode 1: Specifying nl_groups, a 32 bit bitmask, when binding the
the socket.
Mode 2: Setting the NETLINK_ADD_MEMBERSHIP or
NETLINK_DROP_MEMBERSHIP socket option.
Note that both mode 1 and mode 2 are supported (for backwards compatibility), and the two modes operate over different sets of constants. The “modern” constants correspond to the index of the set-bit in their “legacy” counterpart. For example, consider this sample of NETLINK_ROUTE constants: RTNLGRP_LINK: legacy (1), modern (1), RTNLGRP_NOTIFY: legacy (2), modern (2), RTNLGRP_NEIGH: legacy (4), modern (3), RTNLGRP_TC: legacy (8), modern (4),
The [MulticastGroupMemberships] struct exposed by this module tracks the
memberships independently of the mode via which they are set. For example, a
NETLINK_ROUTE client could bind to RTMGRP_IPV6_IFADDR (256), to start
receiving IPv6 address events, and later set the NETLINK_DROP_MEMBERSHIP
socket option to RTNLGRP_IPV6_IFADDR (9), to stop receiving events.
Structs§
- Invalid
Legacy Groups Error - Error returned when attempting to join invalid
LegacyGroups. - Invalid
Modern Group Error - Error returned when attempting to join an invalid
ModernGroup. - Legacy
Groups - A set of legacy multicast groups. Interpreted as a bit mask, where each set bit corresponds to a different group membership.
- Modern
Group - A modern (non-legacy) multicast group. Interpreted as a single group.
- Multiple
Bits SetError - Error returned when attempting to convert a u32 into
SingleLegacyGroup. - NoMapping
From Modern ToLegacy Group Error - An error indicating that a modern group has no mapping to a legacy group.
- Single
Legacy Group - A single legacy multicast group membership. At most 1 bit is set.