#include "path-util.h"
#include "conf-files.h"
#include "conf-parser.h"
+#include "util.h"
static int network_load_one(Manager *manager, const char *filename) {
_cleanup_network_free_ Network *network = NULL;
_cleanup_fclose_ FILE *file = NULL;
+ Route *route;
+ Address *address;
int r;
assert(manager);
}
LIST_PREPEND(networks, manager->networks, network);
+
+ LIST_FOREACH(static_routes, route, network->static_routes) {
+ if (!route->family) {
+ log_warning("Route section without Gateway field configured in %s. "
+ "Ignoring", filename);
+ return 0;
+ }
+
+ if (route->dst_family && route->family != route->dst_family) {
+ log_warning("Route section with conflicting Gateway and Destination address "
+ "family configured in %s. Ignoring", filename);
+ return 0;
+ }
+ }
+
+ LIST_FOREACH(static_addresses, address, network->static_addresses) {
+ if (!address->family) {
+ log_warning("Address section without Address field configured in %s. "
+ "Ignoring", filename);
+ return 0;
+ }
+ }
+
network = NULL;
return 0;
int network_load(Manager *manager) {
Network *network;
- char **files, **f;
+ _cleanup_strv_free_ char **files = NULL;
+ char **f;
int r;
assert(manager);
return r;
}
- strv_free(files);
-
return 0;
}
hashmap_free(network->addresses_by_section);
hashmap_free(network->routes_by_section);
- LIST_REMOVE(networks, network->manager->networks, network);
+ if (network->manager && network->manager->networks)
+ LIST_REMOVE(networks, network->manager->networks, network);
free(network);
}