Kernel thread and netlink

Gareth Williams gareth at trinitydigital.co.uk
Mon Nov 12 06:10:36 EST 2012


Thanks for getting back to me on this.

I need to clarify what I mean by "bridge changes": I mean bridge forwarding entry (table) changes.

My application needs to monitor these changes while processing packets quickly (hence in the kernel).

Bridge table events are sent over its netlink socket but it looks like I cannot create a kernel thread netlink socket to monitor them.

I am left with either bouncing this information from a user space app or implementing a new notifier mechanism for bridge table entries..

So, just to be sure on this, it is not possible for a kernel thread to create a netlink socket that can connect to a kernel netlink socket?

Best regards
Mr. Gareth Williams
Trinity Digital



-----Original Message-----
From: Thomas Graf [mailto:tgr at infradead.org] On Behalf Of Thomas Graf
Sent: 12 November 2012 11:01
To: Gareth Williams
Cc: libnl at lists.infradead.org
Subject: Re: Kernel thread and netlink

On 11/12/12 at 10:22am, Gareth Williams wrote:
> Hello.
>
> New to list and new to netlink, sorry if this has been answered before.
>
> Do all kernel netlink sockets have to use a 0 identifier?  What about threaded kernel modules?
>
> I was hoping that a kernel thread could create a netlink socket and connect to the kernel bridge netlink socket and monitor bridge changes?
>
> But if they all use the same pid (0) then bridge messages will not be sent to the kernel thread socket as it will have the same pid?

Right. The kernel uses its own internal notification mechanism called netdevice notifier. See call_netdevice_notifiers() in net/core/dev.c



More information about the libnl mailing list