Pablo Neira Ayuso <pa...@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 <pa...@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);

Reply via email to