network/route: relocate route_type_is_reject() and friends

No functional change, preparation for later commits.
This commit is contained in:
Yu Watanabe
2024-01-13 10:10:32 +09:00
parent b82697eb20
commit b9f29e9f52
3 changed files with 14 additions and 12 deletions
+6
View 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);
+2
View 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);
+6 -12
View 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;