]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
route: Don't change them when exiting with persistence.
authorRoy Marples <roy@marples.name>
Tue, 30 Sep 2025 08:41:18 +0000 (09:41 +0100)
committerRoy Marples <roy@marples.name>
Tue, 30 Sep 2025 08:42:11 +0000 (09:42 +0100)
If an interface stops, it might affect the routing priority.
When dhcpcd is exiting we want to avoid this behaviour to keep
the system running as best as.

src/route.c

index 57f9b187935765783f6e2e969b6866ac5ea52358..a31c4f730e09c62d7c6c716e53dac2fda7b8e40d 100644 (file)
@@ -758,6 +758,12 @@ rt_build(struct dhcpcd_ctx *ctx, int af)
        struct rt *rt, *rtn;
        unsigned long long o;
 
+       /* When exiting with persistence, don't change any routing
+        * which maybe affected by interfaces stopping. */
+       if ((ctx->options & (DHCPCD_EXITING | DHCPCD_PERSISTENT)) ==
+           (DHCPCD_EXITING | DHCPCD_PERSISTENT))
+               return;
+
        rb_tree_init(&routes, &rt_compare_proto_ops);
        rb_tree_init(&added, &rt_compare_os_ops);
        rb_tree_init(&kroutes, &rt_compare_os_ops);