diff options
author | paul <paul> | 2005-05-07 02:22:51 +0000 |
---|---|---|
committer | paul <paul> | 2005-05-07 02:22:51 +0000 |
commit | 18275fff9a5530a4446f822d04ce37754739b9ce (patch) | |
tree | a0d9841bf389e0cbe60c42b2b48f4f35b4a7b4e1 /lib | |
parent | 57db8593ffb5fdd357689388320cdb2dadb6621b (diff) | |
download | quagga-18275fff9a5530a4446f822d04ce37754739b9ce.tar.bz2 quagga-18275fff9a5530a4446f822d04ce37754739b9ce.tar.xz |
2005-05-07 Yar Tikhiy <yar@comp.chem.msu.su>
* configure.ac: Check for OSes which support passing ifindex in
struct ip_mreq.
* lib/sockopt.c: Add support for BSD style ifindex in ip_mreq.
* ospfd/ospf_network.c: Log ifindex on multicast membership leave/join
events.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ChangeLog | 4 | ||||
-rw-r--r-- | lib/sockopt.c | 14 |
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index f5145321..18ac2214 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2005-05-07 Yar Tikhiy <yar@comp.chem.msu.su> + + * sockopt.c: Add support for BSD style ifindex in ip_mreq. + 2005-05-06 Paul Jakma <paul@dishone.st> * (general) extern and static'ification of functions in code and diff --git a/lib/sockopt.c b/lib/sockopt.c index 81db88d9..655ecdc0 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -171,8 +171,7 @@ setsockopt_multicast_ipv4(int sock, unsigned int ifindex) { - /* Linux 2.2.0 and up */ -#if defined(GNU_LINUX) && LINUX_VERSION_CODE > 131584 +#ifdef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX /* This is better because it uses ifindex directly */ struct ip_mreqn mreqn; @@ -212,11 +211,16 @@ setsockopt_multicast_ipv4(int sock, struct in_addr m; struct ip_mreq mreq; +#ifdef HAVE_BSD_STRUCT_IP_MREQ_HACK + if (ifindex) + m.s_addr = htonl(ifindex); + else +#endif + m = if_addr; + switch (optname) { case IP_MULTICAST_IF: - m = if_addr; - return setsockopt (sock, IPPROTO_IP, optname, (void *)&m, sizeof(m)); break; @@ -224,7 +228,7 @@ setsockopt_multicast_ipv4(int sock, case IP_DROP_MEMBERSHIP: memset (&mreq, 0, sizeof(mreq)); mreq.imr_multiaddr.s_addr = mcast_addr; - mreq.imr_interface = if_addr; + mreq.imr_interface = m; return setsockopt (sock, IPPROTO_IP, |