Re: [systemd-devel] Filter/Parse NETLINK_KOBJECT_UEVENT Messages

2021-09-14 Thread Ryan McClue
Sorry, I should clarify. The code in sd-device related to BPF I don't understand. What is the 'input' in BPF? Sent from ProtonMail mobile Original Message On 14 Sep. 2021, 5:24 pm, Lennart Poettering wrote: > On Di, 14.09.21 01:08, Ryan McClue (re.mcc...@protonmail.com)

Re: [systemd-devel] Filter/Parse NETLINK_KOBJECT_UEVENT Messages

2021-09-14 Thread Ryan McClue
Earlier you said that .nl_groups = 2 will get kernel uevents augmented by udev. So, at some stage doesn't udev have to parse the raw kernel uevents, i.e. .nl_groups = 1? How does it do this? Does it use BPF to achieve this or the string parsing? -- Ryan McClue, Sydney ‐‐‐ Original Message

Re: [systemd-devel] Filter/Parse NETLINK_KOBJECT_UEVENT Messages

2021-09-14 Thread Lennart Poettering
On Di, 14.09.21 01:08, Ryan McClue (re.mcc...@protonmail.com) wrote: > I understand this is slightly off-topic, but I'm completely new to > BPF. Analyzing libudev source and Internet I understand the general > idea. However, I don't understand how information/what information > is passed to the

Re: [systemd-devel] Filter/Parse NETLINK_KOBJECT_UEVENT Messages

2021-09-13 Thread Mantas Mikulėnas
On Tue, Sep 14, 2021 at 4:08 AM Ryan McClue wrote: > I understand this is slightly off-topic, but I'm completely new to BPF. > Analyzing libudev source and Internet I understand the general idea. > However, I don't understand how information/what information is passed to > the filter from the

Re: [systemd-devel] Filter/Parse NETLINK_KOBJECT_UEVENT Messages

2021-09-13 Thread Ryan McClue
I understand this is slightly off-topic, but I'm completely new to BPF. Analyzing libudev source and Internet I understand the general idea. However, I don't understand how information/what information is passed to the filter from the socket. For example, in my case the socket payload, i.e.

Re: [systemd-devel] Filter/Parse NETLINK_KOBJECT_UEVENT Messages

2021-09-13 Thread Mantas Mikulėnas
(Added list back again) On Mon, Sep 13, 2021 at 1:55 PM Ryan McClue wrote: > Thank you for the response Mantas. > If I change the nl_groups to 2, it prints libudev a handle of times and I > then get a segfault. > In regards to this picking up all devices: if I add/remove my Bose > speakers

Re: [systemd-devel] Filter/Parse NETLINK_KOBJECT_UEVENT Messages

2021-09-13 Thread Lennart Poettering
On Mo, 13.09.21 09:29, Ryan McClue (re.mcc...@protonmail.com) wrote: > Currently, I'm listening to NETLINK_KOBJECT_UEVENT messages with the > following code: Don't. Use the sd-device API from C. Or the old libudev API. Listening to uevents directly means you either only get the kernel's own

Re: [systemd-devel] Filter/Parse NETLINK_KOBJECT_UEVENT Messages

2021-09-13 Thread Mantas Mikulėnas
On Mon, Sep 13, 2021 at 12:29 PM Ryan McClue wrote: > Currently, I'm listening to NETLINK_KOBJECT_UEVENT messages with the > following code: > > union UeventBuffer { > struct nlmsghdr netlink_header; > char raw[8192]; > }; > int sock = socket(PF_NETLINK, SOCK_RAW | SOCK_NONBLOCK, >