Note my comment doesn't indicate a regression or new breakage, it only notes a caveat: the Solaris OS API doesn't work with unnumbered IPv4. (Maybe the API changed in the meantime - this patch is pretty old...)
But considering it didn't work at all before, the patch is still an improvement. I would suggest to apply it, and after that if someone feels like it they can check for updated Solaris APIs or even go patch the Solaris kernel... -David On Thu, Jun 30, 2016 at 03:12:20PM +0100, Paul Jakma wrote: > Hi, > > I have this hoovered up for review. Is David's comment a deal-breaker or > .. Can it be addressed? > > regards, > > Paul > > On Mon, 14 Jan 2013, Christian Franke wrote: > > > On OpenIndiana/Solaris the build fails with "unsupported multicast API". > > It's only in the IPv4 part where setsockopt IP_MULTICAST_IF needs a > > local address and not the index (IPv6 wants the index). > > The following code walks the list of interfaces until it finds the matching > > index and uses the interface's local address for the setsockopt call. > > I don't know if it works on Solaris < 10 (I guess yes, but I don't have > > any machine to verify it). > > > > [NB: this breaks unnumbered setups that use the same IPv4 address on > > multiple interfaces. -- equi...@opensourcerouting.org] > > > > Reported-by: Brian Utterback <brian.utterb...@oracle.com> > > Signed-off-by: Christian Franke <ch...@opensourcerouting.org> > > --- > > > > You could try whether this patch improves the build for you, it is not > > thoroughly tested however. If someone who is more familiar with Solaris > > could have a look at this and the other build issues the current Quagga > > version has on Solaris, it would be quite helpful. > > > > -Christian > > > > lib/sockopt.c | 34 ++++++++++++++++++++++++++++++++++ > > 1 file changed, 34 insertions(+) > > > > diff --git a/lib/sockopt.c b/lib/sockopt.c > > index be22827..545a66d 100644 > > --- a/lib/sockopt.c > > +++ b/lib/sockopt.c > > @@ -20,6 +20,11 @@ > > */ > > > > #include <zebra.h> > > + > > +#ifdef SUNOS_5 > > +#include <ifaddrs.h> > > +#endif > > + > > #include "log.h" > > #include "sockopt.h" > > #include "sockunion.h" > > @@ -339,6 +344,35 @@ setsockopt_ipv4_multicast_if(int sock, > > m.s_addr = htonl(ifindex); > > > > return setsockopt (sock, IPPROTO_IP, IP_MULTICAST_IF, (void *)&m, > > sizeof(m)); > > +#elif defined(SUNOS_5) > > + char ifname[IF_NAMESIZE]; > > + struct ifaddrs *ifa, *ifap; > > + struct in_addr ifaddr; > > + > > + if (if_indextoname(ifindex, ifname) == NULL) > > + return -1; > > + > > + if (getifaddrs(&ifa) != 0) > > + return -1; > > + > > + for (ifap = ifa; ifap != NULL; ifap = ifap->ifa_next) > > + { > > + struct sockaddr_in *sa; > > + > > + if (strcmp(ifap->ifa_name, ifname) != 0) > > + continue; > > + if (ifap->ifa_addr->sa_family != AF_INET) > > + continue; > > + sa = (struct sockaddr_in*)ifap->ifa_addr; > > + memcpy(&ifaddr, &sa->sin_addr, sizeof(ifaddr)); > > + break; > > + } > > + > > + freeifaddrs(ifa); > > + if (!ifap) /* This means we did not find an IP */ > > + return -1; > > + > > + return setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, (void *)&ifaddr, > > sizeof(ifaddr)); > > #else > > #error "Unsupported multicast API" > > #endif > > > > -- > Paul Jakma | p...@jakma.org | @pjakma | Key ID: 0xD86BF79464A2FF6A > Fortune: > Automobile, n.: > A four-wheeled vehicle that runs up hills and down pedestrians. _______________________________________________ Quagga-dev mailing list Quagga-dev@lists.quagga.net https://lists.quagga.net/mailman/listinfo/quagga-dev