Re: cman ignores interface setting on ipv4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am running the fc4 and installed the cluster tools with yum. I think my cman 
version is 1.0.0, is it possible that this version still ignores the 
interface settings. Does anybody know, where to get newer versions of the 
cluster software without compiling it myself?

Thanks!

> Hi,
>
> The current ipv4 code in the stable branch for cman completely ignores
> the interface="" attribute for multicast. I've attached a minimal patch
> that fixes that.
>
> I've only done minimal testing (ie it works here).. it will probably
> break if there is no interface set, etc.. Have fun ;)
>
> --
> Olivier Crête
> ocrete max-t com
> Maximum Throughput Inc.
>
> Index: cman/cman_tool/join.c
> ===================================================================
> RCS file: /cvs/cluster/cluster/cman/cman_tool/join.c,v
> retrieving revision 1.12.2.7.4.1
> diff -u -r1.12.2.7.4.1 join.c
> --- cman/cman_tool/join.c       31 May 2005 15:08:24 -0000     
> 1.12.2.7.4.1 +++ cman/cman_tool/join.c       19 Jul 2005 22:14:45 -0000
> @@ -79,6 +79,7 @@
>      int ret;
>      int he_errno;
>      uint32_t bcast;
> +    struct ifreq ifr;
>
>      memset(&mcast_sin, 0, sizeof(mcast_sin));
>      mcast_sin.sin_family = AF_INET;
> @@ -148,11 +149,14 @@
>
>      /* Join the multicast group */
>      if (bhe) {
> -       struct ip_mreq mreq;
> +       struct ip_mreqn mreq;
>         char mcast_opt;
>
>         memcpy(&mreq.imr_multiaddr, bhe->h_addr, bhe->h_length);
> -       memcpy(&mreq.imr_interface, he->h_addr, he->h_length);
> +       // memcpy(&mreq.imr_address, he->h_addr, he->h_length);
> +       mreq.imr_ifindex = if_nametoindex(comline->interfaces[num]);
> +       printf("num %d index %d if %s mcastname %s nodename %s\n", num,
> mreq.imr_ifindex, comline->interfaces[num], comline->multicast_names[num],
> comline->nodenames[num]); +
>         if (setsockopt(mcast_sock, SOL_IP, IP_ADD_MEMBERSHIP, (void
> *)&mreq, sizeof(mreq))) die("Unable to join multicast group %s: %s\n",
> comline->multicast_names[num], strerror(errno));
>
> @@ -162,6 +166,11 @@
>
>         mcast_opt = 0;
>         setsockopt(mcast_sock, SOL_IP, IP_MULTICAST_LOOP, (void
> *)&mcast_opt, sizeof(mcast_opt)); +
> +       if (setsockopt(mcast_sock, SOL_IP, IP_MULTICAST_IF, (void *)&mreq,
> sizeof(mreq))) { +               die("Unable to set multicast interface
> %s\n", comline->interfaces[num]); +       }
> +
>      }
>
>      /* Local socket */
> @@ -169,6 +178,17 @@
>      if (local_sock < 0)
>         die("Can't open local socket: %s", strerror(errno));
>
> +    strcpy(ifr.ifr_name, comline->interfaces[num]);
> +    ifr.ifr_addr.sa_family = AF_INET;
> +
> +    if (ioctl(local_sock, SIOCGIFADDR, &ifr ) < 0)
> +           die("Can't find IP ADDR for interface: %s", strerror(errno));
> +
> +
> +
> +    memcpy(&local_sin.sin_addr, &((struct sockaddr_in
> *)&ifr.ifr_addr)->sin_addr, +          sizeof(local_sin.sin_addr));
> +
>      if (bind(local_sock, (struct sockaddr *)&local_sin,
> sizeof(local_sin))) die("Cannot bind local address: %s", strerror(errno));

--

Linux-cluster@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-cluster

[Index of Archives]     [Corosync Cluster Engine]     [GFS]     [Linux Virtualization]     [Centos Virtualization]     [Centos]     [Linux RAID]     [Fedora Users]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Camping]

  Powered by Linux