]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
netlink: make the values for buffer size configurable through ./configure
authorVincent Bernat <vincent@bernat.im>
Sat, 14 Jan 2017 10:11:58 +0000 (11:11 +0100)
committerVincent Bernat <vincent@bernat.im>
Sat, 14 Jan 2017 10:12:18 +0000 (11:12 +0100)
NEWS
configure.ac
m4/args.m4
src/daemon/netlink.c

diff --git a/NEWS b/NEWS
index 55f41a71dd04cd5f3858d4741b29a1065bafaad9..f08c765bd91f3200e67283e0b0f37e572c2f39f4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ lldpd (0.9.6)
     + Support for newer ethtool interface on Linux
       (ETHTOOL_GLINKSETTINGS) and additional speed settings.
     + Current MAU type is displayed even when autoneg is off.
+    + Increase netlink receive buffer by default. Can be changed at
+      compile-time through ./configure.
   * Fix:
     + Correctly parse LLDP-MED civic address when the length of the
       TLV exceeds the length of the address.
index 532d0a8d9e297a5309783f13fed8ec1548d5c4a9..af48ed6e60b2aaa84a33675719edae507e00f3f3 100644 (file)
@@ -347,6 +347,10 @@ lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [${run
 lldp_ARG_WITH([lldpd-ctl-socket], [Path to socket for communication with lldpd], [${runstatedir}/lldpd.socket])
 lldp_ARG_WITH([lldpd-pid-file], [Path to lldpd PID file], [${runstatedir}/lldpd.pid])
 
+# Netlink
+lldp_ARG_WITH_UNQUOTED([netlink-receive-bufsize], [Netlink receive buffer size], [256*1024])
+lldp_ARG_WITH_UNQUOTED([netlink-send-bufsize], [Netlink send buffer size], [0])
+
 # CDP/FDP/EDP/SONMP
 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
index 8e286faff1f2c45d25783a05f4d81c07969c3db7..4f29724c0a2a9ffb87c5704a3bbe35f9586b67a0 100644 (file)
@@ -36,6 +36,19 @@ AC_DEFUN([lldp_AC_EXPAND], [
   exec_prefix=$exec_prefix_save
 ])
 
+dnl lldp_ARG_WITH_UNQUOTED(name, help1, default)
+
+AC_DEFUN([lldp_ARG_WITH_UNQUOTED],[
+  AC_ARG_WITH([$1],
+       AS_HELP_STRING([--with-$1],
+               [$2 @<:@default=$3@:>@]),[
+        AC_DEFINE_UNQUOTED(AS_TR_CPP([$1]), [$withval], [$2])
+        AC_SUBST(AS_TR_CPP([$1]), [$withval])],[
+       AC_DEFINE_UNQUOTED(AS_TR_CPP([$1]), [$3], [$2])
+        AC_SUBST(AS_TR_CPP([$1]), [$3])
+        eval with_[]m4_translit([$1], [-+.], [___])=$3
+])])
+
 dnl lldp_ARG_WITH(name, help1, default)
 
 AC_DEFUN([lldp_ARG_WITH],[
index 1d8c3e951e23ed1101ff0b1186880d12259723d2..5543066dadc397e32fec242202c2642c808d9b90 100644 (file)
 
 #define NETLINK_BUFFER 4096
 
-#ifndef RTNL_SND_BUFSIZE
-#define RTNL_SND_BUFSIZE       32 * 1024
-#endif
-#ifndef RTNL_RCV_BUFSIZE
-#define RTNL_RCV_BUFSIZE       256 * 1024
-#endif
-
 struct netlink_req {
        struct nlmsghdr hdr;
        struct rtgenmsg gen;
@@ -51,8 +44,8 @@ struct lldpd_netlink {
 static int
 netlink_socket_set_buffer_sizes(int s)
 {
-       int sndbuf = RTNL_SND_BUFSIZE;
-       int rcvbuf = RTNL_RCV_BUFSIZE;
+       int sndbuf = NETLINK_SEND_BUFSIZE;
+       int rcvbuf = NETLINK_RECEIVE_BUFSIZE;
        socklen_t size = 0;
        int got = 0;