lib: simplify interface of setsockopt_multicast_ipv4().
* sockopt.[ch] (setsockopt_ipv4_multicast): ifindex is now mandatory (all
non-ancient OSes can use it anyway), and if_addr parameter (the address
of the interface) is now gone. (setsockopt_ipv4_multicast_if):
IP_MULTICAST_IF processing moved to this new function
* ospf_network.c (ospf_if_add_allspfrouters, ospf_if_drop_allspfrouters,
ospf_if_add_alldrouters, ospf_if_drop_alldrouters, ospf_if_ipmulticast),
rip_interface.c (ipv4_multicast_join, ipv4_multicast_leave,
rip_interface_new): adapt to the new interface
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index d3b55fc..810b71c 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -78,9 +78,8 @@
{
int ret;
- ret = setsockopt_multicast_ipv4 (sock,
+ ret = setsockopt_ipv4_multicast (sock,
IP_ADD_MEMBERSHIP,
- ifa,
group.s_addr,
ifindex);
@@ -100,9 +99,8 @@
{
int ret;
- ret = setsockopt_multicast_ipv4 (sock,
+ ret = setsockopt_ipv4_multicast (sock,
IP_DROP_MEMBERSHIP,
- ifa,
group.s_addr,
ifindex);
@@ -138,18 +136,13 @@
void
rip_interface_multicast_set (int sock, struct connected *connected)
{
- struct in_addr addr;
-
assert (connected != NULL);
- addr = CONNECTED_ID(connected)->u.prefix4;
-
- if (setsockopt_multicast_ipv4 (sock, IP_MULTICAST_IF, addr, 0,
- connected->ifp->ifindex) < 0)
+ if (setsockopt_ipv4_multicast_if (sock, connected->ifp->ifindex) < 0)
{
zlog_warn ("Can't setsockopt IP_MULTICAST_IF on fd %d to "
- "source address %s for interface %s",
- sock, inet_ntoa(addr),
+ "ifindex %d for interface %s",
+ sock, connected->ifp->ifindex,
connected->ifp->name);
}