From: Vincent Bernat Date: Sat, 14 Jan 2017 10:11:58 +0000 (+0100) Subject: netlink: make the values for buffer size configurable through ./configure X-Git-Tag: 0.9.6~3^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=568a0d7304e532b14a19e163daea65eb8231e0dd;p=thirdparty%2Flldpd.git netlink: make the values for buffer size configurable through ./configure --- diff --git a/NEWS b/NEWS index 55f41a71..f08c765b 100644 --- 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. diff --git a/configure.ac b/configure.ac index 532d0a8d..af48ed6e 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/m4/args.m4 b/m4/args.m4 index 8e286faf..4f29724c 100644 --- a/m4/args.m4 +++ b/m4/args.m4 @@ -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],[ diff --git a/src/daemon/netlink.c b/src/daemon/netlink.c index 1d8c3e95..5543066d 100644 --- a/src/daemon/netlink.c +++ b/src/daemon/netlink.c @@ -28,13 +28,6 @@ #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;