Subject: Re: [patch net-next v3 5/9] genetlink: implement release callback and free sk_user_data there

From: Jakub Kicinski <[email-masked]>
Date: Tue, 21 Nov 2023 09:55:12 -0800

On Tue, 21 Nov 2023 14:12:55 +0100 Jiri Pirko wrote:
> >How is this supposed to work?
> >
> >genetlink sockets are not bound to a family. User can use a single
> >socket to subscribe to notifications from all families and presumably
> >each one of the would interpret sk->sk_user_data as their own state?
> >
> >You need to store the state locally in the family, keyed
> >on pid, and free it using the NETLINK_URELEASE notifier...  
> 
> Well, pin can have 2 sockets of different config. I think that sk/family
> tuple is needed. I'm exploring a possibility to have genetlink
> sk->sk_user_data used to store the hashlist keyed by the sk/family tuple.

If you're doing it centrally, please put the state as a new field in
the netlink socket. sk_user_data is for the user.

Also let's start with a list, practically speaking using one socket 
in many families should be very rare.