]> git.ipfire.org Git - network.git/commitdiff
networkd: Read main configuration file
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 30 Jan 2023 03:20:23 +0000 (03:20 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 30 Jan 2023 03:20:23 +0000 (03:20 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/networkd/daemon.c

index 3aee8caf378c2fecf53cd5ade4fae4e5c610d495..bd5f1f0031121c4acaaee3c84abc96adbddbaafe 100644 (file)
 #include <systemd/sd-event.h>
 
 #include "bus.h"
+#include "config.h"
 #include "daemon.h"
 #include "logging.h"
 
 struct nw_daemon {
        int nrefs;
 
+       struct nw_config* config;
+
        // Event Loop
        sd_event* loop;
 
@@ -105,6 +108,11 @@ static int nw_daemon_setup_loop(struct nw_daemon* daemon) {
 static int nw_daemon_setup(struct nw_daemon* daemon) {
        int r;
 
+       // Read configuration file
+       r = nw_config_read(&daemon->config, "/etc/network/settings");
+       if (r)
+               return r;
+
        // Setup the event loop
        r = nw_daemon_setup_loop(daemon);
        if (r)
@@ -145,6 +153,8 @@ ERROR:
 }
 
 static void nw_daemon_free(struct nw_daemon* daemon) {
+       if (daemon->config)
+               nw_config_unref(daemon->config);
        if (daemon->bus)
                sd_bus_unref(daemon->bus);
        if (daemon->loop)