network/route: relocate route_type_is_reject() and friends
No functional change, preparation for later commits.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user