[systemd-devel] The enum udev_monitor_netlink_group contains bit masks

Kay Sievers kay at vrfy.org
Tue Mar 12 17:33:53 PDT 2013


On Tue, Mar 12, 2013 at 9:35 PM, Andrey Wagin <avagin at gmail.com> wrote:
> According to netlink(7) nl_groups is a bit mask with every bit representing
> a netlink group number.

Netlink uses "numbers" not "a mask" since many years, we have just a
32bit number, not 32 groups today. The man page should really be
updated:
  http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d629b836d151d43332492651dd841d32e57ebe3b

There might be magic for group 1-32, which is still in place, but
there is generally no mask anymore for netlink groups.

> I found that constants from udev_monitor_netlink_group are set directly to
> nl_groups. It's dangerous. Currently this enum contains only three constant
> and all is ok, but the next constant will be incorrect.

There will probably never be another netlink group inside libudev. If
we ever change that low-level stuff here, we would move entirely to a
kernel dbus facility, and not (mis-)use netlink anymore.

> I created a patch, but I have not tested it. It's just idea. Sorry, I would
> have prefered to avoid investigation of how to execute my system with custom
> systemd. So if someone wants to fix this issue, you are welcome.

Just build systemd locally, and run
  ./udevadm monitor
locally, it will receive messages from the kernel and from the already
running and unchanged udevd. Just plub/unplug any device.

If the output is the same in the local build and the one from the
system, all is fine, you can check with strace to verify the details
too.

Kay


More information about the systemd-devel mailing list