[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <499AC746.5070403@trash.net>
Date: Tue, 17 Feb 2009 15:18:46 +0100
From: Patrick McHardy <kaber@...sh.net>
To: Pablo Neira Ayuso <pablo@...filter.org>
CC: netdev@...r.kernel.org, davem@...emloft.net
Subject: Re: [PATCH] netlink: add NETLINK_BROADCAST_ERROR socket option
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;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists