diff options
author | sem <sem@FreeBSD.org> | 2011-04-03 02:15:01 +0800 |
---|---|---|
committer | sem <sem@FreeBSD.org> | 2011-04-03 02:15:01 +0800 |
commit | c3a86b049a9a6a97a6f61ede322ebf6287d0c5a8 (patch) | |
tree | 9f9644e9d13df7d615065d59ecbb2e0f770ecc83 /net | |
parent | 1269685abf44a8178c5013d2e24129559006e7f9 (diff) | |
download | freebsd-ports-gnome-c3a86b049a9a6a97a6f61ede322ebf6287d0c5a8.tar.gz freebsd-ports-gnome-c3a86b049a9a6a97a6f61ede322ebf6287d0c5a8.tar.zst freebsd-ports-gnome-c3a86b049a9a6a97a6f61ede322ebf6287d0c5a8.zip |
- Fix ripd on 7.0+.
ripd could not join multicast group and complains to the log:
Can't setsockopt IP_MULTICAST_IF on fd 11 to source address XXX.XXX.XXX.XXX
for interface ng2 can't send packet : Permission denied
PR: ports/155706
Submitted by: Eugene Grosbein
Approved by: maintainer
Diffstat (limited to 'net')
-rw-r--r-- | net/quagga/Makefile | 2 | ||||
-rw-r--r-- | net/quagga/files/patch-lib-sockopt.c | 90 |
2 files changed, 80 insertions, 12 deletions
diff --git a/net/quagga/Makefile b/net/quagga/Makefile index 7ad09e4ba56f..04d439b25deb 100644 --- a/net/quagga/Makefile +++ b/net/quagga/Makefile @@ -7,7 +7,7 @@ PORTNAME= quagga PORTVERSION= 0.99.17 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= net ipv6 MASTER_SITES= http://quagga.net/download/ \ http://www.ru.quagga.net/download/ \ diff --git a/net/quagga/files/patch-lib-sockopt.c b/net/quagga/files/patch-lib-sockopt.c index 5995b3756e5f..49f355e61f1e 100644 --- a/net/quagga/files/patch-lib-sockopt.c +++ b/net/quagga/files/patch-lib-sockopt.c @@ -1,13 +1,81 @@ ---- lib/sockopt.c.orig 2008-01-11 16:47:21.000000000 +0300 -+++ lib/sockopt.c 2008-01-11 16:47:57.000000000 +0300 -@@ -23,6 +23,10 @@ - #include "log.h" - #include "sockopt.h" +--- lib/sockopt.c 2010-04-20 21:44:26.000000000 -0400 ++++ lib/sockopt.c 2010-11-03 10:55:06.000000000 -0400 +@@ -221,13 +221,13 @@ setsockopt_multicast_ipv4(int sock, + #ifdef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX + /* This is better because it uses ifindex directly */ + struct ip_mreqn mreqn; ++ struct group_req gr; ++ struct sockaddr_in *si; + int ret; + + switch (optname) + { + case IP_MULTICAST_IF: +- case IP_ADD_MEMBERSHIP: +- case IP_DROP_MEMBERSHIP: + memset (&mreqn, 0, sizeof(mreqn)); -+#ifdef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX -+#undef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX -+#endif + if (mcast_addr) +@@ -240,6 +240,37 @@ setsockopt_multicast_ipv4(int sock, + + ret = setsockopt(sock, IPPROTO_IP, optname, + (void *)&mreqn, sizeof(mreqn)); ++ return ret; ++ break; + - int - setsockopt_so_recvbuf (int sock, int size) - { ++ case IP_ADD_MEMBERSHIP: ++ case IP_DROP_MEMBERSHIP: ++ if (ifindex) ++ { ++ memset (&gr, 0, sizeof(gr)); ++ si = (struct sockaddr_in *)&gr.gr_group; ++ gr.gr_interface = ifindex; ++ if (mcast_addr) ++ si->sin_family = AF_INET; ++#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN ++ si->sin_len = sizeof(struct sockaddr_in); ++#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ ++ si->sin_addr.s_addr = mcast_addr; ++ if (optname == IP_ADD_MEMBERSHIP) ++ ret = setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void *)&gr, sizeof(gr)); ++ else ++ ret = setsockopt(sock, IPPROTO_IP, MCAST_LEAVE_GROUP, (void *)&gr, sizeof(gr)); ++ } ++ else ++ { ++ memset (&mreqn, 0, sizeof(mreqn)); ++ if (mcast_addr) ++ mreqn.imr_multiaddr.s_addr = mcast_addr; ++ mreqn.imr_address = if_addr; ++ ++ ret = setsockopt(sock, IPPROTO_IP, optname, ++ (void *)&mreqn, sizeof(mreqn)); ++ } + if ((ret < 0) && (optname == IP_ADD_MEMBERSHIP) && (errno == EADDRINUSE)) + { + /* see above: handle possible problem when interface comes back up */ +@@ -248,12 +279,18 @@ setsockopt_multicast_ipv4(int sock, + "re-add (fd %d, ifaddr %s, mcast %s, ifindex %u)", + sock, + inet_ntop(AF_INET, &if_addr, buf[0], sizeof(buf[0])), +- inet_ntop(AF_INET, &mreqn.imr_multiaddr, +- buf[1], sizeof(buf[1])), ifindex); +- setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, +- (void *)&mreqn, sizeof(mreqn)); +- ret = setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, +- (void *)&mreqn, sizeof(mreqn)); ++ inet_ntop(AF_INET, &mcast_addr, buf[1], sizeof(buf[1])), ++ ifindex); ++ if (ifindex) ++ { ++ setsockopt(sock, IPPROTO_IP, MCAST_LEAVE_GROUP, (void *)&gr, sizeof(gr)); ++ ret = setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void *)&gr, sizeof(gr)); ++ } ++ else ++ { ++ setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, (void *)&mreqn, sizeof(mreqn)); ++ ret = setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void *)&mreqn, sizeof(mreqn)); ++ } + } + return ret; + break; |