]> git.ipfire.org Git - network.git/commitdiff
daemon: Don't crash when a port could not be loaded
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 8 Jun 2023 16:46:12 +0000 (16:46 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 8 Jun 2023 16:47:36 +0000 (16:47 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/networkd/ports.c

index f0a3ebbc878ac8642e6095e198ad03eb53714fad..65545e813c12050b832134c8b9384925c80387ab 100644 (file)
@@ -152,8 +152,20 @@ static int __nw_ports_enumerate(const char* path, const struct stat* s, void* da
 
        // Create a new port
        r = nw_port_create_from_config(&port, ports->daemon, name, path);
-       if (r)
-               goto ERROR;
+       switch (r) {
+               // All okay
+               case 0:
+                       break;
+
+               // Invalid configuration
+               case 1:
+                       ERROR("Could not open port %s\n", name);
+                       r = 0;
+                       goto ERROR;
+
+               default:
+                       goto ERROR;
+       }
 
        // Add the port to the list
        r = nw_ports_add_port(ports, port);