Matt,

I included my modified mcast.c in this message since it's pretty small. I 
started off by adding includes but then I realized I was mislead and commented 
out my additions. The real change is near line 58 where I moved the 
fprintf(stderr,"AF_INET6\n"); statement which upset the C compiler because is 
came before the mreq definition.

----
Yemi

----start of mcast.c -----
#include "apr_arch_networkio.h"
// #include <apr_network_io.h>
// #include <netinet/in.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <stdio.h>
#ifdef SOLARIS2
#include <sys/sockio.h>  /* for SIOCGIFADDR */
#endif

apr_status_t
apr_multicast_join( apr_socket_t *sock, apr_sockaddr_t **sa, char *ifname )
{
  apr_status_t status;
  int rval;

  switch( (*sa)->sa.sin.sin_family )
    {
    case AF_INET:
        {
          struct ip_mreq mreq[1];
          struct ifreq ifreq[1];

          memcpy(&mreq->imr_multiaddr, &((*sa)->sa.sin.sin_addr), 
                 sizeof mreq->imr_multiaddr);

          memset(&ifreq,0, sizeof(ifreq));
          if(ifname)
            {
              strncpy(ifreq->ifr_name, ifname, IFNAMSIZ);
              if (ioctl(sock->socketdes, SIOCGIFADDR, ifreq) == -1)
                {
                  perror("ioctl");
                  return -1;
                }
            }
          else
            {
              mreq->imr_interface.s_addr = htonl(INADDR_ANY);
            }

          memcpy(&mreq->imr_interface, 
                 &((struct sockaddr_in *)&ifreq->ifr_addr)->sin_addr, 
                 sizeof mreq->imr_interface);

          rval = setsockopt(sock->socketdes, IPPROTO_IP, IP_ADD_MEMBERSHIP, 
                            mreq, sizeof mreq);
          if(rval<0)
            {
              /* handle error */
            }
          break;
        }
#ifdef AF_INET6
    case AF_INET6:
        {         
          struct ipv6_mreq mreq[1];
          struct ifreq ifreq[1];
          fprintf(stderr,"AF_INET6\n");   
          memcpy(&mreq->ipv6mr_multiaddr, &((*sa)->sa.sin6.sin6_addr),
                                  sizeof mreq->ipv6mr_multiaddr);

          memset(&ifreq,0, sizeof(ifreq));
          if(ifname)
            {
              strncpy(ifreq->ifr_name, ifname, IFNAMSIZ);
            }

          if (ioctl(sock->socketdes, SIOCGIFADDR, ifreq) == -1)
                        return -1;

          rval = setsockopt(sock->socketdes, IPPROTO_IPV6, IPV6_JOIN_GROUP, 
mreq, sizeof mreq);

          break;
        }
#endif
    default:
      /* Set errno to EPROTONOSUPPORT */
      return -1;
    }

}

apr_status_t
apr_multicast_leave( apr_socket_t *sock, apr_sockaddr_t **sa )
{
  apr_status_t status;

  


}
 
---- end of mcast.c ----

> -----Original Message-----
> From: Matt Massie [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 04, 2004 4:36 PM
> To: Brooks Davis
> Cc: Ganglia Developers
> Subject: Re: [Ganglia-developers] 2.6.0 apr test
> 
> i should have done a "distcheck" before i uploaded the new snapshot.
> my bad.  i just uploaded a new tarball that is correct.
> 
> http://matt-massie.com/ganglia/ganglia-apr-2.6.0.tar.gz
> 
> also, yemi.. can you send me your "mcast.c"?  i'm not clear 
> on what you had to change to get it to work.
> 
> if brooks and yemi are happy, then i know freebsd and solaris 
> are happy .. and that will make me happy.
> 
> -matt
> 
> On Wed, 2004-08-04 at 16:26, Brooks Davis wrote:
> > On Wed, Aug 04, 2004 at 01:36:54PM -0700, Matt Massie wrote:
> > > on second thought... scratch that idea.  i have a better one.
> > > 
> > > just include
> > > #include <apr_network_io.h>
> > > 
> > > to mcast.c and we'll be set.  it correctly adds netinet/in.h.
> > > 
> > > sorry that i missed that.
> > > 
> > > i just uploaded a new snapshot to
> > > http://matt-massie.com/ganglia/ganglia-apr-2.6.0.tar.gz
> > > with that change.  
> > 
> > I can't get this one to build on FreeBSD.  I dies with:
> > 
> > /bin/sh ../libtool --mode=link gcc 
> -I/n/rushg/sdg4/brooks/working/ganglia/ganglia-2.6.0/srclib/ap
> r/include 
> -I/n/rushg/sdg4/brooks/working/ganglia/ganglia-2.6.0/srclib/ap
> r-util/include -Wall -g -O2  -L/usr/local/lib -o 
> libganglia.la -rpath /usr/local/apache2/lib -version-info 
> 0:0:0 -release 2.6 -export-dynamic heap.lo task_heap.lo 
> /n/rushg/sdg4/brooks/working/ganglia/ganglia-2.6.0/srclib/apr/
> libapr-0.la 
> /n/rushg/sdg4/brooks/working/ganglia/ganglia-2.6.0/srclib/apr-
> util/libaprutil-0.la -lm -lcrypt   -lexpat 
> > libtool: link: cannot find the library 
> `/n/rushg/sdg4/brooks/working/ganglia/ganglia-2.6.0/srclib/apr
> /libapr-0.la'
> > gmake[1]: *** [libganglia.la] Error 1
> > gmake[1]: Leaving directory 
> `/n/rushg/sdg4/brooks/working/ganglia/ganglia-2.6.0/lib'
> > 
> > -- Brooks
> --
> PGP fingerprint 'A7C2 3C2F 8445 AD3C 135E F40B 242A 5984 ACBC 91D3'
> 
>    They that can give up essential liberty to obtain a little 
>       temporary safety deserve neither liberty nor safety. 
>   --Benjamin Franklin, Historical Review of Pennsylvania, 1759
> 

Reply via email to