]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/route: relocate route_type_is_reject() and friends
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 13 Jan 2024 01:05:29 +0000 (10:05 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 13 Jan 2024 01:10:32 +0000 (10:10 +0900)
No functional change, preparation for later commits.

src/network/networkd-route-util.c
src/network/networkd-route-util.h
src/network/networkd-route.c

index d49a0b95124a2cac1295f809c372eea12085b09f..00c267e6924e1213854cf3298b8bbd277661976f 100644 (file)
@@ -39,6 +39,12 @@ unsigned routes_max(void) {
         return cached;
 }
 
+bool route_type_is_reject(const Route *route) {
+        assert(route);
+
+        return IN_SET(route->type, RTN_UNREACHABLE, RTN_PROHIBIT, RTN_BLACKHOLE, RTN_THROW);
+}
+
 static bool route_lifetime_is_valid(const Route *route) {
         assert(route);
 
index f326888c9347dd2c9d87ed58966264a054ba26dc..eba823a2d0d5c3a1d23c73f507e4aca46acdb37b 100644 (file)
@@ -13,6 +13,8 @@ typedef struct Route Route;
 
 unsigned routes_max(void);
 
+bool route_type_is_reject(const Route *route);
+
 bool link_find_default_gateway(Link *link, int family, Route **gw);
 static inline bool link_has_default_gateway(Link *link, int family) {
         return link_find_default_gateway(link, family, NULL);
index e5d1baf945d44ee621ddda98216ef15bc3969101..e890d0a2e969284c8ac3c6148e8da62f052c8a49 100644 (file)
@@ -235,18 +235,6 @@ DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(
                 route_compare_func,
                 route_free);
 
-static bool route_type_is_reject(const Route *route) {
-        assert(route);
-
-        return IN_SET(route->type, RTN_UNREACHABLE, RTN_PROHIBIT, RTN_BLACKHOLE, RTN_THROW);
-}
-
-static bool route_needs_convert(const Route *route) {
-        assert(route);
-
-        return route->nexthop_id > 0 || !ordered_set_isempty(route->multipath_routes);
-}
-
 static int route_add(Manager *manager, Link *link, Route *route) {
         int r;
 
@@ -427,6 +415,12 @@ static int converted_routes_new(size_t n, ConvertedRoutes **ret) {
         return 0;
 }
 
+static bool route_needs_convert(const Route *route) {
+        assert(route);
+
+        return route->nexthop_id > 0 || !ordered_set_isempty(route->multipath_routes);
+}
+
 static int route_convert(Manager *manager, const Route *route, ConvertedRoutes **ret) {
         _cleanup_(converted_routes_freep) ConvertedRoutes *c = NULL;
         int r;