Hi,

The patch fails to apply, so i did it manually, but it didn't work:

Jan 26 10:45:10 wido-desktop collie: Target daemon logger with pid=7773
started!
Jan 26 10:45:11 wido-desktop collie: worker_routine(175) started this
thread 0
Jan 26 10:45:11 wido-desktop collie: last message repeated 3 times
Jan 26 10:45:11 wido-desktop collie: create_cluster(816) failed to get
address info
Jan 26 10:45:11 wido-desktop collie: main(105) failed to create sheepdog
cluster.

I reverted back to the current GIT tree and removed the 127.0.1.1 entry
from my /etc/hosts, now shepherd looks like:

  Idx   Node id (FNV-1a)    - Host:Port
--------------------------------------------------
  0     52b76e70de45e6c8 - 127.0.0.1:7000
  1     52b76e70de45e6c8 - 127.0.0.1:7000
* 2     52b76e70de45e6c8 - 127.0.0.1:7000
  3     52b76e70de45e6c8 - 127.0.0.1:7000
  4     52b76e70de45e6c8 - 127.0.0.1:7000

-- 
Met vriendelijke groet,

Wido den Hollander
Hoofd Systeembeheer / CSO
Telefoon Support Nederland: 0900 9633 (45 cpm)
Telefoon Support Belgiƫ: 0900 70312 (45 cpm)
Telefoon Direct: (+31) (0)20 50 60 104
Fax: +31 (0)20 50 60 111
E-mail: [email protected]
Website: http://www.pcextreme.nl
Kennisbank: http://support.pcextreme.nl/
Netwerkstatus: http://nmc.pcextreme.nl


On Tue, 2010-01-26 at 06:09 +0000, MORITA Kazutaka wrote:
> Hi,
> 
> On 2010/01/26 1:30, PCextreme B.V. - Wido den Hollander wrote:
> > Hi,
> > 
> > r...@wido-desktop:~# corosync-cfgtool -s
> > Printing ring status.
> > Local node ID 537307328
> > RING ID 0
> >     id      = 192.168.6.32
> >     status  = ring 0 active with no faults
> > r...@wido-desktop:~# 
> 
> Your corosync seems to work right.
> The problem is that the collie fails to get the local ip address.
> 
> Could you try the following patch?
> 
> ==
> From: MORITA Kazutaka <[email protected]>
> Date: Tue, 26 Jan 2010 14:33:02 +0900
> Subject: [PATCH] collie: avoid using an invalid address
> 
> Some distributions contain `127.0.1.1' in /etc/hosts.
> We avoid using these kind of invalid addresses.
> 
> Signed-off-by: MORITA Kazutaka <[email protected]>
> ---
>  collie/group.c |   46 +++++++++++++++++++++++++++++++++-------------
>  1 files changed, 33 insertions(+), 13 deletions(-)
> 
> diff --git a/collie/group.c b/collie/group.c
> index cbb4761..676706d 100644
> --- a/collie/group.c
> +++ b/collie/group.c
> @@ -728,7 +728,7 @@ struct cluster_info *create_cluster(int port)
>       int fd, ret;
>       cpg_handle_t cpg_handle;
>       struct cluster_info *ci;
> -     struct addrinfo hints, *res;
> +     struct addrinfo hints, *res, *res0;
>       char name[INET6_ADDRSTRLEN];
>       struct cpg_name group = { 8, "sheepdog" };
>       cpg_callbacks_t cb = { &sd_deliver, &sd_confch };
> @@ -782,23 +782,43 @@ join_retry:
>       memset(&hints, 0, sizeof(hints));
> 
>       hints.ai_socktype = SOCK_STREAM;
> -     ret = getaddrinfo(name, NULL, &hints, &res);
> +     ret = getaddrinfo(name, NULL, &hints, &res0);
>       if (ret)
>               exit(1);
> 
> -     if (res->ai_family == AF_INET) {
> -             struct sockaddr_in *addr = (struct sockaddr_in *)res->ai_addr;
> -             memset(ci->this_node.addr, 0, sizeof(ci->this_node.addr));
> -             memcpy(ci->this_node.addr + 12, &addr->sin_addr, 4);
> -     } else if (res->ai_family == AF_INET6) {
> -             struct sockaddr_in6 *addr = (struct sockaddr_in6 *)res->ai_addr;
> -             memcpy(ci->this_node.addr, &addr->sin6_addr, 16);
> -     } else {
> -             eprintf("unknown address family\n");
> -             exit(1);
> +     for (res = res0; res; res = res->ai_next) {
> +             if (res->ai_family == AF_INET) {
> +                     struct sockaddr_in *addr;
> +                     addr = (struct sockaddr_in *)res->ai_addr;
> +
> +                     if (((char *) &addr->sin_addr)[0] == 127)
> +                             continue;
> +
> +                     memset(ci->this_node.addr, 0, 12);
> +                     memcpy(ci->this_node.addr + 12, &addr->sin_addr, 4);
> +                     break;
> +             } else if (res->ai_family == AF_INET6) {
> +                     struct sockaddr_in6 *addr;
> +                     uint8_t localhost[16] = { 0, 0, 0, 0, 0, 0, 0, 0,
> +                                               0, 0, 0, 0, 0, 0, 0, 1 };
> +
> +                     addr = (struct sockaddr_in6 *)res->ai_addr;
> +
> +                     if (memcmp(&addr->sin6_addr, localhost, 16) == 0)
> +                             continue;
> +
> +                     memcpy(ci->this_node.addr, &addr->sin6_addr, 16);
> +                     break;
> +             } else
> +                     dprintf("unknown address family\n");
> +     }
> +
> +     if (res == NULL) {
> +             eprintf("failed to get address info\n");
> +             return NULL;
>       }
> 
> -     freeaddrinfo(res);
> +     freeaddrinfo(res0);
> 
>       ci->this_node.port = port;
> 

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to