From: Thomas Haller Date: Thu, 5 Mar 2015 07:46:31 +0000 (+0100) Subject: lib/socket: remove NL_SOCK_BUFSIZE_SET socket flag X-Git-Tag: libnl3_2_26rc1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15824e42730980132a9e52d0c9d6929808e5ae78;p=thirdparty%2Flibnl.git 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 --- diff --git a/include/netlink-private/types.h b/include/netlink-private/types.h index 6d5cc7f..54f06b5 100644 --- a/include/netlink-private/types.h +++ b/include/netlink-private/types.h @@ -24,7 +24,6 @@ #include #include -#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) diff --git a/lib/nl.c b/lib/nl.c index 48588de..bb11d2c 100644 --- a/lib/nl.c +++ b/lib/nl.c @@ -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; diff --git a/lib/socket.c b/lib/socket.c index 5db7f29..628a96d 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -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; }