]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/nexthop: rename nexthop_owned_by_link() -> nexthop_bound_to_link()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 12 Dec 2023 18:20:05 +0000 (03:20 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 14 Dec 2023 09:58:19 +0000 (18:58 +0900)
No functional change.

src/network/networkd-nexthop.c

index 367759f373eb66475d6d2fd1b288c2288a3a6e8d..bcb114094ef38114d98bb2e9dd6ea763326fcb18 100644 (file)
@@ -203,6 +203,11 @@ static int nexthop_dup(const NextHop *src, NextHop **ret) {
         return 0;
 }
 
+static bool nexthop_bound_to_link(const NextHop *nexthop) {
+        assert(nexthop);
+        return !nexthop->blackhole && hashmap_isempty(nexthop->group);
+}
+
 int manager_get_nexthop_by_id(Manager *manager, uint32_t id, NextHop **ret) {
         NextHop *nh;
 
@@ -220,17 +225,13 @@ int manager_get_nexthop_by_id(Manager *manager, uint32_t id, NextHop **ret) {
         return 0;
 }
 
-static bool nexthop_owned_by_link(const NextHop *nexthop) {
-        return !nexthop->blackhole && hashmap_isempty(nexthop->group);
-}
-
 static int nexthop_get(Manager *manager, Link *link, NextHop *in, NextHop **ret) {
         NextHop *nexthop;
         Set *nexthops;
 
         assert(in);
 
-        if (nexthop_owned_by_link(in)) {
+        if (nexthop_bound_to_link(in)) {
                 if (!link)
                         return -ENOENT;
 
@@ -279,7 +280,7 @@ static int nexthop_add(Manager *manager, Link *link, NextHop *nexthop) {
         assert(nexthop);
         assert(nexthop->id > 0);
 
-        if (nexthop_owned_by_link(nexthop)) {
+        if (nexthop_bound_to_link(nexthop)) {
                 assert(link);
 
                 r = set_ensure_put(&link->nexthops, &nexthop_hash_ops, nexthop);
@@ -523,7 +524,7 @@ static bool nexthop_is_ready_to_configure(Link *link, const NextHop *nexthop) {
         if (!link_is_ready_to_configure(link, false))
                 return false;
 
-        if (nexthop_owned_by_link(nexthop)) {
+        if (nexthop_bound_to_link(nexthop)) {
                 /* TODO: fdb nexthop does not require IFF_UP. The conditions below needs to be updated
                  * when fdb nexthop support is added. See rtm_to_nh_config() in net/ipv4/nexthop.c of
                  * kernel. */
@@ -959,7 +960,7 @@ int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message,
 
         /* All blackhole or group nexthops are managed by Manager. Note that the linux kernel does not
          * set NHA_OID attribute when NHA_BLACKHOLE or NHA_GROUP is set. Just for safety. */
-        if (!nexthop_owned_by_link(tmp))
+        if (!nexthop_bound_to_link(tmp))
                 link = NULL;
 
         (void) nexthop_get(m, link, tmp, &nexthop);