From 48292d82efbdb3236b540f876df55ae779a3511d Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 14 Jan 2017 11:51:58 +0100 Subject: [PATCH] netlink: by default, don't change netlink buffer size 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 | 4 ++-- src/daemon/netlink.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index b871f94b..2e81f5b5 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/daemon/netlink.c b/src/daemon/netlink.c index 7d7814e6..ba726a4d 100644 --- a/src/daemon/netlink.c +++ b/src/daemon/netlink.c @@ -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 */ } -- 2.39.5