]> git.puffer.fish Git - mirror/frr.git/commitdiff
+ fix minor regression in OSPF sending buffer adjustment logic
authorDenis Ovsienko <linux@pilot.org.ua>
Tue, 18 Sep 2007 09:01:13 +0000 (09:01 +0000)
committerDenis Ovsienko <linux@pilot.org.ua>
Tue, 18 Sep 2007 09:01:13 +0000 (09:01 +0000)
ospfd/ChangeLog
ospfd/ospf_network.c
ospfd/ospfd.c
ospfd/ospfd.h

index feba89a3f29ac52f907cfd1f70d7d8a89b639383..ce7651628804ab1776a854123c4a65466f1e2ef0 100644 (file)
@@ -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
index 11155dbcb1923ec3314ee05ef6564835eb943a7d..d5bf7493ee97209917431b6458446446cfe664ec 100644 (file)
@@ -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)
index 8133050d7b501646eaed543500407d9297a0054c..a4c4fac31d55e4c0a118925a6b0803cc068c6075 100644 (file)
@@ -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",
index b0a14ce29e9b13594ec602351ef6fb8841454f92..7a0ffcef668523ef312e970b3565971826c0726c 100644 (file)
 #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
 {