summaryrefslogtreecommitdiffstats
path: root/pimd/pim_sock.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-11-19 17:20:26 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-12-22 02:26:16 +0100
commit7923d3178ff6b5aab419a36869e777cb4be77636 (patch)
tree65393df17d15beb167165866bd658dcbfcb86c01 /pimd/pim_sock.c
parentpim-anycast-rp: Support in BGP unnumbered networks. (diff)
downloadfrr-7923d3178ff6b5aab419a36869e777cb4be77636.tar.xz
frr-7923d3178ff6b5aab419a36869e777cb4be77636.zip
pimd: Cleanup igmp read socket
With the change over to using the kernel upcall for igmp messages, we need to add in a read thread for the igmp socket to drain the igmp socket's receive queue. 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, 16 insertions, 17 deletions
diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c
index 6ce336d60..12f222bb8 100644
--- a/pimd/pim_sock.c
+++ b/pimd/pim_sock.c
@@ -230,25 +230,24 @@ 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);
- 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;
- }
+ {
+ long flags;
- 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;
- }
+ 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;
}
+ }
return fd;
}