All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [1/1] netlink: fix broadcasting to the wrong group.
Date: Tue, 18 Apr 2006 08:00:25 +0200	[thread overview]
Message-ID: <44448079.6030305@trash.net> (raw)
In-Reply-To: <20060418055351.GB833@2ka.mipt.ru>

Evgeniy Polyakov wrote:
> On Tue, Apr 18, 2006 at 07:36:52AM +0200, Patrick McHardy (kaber@trash.net) 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.

  reply	other threads:[~2006-04-18  6:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-17  9:36 [1/1] netlink: fix broadcasting to the wrong group Evgeniy Polyakov
2006-04-17 15:35 ` Patrick McHardy
2006-04-17 19:49   ` Evgeniy Polyakov
2006-04-17 20:14     ` Patrick McHardy
2006-04-17 20:21       ` Evgeniy Polyakov
2006-04-17 23:13         ` Patrick McHardy
2006-04-18  5:18           ` Evgeniy Polyakov
2006-04-18  5:36             ` Patrick McHardy
2006-04-18  5:53               ` Evgeniy Polyakov
2006-04-18  6:00                 ` Patrick McHardy [this message]
2006-04-18  6:09                   ` Evgeniy Polyakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44448079.6030305@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=johnpol@2ka.mipt.ru \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.