netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Patrick McHardy <kaber@trash.net>
Cc: netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH] netlink: add NETLINK_BROADCAST_REPORT_ERROR socket option
Date: Mon, 16 Feb 2009 15:10:36 +0100	[thread overview]
Message-ID: <499973DC.3000208@netfilter.org> (raw)
In-Reply-To: <49994A70.5000502@trash.net>

Patrick McHardy wrote:
> Pablo Neira Ayuso wrote:
>> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
>> index 6ee69c2..29dd4fb 100644
>> --- a/net/netlink/af_netlink.c
>> +++ b/net/netlink/af_netlink.c
>> @@ -85,6 +85,7 @@ struct netlink_sock {
>>  
>>  #define NETLINK_KERNEL_SOCKET    0x1
>>  #define NETLINK_RECV_PKTINFO    0x2
>> +#define NETLINK_BROADCAST_SEND_REPORT_ERROR    0x4
> 
> The name seems to imply send twice (send/report).

Indeed. I didn't like this initial name a lot.

>>  static inline struct netlink_sock *nlk_sk(struct sock *sk)
>>  {
>> @@ -994,13 +995,15 @@ static inline int do_one_broadcast(struct sock *sk,
>>      if (p->skb2 == NULL) {
>>          netlink_overrun(sk);
>>          /* Clone failed. Notify ALL listeners. */
>> -        p->failure = 1;
>> +        if (nlk->flags & NETLINK_BROADCAST_SEND_REPORT_ERROR)
>> +            p->failure = 1;
> 
> This doesn't make sense. *Other* sockets get skipped only iff
> this socket had the error-report flag set? This should be done
> in a consistent manner, which means either not set the failure
> flag at all and retry for all sockets, or set it for any failed
> socket delivery and determine the return value based on whether
> one of the skipped sockets had the error-report flag set.

I can add a check for the flag to allow sockets without the flag set to 
try to send the message:

         if ((nlk->flags & NETLINK_BROADCAST_SEND_ERROR) && p->failure) {
                 netlink_overrun(sk);
                 goto out;
         }

Still, this "skip" behaviour looks to me strange. I don't see why a 
socket should skip if other socket's clone failed. Wouldn't it be better 
to remove this?

-- 
"Los honestos son inadaptados sociales" -- Les Luthiers

  reply	other threads:[~2009-02-16 14:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-16 10:52 [PATCH] netlink: add NETLINK_BROADCAST_REPORT_ERROR socket option Pablo Neira Ayuso
2009-02-16 11:13 ` Patrick McHardy
2009-02-16 14:10   ` Pablo Neira Ayuso [this message]
2009-02-16 14:06     ` Patrick McHardy

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=499973DC.3000208@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=kaber@trash.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).