summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_network.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-05-20 02:24:42 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-05-20 02:24:42 +0200
commita78d75b04cfa553bd196f99a00a0e6347725793f (patch)
tree162bba818918f4fc59167566625b11c7c48ead7a /ospfd/ospf_network.c
parentEnsuring that all interfaces are served in a round robin fashion during (diff)
downloadfrr-a78d75b04cfa553bd196f99a00a0e6347725793f.tar.xz
frr-a78d75b04cfa553bd196f99a00a0e6347725793f.zip
Set the RCVBUF and SNDBUF sizes to the maximum possible amount to
handle traffic under duress. Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Ayan Banerjee <ayan@cumulusnetworks.com>
Diffstat (limited to 'ospfd/ospf_network.c')
-rw-r--r--ospfd/ospf_network.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c
index 900a5667d..2f167a50a 100644
--- a/ospfd/ospf_network.c
+++ b/ospfd/ospf_network.c
@@ -165,6 +165,9 @@ ospf_sock_init (void)
{
int ospf_sock;
int ret, hincl = 1;
+ int bufsize = (8 * 1024 * 1024);
+ int optval;
+ socklen_t optlen = sizeof(optval);
if ( ospfd_privs.change (ZPRIVS_RAISE) )
zlog_err ("ospf_sock_init: could not raise privs, %s",
@@ -223,6 +226,39 @@ ospf_sock_init (void)
zlog_err ("ospf_sock_init: could not lower privs, %s",
safe_strerror (errno) );
}
+
+ if ((ret = setsockopt (ospf_sock, SOL_SOCKET, SO_RCVBUF,
+ &bufsize, sizeof (bufsize))) < 0)
+ {
+ zlog_err ("Couldn't increase raw rbuf size: %s\n", safe_strerror(errno));
+ }
+
+ if ((ret = getsockopt (ospf_sock, SOL_SOCKET, SO_RCVBUF,
+ &optval, &optlen)) < 0)
+ {
+ zlog_err("getsockopt of SO_RCVBUF failed with error %s\n", safe_strerror(errno));
+ }
+ if (optval < bufsize)
+ {
+ zlog_err("Unable to SO_RCVBUF to %d, set to %d\n", bufsize, optval);
+ }
+
+
+ if ((ret = setsockopt (ospf_sock, SOL_SOCKET, SO_SNDBUF,
+ &bufsize, sizeof (bufsize))) < 0)
+ {
+ zlog_err ("Couldn't increase raw wbuf size: %s\n", safe_strerror(errno));
+ }
+
+ if ((ret = getsockopt (ospf_sock, SOL_SOCKET, SO_SNDBUF,
+ &optval, &optlen)) < 0)
+ {
+ zlog_err ("getsockopt of SO_SNDBUF failed with error %s\n", safe_strerror(errno));
+ }
+ if (optval < bufsize)
+ {
+ zlog_err ("Unable to SO_SNDBUF to %d, set to %d\n", bufsize, optval);
+ }
return ospf_sock;
}