summaryrefslogtreecommitdiffstats
path: root/pimd/pim_ssmpingd.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2016-11-12 22:05:08 +0100
committerRenato Westphal <renato@opensourcerouting.org>2016-11-25 14:46:06 +0100
commitc5bdb09fd9d18ac0524a14c90f79cfad95afefd7 (patch)
treea74b32bb6d4df5fc1075b4d71fe39fc55e2538d4 /pimd/pim_ssmpingd.c
parentpimd/zebra: fix setting of IP_MULTICAST_LOOP on OpenBSD (diff)
downloadfrr-c5bdb09fd9d18ac0524a14c90f79cfad95afefd7.tar.xz
frr-c5bdb09fd9d18ac0524a14c90f79cfad95afefd7.zip
*: create a helper function to set the IP_MULTICAST_LOOP sockoption
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'pimd/pim_ssmpingd.c')
-rw-r--r--pimd/pim_ssmpingd.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c
index daa3c65e3..fba563a6f 100644
--- a/pimd/pim_ssmpingd.c
+++ b/pimd/pim_ssmpingd.c
@@ -25,6 +25,7 @@
#include "if.h"
#include "log.h"
#include "memory.h"
+#include "sockopt.h"
#include "pim_ssmpingd.h"
#include "pim_time.h"
@@ -150,17 +151,12 @@ static int ssmpingd_socket(struct in_addr addr, int port, int mttl)
return -1;
}
- {
- u_char loop = 0;
- if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
- (void *) &loop, sizeof(loop))) {
- zlog_warn("%s: could not %s Multicast Loopback Option on socket fd=%d: errno=%d: %s",
- __PRETTY_FUNCTION__,
- loop ? "enable" : "disable",
- fd, errno, safe_strerror(errno));
- close(fd);
- return PIM_SOCK_ERR_LOOP;
- }
+ if (setsockopt_ipv4_multicast_loop (fd, 0)) {
+ zlog_warn("%s: could not disable Multicast Loopback Option on socket fd=%d: errno=%d: %s",
+ __PRETTY_FUNCTION__,
+ fd, errno, safe_strerror(errno));
+ close(fd);
+ return PIM_SOCK_ERR_LOOP;
}
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,