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

Function get_interface_params

exec/totemconfig.c:1540–1794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1538}
1539
1540static int get_interface_params(struct totem_config *totem_config, icmap_map_t map,
1541 const char **error_string, uint64_t *warnings,
1542 int reload)
1543{
1544 int res = 0;
1545 unsigned int linknumber = 0;
1546 int member_count = 0;
1547 int i;
1548 icmap_iter_t iter, member_iter;
1549 const char *iter_key;
1550 const char *member_iter_key;
1551 char linknumber_key[ICMAP_KEYNAME_MAXLEN];
1552 char tmp_key[ICMAP_KEYNAME_MAXLEN];
1553 uint8_t u8;
1554 uint32_t u32;
1555 char *str;
1556 char *cluster_name = NULL;
1557 enum totem_ip_version_enum tmp_ip_version = TOTEM_IP_VERSION_4;
1558 int ret = 0;
1559
1560 if (reload) {
1561 for (i=0; i<INTERFACE_MAX; i++) {
1562 /*
1563 * Set back to defaults things that might have been configured and
1564 * now have been taken out of corosync.conf. These won't be caught by the
1565 * code below which only looks at interface{} sections that actually exist.
1566 */
1567 totem_config->interfaces[i].configured = 0;
1568 totem_config->interfaces[i].knet_ping_timeout = 0;
1569 totem_config->interfaces[i].knet_ping_interval = 0;
1570 totem_config->interfaces[i].knet_ping_precision = KNET_PING_PRECISION;
1571 totem_config->interfaces[i].knet_pong_count = KNET_PONG_COUNT;
1572 }
1573 }
1574 if (icmap_get_string_r(map, "totem.cluster_name", &cluster_name) != CS_OK) {
1575 cluster_name = NULL;
1576 }
1577
1578 iter = icmap_iter_init_r(map, "totem.interface.");
1579 while ((iter_key = icmap_iter_next(iter, NULL, NULL)) != NULL) {
1580 res = sscanf(iter_key, "totem.interface.%[^.].%s", linknumber_key, tmp_key);
1581 if (res != 2) {
1582 continue;
1583 }
1584
1585 if (strcmp(tmp_key, "bindnetaddr") != 0 && totem_config->transport_number == TOTEM_TRANSPORT_UDP) {
1586 continue;
1587 }
1588
1589 member_count = 0;
1590 linknumber = atoi(linknumber_key);
1591
1592 if (linknumber >= INTERFACE_MAX) {
1593 snprintf (error_string_response, sizeof(error_string_response),
1594 "parse error in config: interface ring number %u is bigger than allowed maximum %u\n",
1595 linknumber, INTERFACE_MAX - 1);
1596
1597 *error_string = error_string_response;

Callers 2

totem_config_readFunction · 0.85

Calls 10

icmap_get_string_rFunction · 0.85
icmap_iter_init_rFunction · 0.85
icmap_iter_nextFunction · 0.85
totemip_parseFunction · 0.85
get_cluster_mcast_addrFunction · 0.85
icmap_get_stringFunction · 0.85
icmap_get_uint16_rFunction · 0.85
icmap_get_uint8_rFunction · 0.85
icmap_get_uint32_rFunction · 0.85
icmap_iter_finalizeFunction · 0.85

Tested by

no test coverage detected