From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] mnl: do not cache sender buffer size
Date: Fri, 20 Sep 2019 18:11:52 +0200 [thread overview]
Message-ID: <20190920161152.GU6961@breakpoint.cc> (raw)
In-Reply-To: <20190920153154.26734-1-pablo@netfilter.org>
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> SO_SNDBUF never fails, this socket option just provides a hint to the
> kernel. SO_SNDBUFFORCE sets the buffer size to zero if the value goes
> over INT_MAX. Userspace is caching the buffer hint that sends to the
> kernel, so it might leave userspace out of sync if the kernel ignores
> the hint. Do not make assumptions, fetch the sender buffer size from the
> kernel via getsockopt().
>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> src/mnl.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/src/mnl.c b/src/mnl.c
> index 57ff89f50e23..19631e33dc9d 100644
> --- a/src/mnl.c
> +++ b/src/mnl.c
> @@ -218,24 +218,24 @@ void mnl_err_list_free(struct mnl_err *err)
> xfree(err);
> }
>
> -static int nlbuffsiz;
> -
> static void mnl_set_sndbuffer(const struct mnl_socket *nl,
> struct nftnl_batch *batch)
> {
> + int sndnlbuffsiz = 0;
> int newbuffsiz;
> + socklen_t len;
IIRC this needs to be
len = sizeof(sndnlbuffsiz);
prev parent reply other threads:[~2019-09-20 16:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-20 15:31 [PATCH nft] mnl: do not cache sender buffer size Pablo Neira Ayuso
2019-09-20 16:11 ` Florian Westphal [this message]
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=20190920161152.GU6961@breakpoint.cc \
--to=fw@strlen.de \
--cc=netfilter-devel@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.