lib/socket: remove NL_SOCK_BUFSIZE_SET socket flag

The flag was not actually used.

NL_SOCK_BUFSIZE_SET was only set by nl_socket_set_buffer_size().
Note that you can only call nl_socket_set_buffer_size() on a socket that
is already connected via nl_connect().

On first call, nl_connect() would always see NL_SOCK_BUFSIZE_SET unset, and
call nl_socket_set_buffer_size().

Since the flag was never unset, when trying to connect a socket a second
time, we would not set the buffer size again. Which was a bug.

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2015-03-05 08:46:31 +01:00
parent 364ab3daf6
commit 15824e4273
3 changed files with 3 additions and 8 deletions

View file

@ -24,7 +24,6 @@
#include <linux/tc_act/tc_mirred.h>
#include <linux/tc_act/tc_skbedit.h>
#define NL_SOCK_BUFSIZE_SET (1<<0)
#define NL_SOCK_PASSCRED (1<<1)
#define NL_OWN_PORT (1<<2)
#define NL_MSG_PEEK (1<<3)

View file

@ -116,11 +116,9 @@ int nl_connect(struct nl_sock *sk, int protocol)
goto errout;
}
if (!(sk->s_flags & NL_SOCK_BUFSIZE_SET)) {
err = nl_socket_set_buffer_size(sk, 0, 0);
if (err < 0)
goto errout;
}
err = nl_socket_set_buffer_size(sk, 0, 0);
if (err < 0)
goto errout;
if (_nl_socket_is_local_port_unspecified (sk)) {
uint32_t port;

View file

@ -715,8 +715,6 @@ int nl_socket_set_buffer_size(struct nl_sock *sk, int rxbuf, int txbuf)
return -nl_syserr2nlerr(errno);
}
sk->s_flags |= NL_SOCK_BUFSIZE_SET;
return 0;
}