From: Yu Watanabe Date: Thu, 14 Dec 2023 21:35:50 +0000 (+0900) Subject: network/nexthop: check if nexthop is really configured without ID X-Git-Tag: v256-rc1~1419^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F30550%2Fhead;p=thirdparty%2Fsystemd.git network/nexthop: check if nexthop is really configured without ID --- diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c index 4a9c84e5e76..b4c101f2e85 100644 --- a/src/network/networkd-nexthop.c +++ b/src/network/networkd-nexthop.c @@ -251,6 +251,11 @@ static int nexthop_get(Link *link, const NextHop *in, NextHop **ret) { if (nexthop_compare_full(nexthop, in) != 0) continue; + /* Even if the configuration matches, it may be configured with another [NextHop] section + * that has an explicit ID. If so, the assigned nexthop is not the one we are looking for. */ + if (set_contains(link->manager->nexthop_ids, UINT32_TO_PTR(nexthop->id))) + continue; + if (ret) *ret = nexthop; return 0; @@ -307,6 +312,11 @@ static int nexthop_get_request(Link *link, const NextHop *in, Request **ret) { if (nexthop_compare_full(nexthop, in) != 0) continue; + /* Even if the configuration matches, it may be requested by another [NextHop] section + * that has an explicit ID. If so, the request is not the one we are looking for. */ + if (set_contains(link->manager->nexthop_ids, UINT32_TO_PTR(nexthop->id))) + continue; + if (ret) *ret = req; return 0;