summaryrefslogtreecommitdiffstats
path: root/pimd/pim_sock.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-11-18 20:11:31 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-12-22 02:26:16 +0100
commit18e565fd96f69d7dd445d1c5c07dd7a0dfafd6f9 (patch)
tree5e40ec51b23dc0dbdc688d4e7e17302024119f82 /pimd/pim_sock.c
parentpimd: Add knob to control # of packets read in at one time (diff)
downloadfrr-18e565fd96f69d7dd445d1c5c07dd7a0dfafd6f9.tar.xz
frr-18e565fd96f69d7dd445d1c5c07dd7a0dfafd6f9.zip
pimd: Only make the pim sockets non blocking.
Only make the pim sockets non-blocking on reads. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_sock.c')
-rw-r--r--pimd/pim_sock.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c
index 12f222bb8..6ce336d60 100644
--- a/pimd/pim_sock.c
+++ b/pimd/pim_sock.c
@@ -230,24 +230,25 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, u_char lo
zlog_warn("%s: Failure to set buffer size to %d",
__PRETTY_FUNCTION__, rcvbuf);
- {
- long flags;
-
- flags = fcntl(fd, F_GETFL, 0);
- if (flags < 0) {
- zlog_warn("Could not get fcntl(F_GETFL,O_NONBLOCK) on socket fd=%d: errno=%d: %s",
- fd, errno, safe_strerror(errno));
- close(fd);
- return PIM_SOCK_ERR_NONBLOCK_GETFL;
- }
+ if (protocol == IPPROTO_PIM)
+ {
+ long flags;
+
+ flags = fcntl(fd, F_GETFL, 0);
+ if (flags < 0) {
+ zlog_warn("Could not get fcntl(F_GETFL,O_NONBLOCK) on socket fd=%d: errno=%d: %s",
+ fd, errno, safe_strerror(errno));
+ close(fd);
+ return PIM_SOCK_ERR_NONBLOCK_GETFL;
+ }
- if (fcntl(fd, F_SETFL, flags | O_NONBLOCK)) {
- zlog_warn("Could not set fcntl(F_SETFL,O_NONBLOCK) on socket fd=%d: errno=%d: %s",
- fd, errno, safe_strerror(errno));
- close(fd);
- return PIM_SOCK_ERR_NONBLOCK_SETFL;
+ if (fcntl(fd, F_SETFL, flags | O_NONBLOCK)) {
+ zlog_warn("Could not set fcntl(F_SETFL,O_NONBLOCK) on socket fd=%d: errno=%d: %s",
+ fd, errno, safe_strerror(errno));
+ close(fd);
+ return PIM_SOCK_ERR_NONBLOCK_SETFL;
+ }
}
- }
return fd;
}