]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
lib/socket: remove NL_SOCK_BUFSIZE_SET socket flag
authorThomas Haller <thaller@redhat.com>
Thu, 5 Mar 2015 07:46:31 +0000 (08:46 +0100)
committerThomas Haller <thaller@redhat.com>
Thu, 5 Mar 2015 10:25:20 +0000 (11:25 +0100)
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>
include/netlink-private/types.h
lib/nl.c
lib/socket.c

index 6d5cc7f97111b1c00320e287dd055f0891c47215..54f06b575799f653f5cf541330cf1772e39dbc33 100644 (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)
index 48588de54f6b5f33307be8727172f90113462646..bb11d2c7872dd34f4cd3cbb54ad480e6f644cf7d 100644 (file)
--- 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;
index 5db7f29d8ed471ecbc00fe4b112e6ab4cbe04e83..628a96de5c7dc7badc25b6aed5455eae6e6b422f 100644 (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;
 }