On Sun, Aug 07, 2005 at 01:12:19PM +0200, Thomas Graf ([EMAIL PROTECTED]) wrote: > * Evgeniy Polyakov <[EMAIL PROTECTED]> 2005-07-29 14:45 > > Subscription is a netlink socket option, which, if enabled, ends up > > in direct message delivering, but not multicast one. > > I don't get this, you introduce a new option which basically > changes the subscription schema from a bitmask to a single > identifier. I don't see any code which would prevent the > message delivery if the bitmask actually matches an identifier.
Since it is new option, it is supposed that callers/users know what it does, i.e. if one sets this, it already knows that groups will be concidered not as bitmask, but as group number. > > +static int netlink_is_bound(struct sock *sk, u32 pid) > > +{ > > + struct nl_pid_hash *hash = &nl_table[sk->sk_protocol].hash; > > + struct hlist_head *head; > > + struct sock *osk; > > + struct hlist_node *node; > > + int bound = 0; > > + > > + head = nl_pid_hashfn(hash, pid); > > + sk_for_each(osk, node, head) { > > + if (nlk_sk(osk)->pid == pid) { > > + bound = 1; > > + break; > > + } > > + } > > + > > + return bound; > > +} > > It's actually obvious but it might be worth to add a comment > to this funtion that at least a read lock on nl_table_lock > must be held. Yes, you are right, comments is also usefull if this fucntion will be used in other places, whe binding is checked. > - > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to [EMAIL PROTECTED] > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Evgeniy Polyakov - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html