]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Use setsockopt_so_recvbuf instead of doing it ourselves
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 10 May 2017 12:36:20 +0000 (08:36 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 24 Jul 2017 17:51:33 +0000 (13:51 -0400)
This change allows other non-linux platforms to be a bit
more forgiving if we ask for a very very large size.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_mroute.c

index ad641c2d9c7f9624fad3c399b19c7fd41d7bf7e3..c92bad6c4d801623262d8f8ef110ca6aaef53c3d 100644 (file)
@@ -24,6 +24,7 @@
 #include "prefix.h"
 #include "vty.h"
 #include "plist.h"
+#include "sockopt.h"
 
 #include "pimd.h"
 #include "pim_rpf.h"
@@ -50,7 +51,6 @@ static int pim_mroute_set(int fd, int enable)
        int err;
        int opt = enable ? MRT_INIT : MRT_DONE;
        socklen_t opt_len = sizeof(opt);
-       int rcvbuf = 1024 * 1024 * 8;
        long flags;
 
        err = setsockopt(fd, IPPROTO_IP, opt, &opt, opt_len);
@@ -63,13 +63,7 @@ static int pim_mroute_set(int fd, int enable)
                return -1;
        }
 
-       err = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf));
-       if (err) {
-               zlog_warn(
-                       "%s: failure: setsockopt(fd=%d, SOL_SOCKET, %d): errno=%d: %s",
-                       __PRETTY_FUNCTION__, fd, rcvbuf, errno,
-                       safe_strerror(errno));
-       }
+       setsockopt_so_recvbuf(fd, 1024 * 1024 * 8);
 
        flags = fcntl(fd, F_GETFL, 0);
        if (flags < 0) {