summaryrefslogtreecommitdiff
path: root/lib/sockopt.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2016-11-12 19:05:08 -0200
committerRenato Westphal <renato@opensourcerouting.org>2016-11-25 11:46:06 -0200
commitc5bdb09fd9d18ac0524a14c90f79cfad95afefd7 (patch)
treea74b32bb6d4df5fc1075b4d71fe39fc55e2538d4 /lib/sockopt.c
parent5736139d4a9192c9ba296d2bddc5bbbd025dfd7f (diff)
*: create a helper function to set the IP_MULTICAST_LOOP sockoption
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/sockopt.c')
-rw-r--r--lib/sockopt.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/sockopt.c b/lib/sockopt.c
index c480cee0d7..be3ac0e4bf 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -384,7 +384,20 @@ setsockopt_ipv4_multicast_if(int sock, struct in_addr if_addr,
#error "Unsupported multicast API"
#endif
}
-
+
+int
+setsockopt_ipv4_multicast_loop (int sock, u_char val)
+{
+ int ret;
+
+ ret = setsockopt (sock, IPPROTO_IP, IP_MULTICAST_LOOP, (void *) &val,
+ sizeof (val));
+ if (ret < 0)
+ zlog_warn ("can't setsockopt IP_MULTICAST_LOOP");
+
+ return ret;
+}
+
static int
setsockopt_ipv4_ifindex (int sock, ifindex_t val)
{