On Tue, Apr 18, 2006 at 08:00:25AM +0200, Patrick McHardy ([EMAIL PROTECTED]) 
wrote:
> >>Again, bind() takes a bitmask of the groups to subscribe to, not the
> >>numerical value 5. To subscribe to group 5 using bind, you use 1<<(5-1)
> >>as nladdr, which is 0x10000. Check out the difference between
> >>RTMGRP_NOTIFY (backwards compatibility for bind()) and RTNLGRP_NOTIFY
> >>(used internally and for NETLINK_ADD_MEMBERSHIP).
> > 
> > 
> > I.e. bind nladdr is an optimisation for several calls of
> > NETLINK_ADD_MEMBERSHIP, as long as socket setup in netlink table?
> 
> No, its not an optimization, its there for backwards compatibility.
> Otherwise the cleanest solution would have been to remove group
> subscription from bind().
> 
> > And thus bind(5) is equal to subscribe(1); subscribe(3).
> 
> Yes, except that it will also unsubscribe from all other groups <= 32.
> 
> Easiest way to avoid problems is to first call bind() with a group mask
> of 0, then use setsockopt() to subscribe to groups.


Ok, this clarifies things a lot.
Thank you.

-- 
        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

Reply via email to