]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
netlink: by default, don't change netlink buffer size
authorVincent Bernat <vincent@bernat.im>
Sat, 14 Jan 2017 10:51:58 +0000 (11:51 +0100)
committerVincent Bernat <vincent@bernat.im>
Sat, 14 Jan 2017 11:00:31 +0000 (12:00 +0100)
We can't really guess what the current maximum is. On my system, the
default max is quite low (~200k). We don't want everybody to get a
warning. Also, only warn people if we got a smaller size that we
requested.

configure.ac
src/daemon/netlink.c

index b871f94b092ebe33264e48af3a742419074bc607..2e81f5b58cc86dc1bdf84ee73ed8107a724722a8 100644 (file)
@@ -348,8 +348,8 @@ lldp_ARG_WITH([lldpd-ctl-socket], [Path to socket for communication with lldpd],
 lldp_ARG_WITH([lldpd-pid-file], [Path to lldpd PID file], [${runstatedir}/lldpd.pid])
 
 # Netlink
-lldp_ARG_WITH_UNQUOTED([netlink-max-receive-bufsize], [Netlink maximum receive buffer size], [4*1024*1024])
-lldp_ARG_WITH_UNQUOTED([netlink-receive-bufsize], [Netlink initial receive buffer size], [256*1024])
+lldp_ARG_WITH_UNQUOTED([netlink-max-receive-bufsize], [Netlink maximum receive buffer size], [1024*1024])
+lldp_ARG_WITH_UNQUOTED([netlink-receive-bufsize], [Netlink initial receive buffer size], [0])
 lldp_ARG_WITH_UNQUOTED([netlink-send-bufsize], [Netlink send buffer size], [0])
 
 # CDP/FDP/EDP/SONMP
index 7d7814e6a4f408bbff506f3754b13064fdaabe59..ba726a4dde1f3074fcd68a6f9117a71e77fe28c5 100644 (file)
@@ -67,7 +67,7 @@ netlink_socket_set_buffer_sizes(int s, int sndbuf, int rcvbuf)
                if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, &got, &size) < 0) {
                        log_warn("netlink", "unable to get SO_SNDBUF");
                } else {
-                       if (got != sndbuf)
+                       if (got < sndbuf)
                                log_warnx("netlink", "tried to set SO_SNDBUF to '%d' "
                                    "but got '%d'", sndbuf, got);
                }
@@ -77,7 +77,7 @@ netlink_socket_set_buffer_sizes(int s, int sndbuf, int rcvbuf)
                if (getsockopt(s, SOL_SOCKET, SO_RCVBUF, &got, &size) < 0) {
                        log_warn("netlink", "unable to get SO_RCVBUF");
                } else {
-                       if (got != rcvbuf)
+                       if (got < rcvbuf)
                                log_warnx("netlink", "tried to set SO_RCVBUF to '%d' "
                                    "but got '%d'", rcvbuf, got);
                }
@@ -113,8 +113,8 @@ netlink_socket_double_buffer_sizes(int s, int max)
                        log_warn("netlink", "unable to get SO_RCVBUF");
                        return -1;
                }
-               if (got != current) {
-                       log_warn("netlink", "tried to set SO_RCVBUF to '%d' "
+               if (got < current) {
+                       log_warnx("netlink", "tried to set SO_RCVBUF to '%d' "
                            "but got '%d'", current, got);
                        return 1; /* Assume we got the maximum */
                }