]> git.ipfire.org Git - network.git/commitdiff
networkd: Only add link if we created it
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 Feb 2023 09:53:47 +0000 (09:53 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 Feb 2023 09:53:47 +0000 (09:53 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/networkd/link.c

index b6ece825929b9cd90db683693b886255ebd4b12a..32a66cdf04873579b818eb0194399e39c372f099 100644 (file)
@@ -159,15 +159,15 @@ int nw_link_process(sd_netlink* rtnl, sd_netlink_message* message, void* data) {
                                        ERROR("Could not create link: %m\n");
                                        goto ERROR;
                                }
+
+                               // Add it to the list
+                               r = nw_links_add_link(links, link);
+                               if (r)
+                                       goto ERROR;
                        }
 
                        // TODO Import any data from the netlink message
 
-                       // Add it to the list
-                       r = nw_links_add_link(links, link);
-                       if (r)
-                               goto ERROR;
-
                        break;
 
                case RTM_DELLINK: