]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/nexthop: ignore foreign nexthops when ManageForeignNextHops=no
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 28 Nov 2024 19:14:56 +0000 (04:14 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 11 Dec 2024 02:21:14 +0000 (11:21 +0900)
src/network/networkd-nexthop.c

index ab4bafba50d702e50d14a29786e49245d7aee9b5..e27ecf05f986ce0762e7af4baba07d4186fb041b 100644 (file)
@@ -1144,6 +1144,11 @@ int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message,
 
         /* If we did not know the nexthop, then save it. */
         if (!nexthop) {
+                if (!req && !m->manage_foreign_nexthops) {
+                        log_nexthop_debug(&(const NextHop) { .id = id }, "Ignoring received", m);
+                        return 0;
+                }
+
                 r = nexthop_add_new(m, id, &nexthop);
                 if (r < 0) {
                         log_warning_errno(r, "Failed to add received nexthop, ignoring: %m");