little-dude / netlink

netlink libraries for rust
Other
332 stars 89 forks source link

Fix ip_monitor example #290

Closed WGH- closed 1 year ago

WGH- commented 1 year ago

List of groups that's specified in nlgroup field of the address is actually a bitfield, whereas `RTNLGRP*` constants are 1, 2, 3, etc, so they must be shifted before using them in nl_group.

See iproute2 source for example[1][2].

[1] https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/ip/ipmonitor.c?id=deb485541f34cc77e5228ab6ba6e1af58014727b#n198 [2] https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/include/utils.h?id=deb485541f34cc77e5228ab6ba6e1af58014727b#n230

frederictobiasc commented 1 year ago

Hello @WGH- ! I have just stumbled across the same issue and hope your PR will get merged soon. Thanks for the fix!