+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
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)
#include "sockunion.h" /* for inet_aton () */
#include "zclient.h"
#include "plist.h"
+#include "sockopt.h"
#include "ospfd/ospfd.h"
#include "ospfd/ospf_network.h"
"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",
#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
{