diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2016-11-12 22:05:08 +0100 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2016-11-25 14:46:06 +0100 |
commit | c5bdb09fd9d18ac0524a14c90f79cfad95afefd7 (patch) | |
tree | a74b32bb6d4df5fc1075b4d71fe39fc55e2538d4 /lib | |
parent | pimd/zebra: fix setting of IP_MULTICAST_LOOP on OpenBSD (diff) | |
download | frr-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 'lib')
-rw-r--r-- | lib/sockopt.c | 15 | ||||
-rw-r--r-- | lib/sockopt.h | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/sockopt.c b/lib/sockopt.c index c480cee0d..be3ac0e4b 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) { diff --git a/lib/sockopt.h b/lib/sockopt.h index d67b510b6..02f018934 100644 --- a/lib/sockopt.h +++ b/lib/sockopt.h @@ -89,6 +89,8 @@ extern int setsockopt_ipv4_multicast(int sock, int optname, struct in_addr if_addr, unsigned int mcast_addr, ifindex_t ifindex); +extern int setsockopt_ipv4_multicast_loop (int sock, u_char val); + extern int setsockopt_ipv4_tos(int sock, int tos); /* Ask for, and get, ifindex, by whatever method is supported. */ |