summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-08-09 23:04:17 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-08-09 23:04:17 +0000
commit4ad0571c604526a0bb64f7b2d6e62d9ac8366227 (patch)
treed6e52e23152cd510977ac1eedadba0d33c63d571 /usr.sbin
parent19b887359c4b05f1d1249927d8d894b26647c4ba (diff)
Scale both receive and send buffer on the raw socket. The default 8192
bytes is not enough for larger networks causing send errors because of too big packets. OK henning
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ospfd/interface.c15
-rw-r--r--usr.sbin/ospfd/ospfe.c4
-rw-r--r--usr.sbin/ospfd/ospfe.h4
3 files changed, 17 insertions, 6 deletions
diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c
index 5e212044d6b..32844a5ef8d 100644
--- a/usr.sbin/ospfd/interface.c
+++ b/usr.sbin/ospfd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.63 2009/06/05 04:12:52 claudio Exp $ */
+/* $OpenBSD: interface.c,v 1.64 2009/08/09 23:04:16 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -678,7 +678,7 @@ if_set_recvif(int fd, int enable)
}
void
-if_set_recvbuf(int fd)
+if_set_sockbuf(int fd)
{
int bsize;
@@ -686,6 +686,17 @@ if_set_recvbuf(int fd)
while (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bsize,
sizeof(bsize)) == -1)
bsize /= 2;
+
+ if (bsize != 65535)
+ log_warnx("if_set_sockbuf: recvbuf size only %d", bsize);
+
+ bsize = 65535;
+ while (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &bsize,
+ sizeof(bsize)) == -1)
+ bsize /= 2;
+
+ if (bsize != 65535)
+ log_warnx("if_set_sockbuf: sendbuf size only %d", bsize);
}
/*
diff --git a/usr.sbin/ospfd/ospfe.c b/usr.sbin/ospfd/ospfe.c
index 0a2f2bb2191..b7e38d87ffe 100644
--- a/usr.sbin/ospfd/ospfe.c
+++ b/usr.sbin/ospfd/ospfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.c,v 1.69 2009/06/06 07:31:26 eric Exp $ */
+/* $OpenBSD: ospfe.c,v 1.70 2009/08/09 23:04:16 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -104,7 +104,7 @@ ospfe(struct ospfd_conf *xconf, int pipe_parent2ospfe[2], int pipe_ospfe2rde[2],
fatal("if_set_ip_hdrincl");
if (if_set_recvif(xconf->ospf_socket, 1) == -1)
fatal("if_set_recvif");
- if_set_recvbuf(xconf->ospf_socket);
+ if_set_sockbuf(xconf->ospf_socket);
oeconf = xconf;
if (oeconf->flags & OSPFD_FLAG_NO_FIB_UPDATE)
diff --git a/usr.sbin/ospfd/ospfe.h b/usr.sbin/ospfd/ospfe.h
index d28fba4e2ef..f55de72e176 100644
--- a/usr.sbin/ospfd/ospfe.h
+++ b/usr.sbin/ospfd/ospfe.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.h,v 1.40 2009/06/06 07:31:26 eric Exp $ */
+/* $OpenBSD: ospfe.h,v 1.41 2009/08/09 23:04:16 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -151,7 +151,7 @@ int if_join_group(struct iface *, struct in_addr *);
int if_leave_group(struct iface *, struct in_addr *);
int if_set_mcast(struct iface *);
int if_set_recvif(int, int);
-void if_set_recvbuf(int);
+void if_set_sockbuf(int);
int if_set_mcast_loop(int);
int if_set_ip_hdrincl(int);