summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/kroute.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-03-23 11:30:22 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-03-23 11:30:22 +0000
commitc55f944b109603ae05ecdbf885400d9eb6a2b724 (patch)
treeff5d6f7504c176d2621f6e051c4011d58245eb15 /usr.sbin/ospfd/kroute.c
parentc52d4953d113d57255742d4946174fee3e2ccb5f (diff)
grow receive buffer on the routing socket, from bgpd
Diffstat (limited to 'usr.sbin/ospfd/kroute.c')
-rw-r--r--usr.sbin/ospfd/kroute.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/usr.sbin/ospfd/kroute.c b/usr.sbin/ospfd/kroute.c
index 7ed3c58d195..b5aa2939458 100644
--- a/usr.sbin/ospfd/kroute.c
+++ b/usr.sbin/ospfd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.7 2005/03/23 11:07:42 henning Exp $ */
+/* $OpenBSD: kroute.c,v 1.8 2005/03/23 11:30:21 henning Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -121,7 +121,8 @@ kif_init(void)
int
kr_init(int fs)
{
- int opt = 0;
+ int opt = 0, rcvbuf, default_rcvbuf;
+ socklen_t optlen;
kr_state.fib_sync = fs;
@@ -135,6 +136,19 @@ kr_init(int fs)
&opt, sizeof(opt)) == -1)
log_warn("kr_init: setsockopt"); /* not fatal */
+ /* grow receive buffer, don't wanna miss messages */
+ optlen = sizeof(default_rcvbuf);
+ if (getsockopt(kr_state.fd, SOL_SOCKET, SO_RCVBUF,
+ &default_rcvbuf, &optlen) == -1)
+ log_warn("kr_init getsockopt SOL_SOCKET SO_RCVBUF");
+ else
+ for (rcvbuf = MAX_RTSOCK_BUF;
+ rcvbuf > default_rcvbuf &&
+ setsockopt(kr_state.fd, SOL_SOCKET, SO_RCVBUF,
+ &rcvbuf, sizeof(rcvbuf)) == -1 && errno == ENOBUFS;
+ rcvbuf /= 2)
+ ; /* nothing */
+
kr_state.pid = getpid();
kr_state.rtseq = 1;