summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ospfd/ChangeLog7
-rw-r--r--ospfd/ospf_network.c12
-rw-r--r--ospfd/ospfd.c7
-rw-r--r--ospfd/ospfd.h3
4 files changed, 18 insertions, 11 deletions
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog
index feba89a3..ce765162 100644
--- a/ospfd/ChangeLog
+++ b/ospfd/ChangeLog
@@ -1,3 +1,10 @@
+2007-09-18 Denis Ovsienko
+
+ * ospf_network.c: (ospf_adjust_sndbuflen) Don't complain
+ about getting more buffer space, than requested.
+ * ospfd.[ch]: (ospf_new) Abandon OSPF_SNDBUFLEN_DEFAULT
+ and consider OS's initial buffer size instead.
+
2007-08-21 Denis Ovsienko
* ospfd.h: Extend struct ospf with maxsndbuflen field and
diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c
index 11155dbc..d5bf7493 100644
--- a/ospfd/ospf_network.c
+++ b/ospfd/ospf_network.c
@@ -249,15 +249,15 @@ ospf_adjust_sndbuflen (struct ospf * ospf, int buflen)
zlog_err ("%s: could not raise privs, %s", __func__,
safe_strerror (errno));
/* Now we try to set SO_SNDBUF to what our caller has requested
- * (OSPF_SNDBUFLEN_DEFAULT initially, which seems to be a sane
- * default; or the MTU of a newly added interface). However,
- * if the OS has truncated the actual buffer size to somewhat
- * less or bigger size, try to detect it and update our records
- * appropriately.
+ * (the MTU of a newly added interface). However, if the OS has
+ * truncated the actual buffer size to somewhat less size, try
+ * to detect it and update our records appropriately. The OS
+ * may allocate more buffer space, than requested, this isn't
+ * a error.
*/
ret = setsockopt_so_sendbuf (ospf->fd, buflen);
newbuflen = getsockopt_so_sendbuf (ospf->fd);
- if (ret < 0 || newbuflen != buflen)
+ if (ret < 0 || newbuflen < buflen)
zlog_warn ("%s: tried to set SO_SNDBUF to %d, but got %d",
__func__, buflen, newbuflen);
if (newbuflen >= 0)
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 8133050d..a4c4fac3 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -33,6 +33,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "sockunion.h" /* for inet_aton () */
#include "zclient.h"
#include "plist.h"
+#include "sockopt.h"
#include "ospfd/ospfd.h"
#include "ospfd/ospf_network.h"
@@ -212,8 +213,10 @@ ospf_new (void)
"a socket");
exit(1);
}
- new->maxsndbuflen = 0;
- ospf_adjust_sndbuflen (new, OSPF_SNDBUFLEN_DEFAULT);
+ new->maxsndbuflen = getsockopt_so_sendbuf (new->fd);
+ if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
+ zlog_debug ("%s: starting with OSPF send buffer size %d",
+ __func__, new->maxsndbuflen);
if ((new->ibuf = stream_new(OSPF_MAX_PACKET_SIZE+1)) == NULL)
{
zlog_err("ospf_new: fatal error: stream_new(%u) failed allocating ibuf",
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index b0a14ce2..7a0ffcef 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -129,9 +129,6 @@
#define OSPF_LS_REFRESH_SHIFT (60 * 15)
#define OSPF_LS_REFRESH_JITTER 60
-/* Initial send buffer size for ospfd raw sending socket. */
-#define OSPF_SNDBUFLEN_DEFAULT 1024
-
/* OSPF master for system wide configuration and variables. */
struct ospf_master
{