- if(get_config_string(lookup_config(config_tree, "Mode"), &mode)) {
- if(!strcasecmp(mode, "router"))
- routing_mode = RMODE_ROUTER;
- else if(!strcasecmp(mode, "switch"))
- routing_mode = RMODE_SWITCH;
- else if(!strcasecmp(mode, "hub"))
- routing_mode = RMODE_HUB;
- else {
- logger(LOG_ERR, "Invalid routing mode!");
- return false;
- }
- free(mode);
- }
-
- if(get_config_string(lookup_config(config_tree, "Forwarding"), &mode)) {
- if(!strcasecmp(mode, "off"))
- forwarding_mode = FMODE_OFF;
- else if(!strcasecmp(mode, "internal"))
- forwarding_mode = FMODE_INTERNAL;
- else if(!strcasecmp(mode, "kernel"))
- forwarding_mode = FMODE_KERNEL;
- else {
- logger(LOG_ERR, "Invalid forwarding mode!");
- return false;
- }
- free(mode);
+ if(!node_read_from_config(mesh, n, &config)) {
+ logger(mesh, MESHLINK_ERROR, "Invalid config file for node %s", n->name);
+ config_free(&config);
+ free_node(n);
+ return false;