MCPcopy Create free account
hub / github.com/corosync/corosync / generate_nodeid

Function generate_nodeid

exec/totemconfig.c:997–1019  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

995}
996
997static 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
1021static int check_for_duplicate_nodeids(
1022 struct totem_config *totem_config,

Callers 3

totem_config_readFunction · 0.85

Calls 1

totemip_parseFunction · 0.85

Tested by

no test coverage detected