| 995 | } |
| 996 | |
| 997 | static unsigned int generate_nodeid( |
| 998 | struct totem_config *totem_config, |
| 999 | char *addr) |
| 1000 | { |
| 1001 | unsigned int nodeid; |
| 1002 | struct totem_ip_address totemip; |
| 1003 | |
| 1004 | /* AF_INET hard-coded here because auto-generated nodeids |
| 1005 | are only for IPv4 */ |
| 1006 | if (totemip_parse(&totemip, addr, TOTEM_IP_VERSION_4) != 0) |
| 1007 | return -1; |
| 1008 | |
| 1009 | memcpy (&nodeid, &totemip.addr, sizeof (unsigned int)); |
| 1010 | |
| 1011 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
| 1012 | nodeid = swab32 (nodeid); |
| 1013 | #endif |
| 1014 | |
| 1015 | if (totem_config->clear_node_high_bit) { |
| 1016 | nodeid &= 0x7FFFFFFF; |
| 1017 | } |
| 1018 | return nodeid; |
| 1019 | } |
| 1020 | |
| 1021 | static int check_for_duplicate_nodeids( |
| 1022 | struct totem_config *totem_config, |
no test coverage detected