* Configure parameters for links */
| 1232 | * Configure parameters for links |
| 1233 | */ |
| 1234 | static void configure_link_params(struct totem_config *totem_config, icmap_map_t map) |
| 1235 | { |
| 1236 | int i; |
| 1237 | char tmp_key[ICMAP_KEYNAME_MAXLEN]; |
| 1238 | char *addr_string; |
| 1239 | int err; |
| 1240 | int local_node_pos = find_local_node(map, 0); |
| 1241 | |
| 1242 | for (i = 0; i<INTERFACE_MAX; i++) { |
| 1243 | if (!totem_config->interfaces[i].configured) { |
| 1244 | continue; |
| 1245 | } |
| 1246 | |
| 1247 | log_printf(LOGSYS_LEVEL_DEBUG, "Configuring link %d params\n", i); |
| 1248 | |
| 1249 | snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.ring%u_addr", local_node_pos, i); |
| 1250 | if (icmap_get_string_r(map, tmp_key, &addr_string) != CS_OK) { |
| 1251 | continue; |
| 1252 | } |
| 1253 | |
| 1254 | err = totemip_parse(&totem_config->interfaces[i].local_ip, addr_string, totem_config->ip_version); |
| 1255 | if (err != 0) { |
| 1256 | continue; |
| 1257 | } |
| 1258 | totem_config->interfaces[i].local_ip.nodeid = totem_config->node_id; |
| 1259 | |
| 1260 | /* In case this is a new link, fill in the defaults if there was no interface{} section for it */ |
| 1261 | if (!totem_config->interfaces[i].knet_link_priority) |
| 1262 | totem_config->interfaces[i].knet_link_priority = 1; |
| 1263 | |
| 1264 | /* knet_ping_interval & knet_ping_timeout are set later once we know all the other params */ |
| 1265 | if (!totem_config->interfaces[i].knet_ping_precision) |
| 1266 | totem_config->interfaces[i].knet_ping_precision = KNET_PING_PRECISION; |
| 1267 | if (!totem_config->interfaces[i].knet_pong_count) |
| 1268 | totem_config->interfaces[i].knet_pong_count = KNET_PONG_COUNT; |
| 1269 | if (!totem_config->interfaces[i].knet_transport) |
| 1270 | totem_config->interfaces[i].knet_transport = KNET_TRANSPORT_UDP; |
| 1271 | if (!totem_config->interfaces[i].ip_port) |
| 1272 | totem_config->interfaces[i].ip_port = DEFAULT_PORT + i; |
| 1273 | } |
| 1274 | } |
| 1275 | |
| 1276 | |
| 1277 | static void configure_totem_links(struct totem_config *totem_config, icmap_map_t map) |
no test coverage detected