From 5736139d4a9192c9ba296d2bddc5bbbd025dfd7f Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Sat, 12 Nov 2016 18:39:51 -0200 Subject: [PATCH] pimd/zebra: fix setting of IP_MULTICAST_LOOP on OpenBSD Linux, FreeBSD and NetBSD (and possibly others too) accept both uint8_t and int for the IP_MULTICAST_LOOP sockoption. OpenBSD, in the other hand, accepts only uint8_t. To make setting IP_MULTICAST_LOOP work on every supported platform, always pass a uint8_t variable as a parameter. Signed-off-by: Renato Westphal --- pimd/pim_sock.c | 2 +- pimd/pim_sock.h | 2 +- pimd/pim_ssmpingd.c | 2 +- zebra/irdp_packet.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c index a024e3ae01..90b11dcfd6 100644 --- a/pimd/pim_sock.c +++ b/pimd/pim_sock.c @@ -68,7 +68,7 @@ int pim_socket_raw(int protocol) return fd; } -int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, int loop) +int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, u_char loop) { int fd; diff --git a/pimd/pim_sock.h b/pimd/pim_sock.h index f0a1600818..cd29543fa0 100644 --- a/pimd/pim_sock.h +++ b/pimd/pim_sock.h @@ -39,7 +39,7 @@ #define PIM_SOCK_ERR_BIND (-11) /* Can't bind to interface */ int pim_socket_raw(int protocol); -int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, int loop); +int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, u_char loop); int pim_socket_join(int fd, struct in_addr group, struct in_addr ifaddr, ifindex_t ifindex); int pim_socket_join_source(int fd, ifindex_t ifindex, diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c index fe88eba271..daa3c65e36 100644 --- a/pimd/pim_ssmpingd.c +++ b/pimd/pim_ssmpingd.c @@ -151,7 +151,7 @@ static int ssmpingd_socket(struct in_addr addr, int port, int mttl) } { - int loop = 0; + u_char loop = 0; if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, (void *) &loop, sizeof(loop))) { zlog_warn("%s: could not %s Multicast Loopback Option on socket fd=%d: errno=%d: %s", diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index 25c7aff26b..290a6180e7 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -282,7 +282,7 @@ send_packet(struct interface *ifp, char buf[256]; struct in_pktinfo *pktinfo; u_long src; - int on; + u_char on; if (!(ifp->flags & IFF_UP)) return; -- 2.39.5