From 5fc9b5adc688da9c7947233b769188b3ac4e251a Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 25 Jun 2014 17:50:31 +0000 Subject: [PATCH] make node id optional git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@91 8ec27952-4edc-4aab-86aa-e87bb2611832 --- src/cfg.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cfg.c b/src/cfg.c index facc098ae..15b5ed364 100644 --- a/src/cfg.c +++ b/src/cfg.c @@ -164,6 +164,8 @@ int config_parse_path(config_setting_t *cfg, int config_parse_node(config_setting_t *cfg, struct node **nodes, struct interface **interfaces) { + static int id; + const char *type_str = NULL; const char *remote_str = NULL; const char *local_str = NULL; @@ -182,9 +184,6 @@ int config_parse_node(config_setting_t *cfg, if (!node->name) cerror(cfg, "Missing node name"); - if (!config_setting_lookup_int(cfg, "id", &node->id)) - cerror(cfg, "Missing id for node '%s'", node->name); - if (!config_setting_lookup_string(cfg, "type", &type_str)) cerror(cfg, "Missing type for node '%s'", node->name); @@ -211,6 +210,9 @@ int config_parse_node(config_setting_t *cfg, config_parse_netem(cfg_netem, node->netem); } + if (!config_setting_lookup_int(cfg, "id", &node->id)) + node->id = id++; + /* Determine outgoing interface */ int index = if_getegress(&node->remote); struct interface *i = if_lookup_index(index, *interfaces);