diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-bridge.c | 2 | ||||
-rw-r--r-- | src/network/networkd-manager.c | 27 | ||||
-rw-r--r-- | src/network/networkd-network.c | 2 | ||||
-rw-r--r-- | src/network/networkd.h | 3 |
4 files changed, 15 insertions, 19 deletions
diff --git a/src/network/networkd-bridge.c b/src/network/networkd-bridge.c index ac71cf39d8..1b05bf1caa 100644 --- a/src/network/networkd-bridge.c +++ b/src/network/networkd-bridge.c @@ -305,7 +305,7 @@ int bridge_load(Manager *manager) { while ((bridge = hashmap_first(manager->bridges))) bridge_free(bridge); - r = conf_files_list_strv(&files, ".netdev", NULL, (const char **)manager->network_dirs); + r = conf_files_list_strv(&files, ".netdev", NULL, network_dirs); if (r < 0) { log_error("Failed to enumerate netdev files: %s", strerror(-r)); return r; diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 4e2cf45791..c9ce1d6a13 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -24,6 +24,15 @@ #include "libudev-private.h" #include "udev-util.h" +const char* const network_dirs[] = { + "/etc/systemd/network", + "/run/systemd/network", + "/usr/lib/systemd/network", +#ifdef HAVE_SPLIT_USER + "/lib/systemd/network", +#endif + NULL}; + int manager_new(Manager **ret) { _cleanup_manager_free_ Manager *m = NULL; int r; @@ -60,19 +69,6 @@ int manager_new(Manager **ret) { LIST_HEAD_INIT(m->networks); - m->network_dirs = strv_new("/etc/systemd/network/", - "/run/systemd/network/", - "/usr/lib/systemd/network", -#ifdef HAVE_SPLIT_USER - "/lib/systemd/network", -#endif - NULL); - if (!m->network_dirs) - return -ENOMEM; - - if (!path_strv_canonicalize_uniq(m->network_dirs)) - return -ENOMEM; - *ret = m; m = NULL; @@ -100,7 +96,6 @@ void manager_free(Manager *m) { bridge_free(bridge); hashmap_free(m->bridges); - strv_free(m->network_dirs); sd_rtnl_unref(m->rtnl); free(m); @@ -110,7 +105,7 @@ int manager_load_config(Manager *m) { int r; /* update timestamp */ - paths_check_timestamp(m->network_dirs, &m->network_dirs_ts_usec, true); + paths_check_timestamp(network_dirs, &m->network_dirs_ts_usec, true); r = bridge_load(m); if (r < 0) @@ -124,7 +119,7 @@ int manager_load_config(Manager *m) { } bool manager_should_reload(Manager *m) { - return paths_check_timestamp(m->network_dirs, &m->network_dirs_ts_usec, false); + return paths_check_timestamp(network_dirs, &m->network_dirs_ts_usec, false); } static int manager_process_link(Manager *m, struct udev_device *device) { diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 0326fe675b..1606042264 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -112,7 +112,7 @@ int network_load(Manager *manager) { while ((network = manager->networks)) network_free(network); - r = conf_files_list_strv(&files, ".network", NULL, (const char **)manager->network_dirs); + r = conf_files_list_strv(&files, ".network", NULL, network_dirs); if (r < 0) { log_error("Failed to enumerate network files: %s", strerror(-r)); return r; diff --git a/src/network/networkd.h b/src/network/networkd.h index 75309a9b85..bfa01a94f0 100644 --- a/src/network/networkd.h +++ b/src/network/networkd.h @@ -178,10 +178,11 @@ struct Manager { Hashmap *bridges; LIST_HEAD(Network, networks); - char **network_dirs; usec_t network_dirs_ts_usec; }; +extern const char* const network_dirs[]; + /* Manager */ int manager_new(Manager **ret); |