good for merge

On Fri, 2008-11-14 at 09:55 +0100, Andrew Beekhof wrote:
> Commit r1655 brought forward nodeid generation and erroneously started  
> using bindnet.addr instead of bound_to.addr
> Since then, if the admin used an address ending in one or more .0's  
> for bindnetaddr, this would result in _all_ nodes having the same  
> nodeid.
> 
> This patch moves the clear_node_high_bit processing to the location  
> where nodeid was originally populated (netif_determine) and goes back  
> to using the bound_to address (which was not yet populated during  
> totemnet_initialize()) which is suitable for generating nodeids.
> 
> Andrew
> 
> --- a/exec/totemnet.c Thu Nov 13 21:24:18 2008 +0100
> +++ b/exec/totemnet.c Fri Nov 14 09:45:55 2008 +0100
> @@ -702,7 +702,12 @@ static int netif_determine (
>        * field is only 32 bits.
>        */
>       if (bound_to->family == AF_INET && bound_to->nodeid == 0) {
> -             memcpy (&bound_to->nodeid, bound_to->addr, sizeof (int));
> +             int32_t nodeid = 0;
> +             memcpy (&nodeid, bound_to->addr, sizeof (int));
> +             if(nodeid < 0 && instance->totem_config->clear_node_high_bit) {
> +                     nodeid = 0 - nodeid;
> +             }
> +             bound_to->nodeid = nodeid;
>       }
> 
>       return (res);
> @@ -1227,15 +1232,6 @@ int totemnet_initialize (
> 
>       instance->totemnet_poll_handle = poll_handle;
> 
> -     if(instance->totem_config->node_id == 0) {      
> -             int32_t nodeid = 0;
> -             memcpy (&nodeid, instance->totem_interface->bindnet.addr, 
> sizeof  
> (int32_t));
> -             if(nodeid < 0 && instance->totem_config->clear_node_high_bit) {
> -                     nodeid = 0 - nodeid;
> -             }
> -             instance->totem_config->node_id = nodeid;
> -     }
> -
>       instance->totem_interface->bindnet.nodeid = instance->totem_config- 
>  >node_id;
> 
>       instance->context = context;
> 
> _______________________________________________
> Openais mailing list
> [email protected]
> https://lists.linux-foundation.org/mailman/listinfo/openais

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to