All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH] netlink: add NETLINK_BROADCAST_ERROR socket option
Date: Tue, 17 Feb 2009 15:18:46 +0100	[thread overview]
Message-ID: <499AC746.5070403@trash.net> (raw)
In-Reply-To: <20090217135602.25864.20453.stgit@Decadence>

Pablo Neira Ayuso wrote:
> @@ -973,7 +974,7 @@ static inline int do_one_broadcast(struct sock *sk,
>  	if (!net_eq(sock_net(sk), p->net))
>  		goto out;
>  
> -	if (p->failure) {
> +	if ((nlk->flags & NETLINK_BROADCAST_SEND_ERROR) && p->failure) {
>  		netlink_overrun(sk);
>  		goto out;
>  	}
 >
> @@ -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_ERROR)
> +			p->failure = 1;

Almost :) If we didn't manage to clone, we can't deliver to *any*
socket, so the check in the first chunk above is incorrect. It
needs to always call netlink_overrun(), additionally it needs to
set delivery_failure when the SEND_ERROR flag is present.

Something like this:

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

>  	} else if (sk_filter(sk, p->skb2)) {
>  		kfree_skb(p->skb2);
>  		p->skb2 = NULL;
>  	} else if ((val = netlink_broadcast_deliver(sk, p->skb2)) < 0) {
>  		netlink_overrun(sk);
> -		p->delivery_failure = 1;
> +		if (nlk->flags & NETLINK_BROADCAST_SEND_ERROR)
> +			p->delivery_failure = 1;
>  	} else {
>  		p->congested |= val;
>  		p->delivered = 1;


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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-17 13:56 [PATCH] netlink: add NETLINK_BROADCAST_ERROR socket option Pablo Neira Ayuso
2009-02-17 14:18 ` Patrick McHardy [this message]
2009-02-17 15:45   ` Pablo Neira Ayuso
2009-02-17 15:52     ` Patrick McHardy
  -- strict thread matches above, loose matches on Subject: below --
2009-02-18 11:40 Pablo Neira Ayuso
2009-02-18 11:43 ` Patrick McHardy
2009-02-20  9:01   ` David Miller

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=499AC746.5070403@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.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.