summaryrefslogtreecommitdiff
path: root/ospfd/ospf_network.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2016-08-04 10:07:26 -0300
committerDonald Sharp <sharpd@cumulusnetwroks.com>2016-08-07 21:05:26 -0400
commit4a3867d0d331ab64311f517bfb39bddfc933c9ee (patch)
treebbfb0e3efa099b216058d16937ec442d1d085a37 /ospfd/ospf_network.c
parent288b91e0bdf99bd835ce82905415011f77ce5a62 (diff)
lib: fix setting of IPv4 multicast sockopts on OpenBSD
OpenBSD doesn't support the "ifindex hack" derived from RFC 1724 which allows an ifindex to be encoded in the imr_interface field (in_addr) of the ip_mreq structure. OpenBSD also doesn't support the RFC3678 Protocol-Independent socket API extensions, which allows an interface to be specified by its ifindex. With that said, in OpenBSD we still need to specify an interface by its IP address. This patch adds an exception in the multicast sockopt functions to handle this case. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospfd/ospf_network.c')
-rw-r--r--ospfd/ospf_network.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c
index 2f167a50a5..9f516d7390 100644
--- a/ospfd/ospf_network.c
+++ b/ospfd/ospf_network.c
@@ -53,7 +53,7 @@ ospf_if_add_allspfrouters (struct ospf *top, struct prefix *p,
int ret;
ret = setsockopt_ipv4_multicast (top->fd, IP_ADD_MEMBERSHIP,
- htonl (OSPF_ALLSPFROUTERS),
+ p->u.prefix4, htonl (OSPF_ALLSPFROUTERS),
ifindex);
if (ret < 0)
zlog_warn ("can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, "
@@ -74,7 +74,7 @@ ospf_if_drop_allspfrouters (struct ospf *top, struct prefix *p,
int ret;
ret = setsockopt_ipv4_multicast (top->fd, IP_DROP_MEMBERSHIP,
- htonl (OSPF_ALLSPFROUTERS),
+ p->u.prefix4, htonl (OSPF_ALLSPFROUTERS),
ifindex);
if (ret < 0)
zlog_warn ("can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, "
@@ -95,7 +95,7 @@ ospf_if_add_alldrouters (struct ospf *top, struct prefix *p, unsigned int
int ret;
ret = setsockopt_ipv4_multicast (top->fd, IP_ADD_MEMBERSHIP,
- htonl (OSPF_ALLDROUTERS),
+ p->u.prefix4, htonl (OSPF_ALLDROUTERS),
ifindex);
if (ret < 0)
zlog_warn ("can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, "
@@ -116,7 +116,7 @@ ospf_if_drop_alldrouters (struct ospf *top, struct prefix *p, unsigned int
int ret;
ret = setsockopt_ipv4_multicast (top->fd, IP_DROP_MEMBERSHIP,
- htonl (OSPF_ALLDROUTERS),
+ p->u.prefix4, htonl (OSPF_ALLDROUTERS),
ifindex);
if (ret < 0)
zlog_warn ("can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, "
@@ -151,7 +151,7 @@ ospf_if_ipmulticast (struct ospf *top, struct prefix *p, unsigned int ifindex)
zlog_warn ("can't setsockopt IP_MULTICAST_TTL(1) for fd %d: %s",
top->fd, safe_strerror (errno));
- ret = setsockopt_ipv4_multicast_if (top->fd, ifindex);
+ ret = setsockopt_ipv4_multicast_if (top->fd, p->u.prefix4, ifindex);
if (ret < 0)
zlog_warn("can't setsockopt IP_MULTICAST_IF(fd %d, addr %s, "
"ifindex %u): %s",