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 /ospfd/ospf_network.c | |
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 'ospfd/ospf_network.c')
-rw-r--r-- | ospfd/ospf_network.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index 6caa38d68..088123ea2 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -132,18 +132,16 @@ ospf_if_ipmulticast (struct ospf *top, struct prefix *p, ifindex_t ifindex) { u_char val; int ret, len; - - val = 0; - len = sizeof (val); - + /* Prevent receiving self-origined multicast packets. */ - ret = setsockopt (top->fd, IPPROTO_IP, IP_MULTICAST_LOOP, (void *)&val, len); + ret = setsockopt_ipv4_multicast_loop (top->fd, 0); if (ret < 0) zlog_warn ("can't setsockopt IP_MULTICAST_LOOP(0) for fd %d: %s", top->fd, safe_strerror(errno)); /* Explicitly set multicast ttl to 1 -- endo. */ val = 1; + len = sizeof (val); ret = setsockopt (top->fd, IPPROTO_IP, IP_MULTICAST_TTL, (void *)&val, len); if (ret < 0) zlog_warn ("can't setsockopt IP_MULTICAST_TTL(1) for fd %d: %s", |