mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
network: move more functions
No functional change. Preparation for later commits.
This commit is contained in:
parent
8bed7c55bf
commit
e1e4cd1eed
@ -1083,46 +1083,6 @@ static int address_configure(
|
||||
return 0;
|
||||
}
|
||||
|
||||
void address_cancel_request(Address *address) {
|
||||
Request req;
|
||||
|
||||
assert(address);
|
||||
assert(address->link);
|
||||
|
||||
if (!address_is_requesting(address))
|
||||
return;
|
||||
|
||||
req = (Request) {
|
||||
.link = address->link,
|
||||
.type = REQUEST_TYPE_ADDRESS,
|
||||
.address = address,
|
||||
};
|
||||
|
||||
request_drop(ordered_set_get(address->link->manager->request_queue, &req));
|
||||
address_cancel_requesting(address);
|
||||
}
|
||||
|
||||
static int static_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
assert(link->static_address_messages > 0);
|
||||
|
||||
link->static_address_messages--;
|
||||
|
||||
r = address_configure_handler_internal(rtnl, m, link, "Failed to set static address");
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
if (link->static_address_messages == 0) {
|
||||
log_link_debug(link, "Addresses set");
|
||||
link->static_addresses_configured = true;
|
||||
link_check_ready(link);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool address_is_ready_to_configure(Link *link, const Address *address) {
|
||||
assert(link);
|
||||
assert(address);
|
||||
@ -1248,6 +1208,27 @@ int link_request_address(
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int static_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
assert(link->static_address_messages > 0);
|
||||
|
||||
link->static_address_messages--;
|
||||
|
||||
r = address_configure_handler_internal(rtnl, m, link, "Failed to set static address");
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
if (link->static_address_messages == 0) {
|
||||
log_link_debug(link, "Addresses set");
|
||||
link->static_addresses_configured = true;
|
||||
link_check_ready(link);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int link_request_static_address(Link *link, Address *address, bool consume) {
|
||||
assert(link);
|
||||
assert(address);
|
||||
@ -1291,6 +1272,25 @@ int link_request_static_addresses(Link *link) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void address_cancel_request(Address *address) {
|
||||
Request req;
|
||||
|
||||
assert(address);
|
||||
assert(address->link);
|
||||
|
||||
if (!address_is_requesting(address))
|
||||
return;
|
||||
|
||||
req = (Request) {
|
||||
.link = address->link,
|
||||
.type = REQUEST_TYPE_ADDRESS,
|
||||
.address = address,
|
||||
};
|
||||
|
||||
request_drop(ordered_set_get(address->link->manager->request_queue, &req));
|
||||
address_cancel_requesting(address);
|
||||
}
|
||||
|
||||
int manager_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message, Manager *m) {
|
||||
_cleanup_(address_freep) Address *tmp = NULL;
|
||||
struct ifa_cacheinfo cinfo;
|
||||
|
@ -1266,49 +1266,6 @@ static int route_configure(
|
||||
return 0;
|
||||
}
|
||||
|
||||
void route_cancel_request(Route *route, Link *link) {
|
||||
Request req;
|
||||
|
||||
assert(route);
|
||||
|
||||
link = route->link ?: link;
|
||||
|
||||
assert(link);
|
||||
|
||||
if (!route_is_requesting(route))
|
||||
return;
|
||||
|
||||
req = (Request) {
|
||||
.link = link,
|
||||
.type = REQUEST_TYPE_ROUTE,
|
||||
.route = route,
|
||||
};
|
||||
|
||||
request_drop(ordered_set_get(link->manager->request_queue, &req));
|
||||
route_cancel_requesting(route);
|
||||
}
|
||||
|
||||
static int static_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
assert(link->static_route_messages > 0);
|
||||
|
||||
link->static_route_messages--;
|
||||
|
||||
r = route_configure_handler_internal(rtnl, m, link, "Could not set route");
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
if (link->static_route_messages == 0) {
|
||||
log_link_debug(link, "Routes set");
|
||||
link->static_routes_configured = true;
|
||||
link_check_ready(link);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int route_is_ready_to_configure(const Route *route, Link *link) {
|
||||
int r;
|
||||
|
||||
@ -1501,6 +1458,27 @@ int link_request_route(
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int static_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
assert(link->static_route_messages > 0);
|
||||
|
||||
link->static_route_messages--;
|
||||
|
||||
r = route_configure_handler_internal(rtnl, m, link, "Could not set route");
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
if (link->static_route_messages == 0) {
|
||||
log_link_debug(link, "Routes set");
|
||||
link->static_routes_configured = true;
|
||||
link_check_ready(link);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int link_request_static_route(Link *link, Route *route) {
|
||||
assert(link);
|
||||
assert(link->manager);
|
||||
@ -1581,6 +1559,28 @@ int link_request_static_routes(Link *link, bool only_ipv4) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void route_cancel_request(Route *route, Link *link) {
|
||||
Request req;
|
||||
|
||||
assert(route);
|
||||
|
||||
link = route->link ?: link;
|
||||
|
||||
assert(link);
|
||||
|
||||
if (!route_is_requesting(route))
|
||||
return;
|
||||
|
||||
req = (Request) {
|
||||
.link = link,
|
||||
.type = REQUEST_TYPE_ROUTE,
|
||||
.route = route,
|
||||
};
|
||||
|
||||
request_drop(ordered_set_get(link->manager->request_queue, &req));
|
||||
route_cancel_requesting(route);
|
||||
}
|
||||
|
||||
static int process_route_one(
|
||||
Manager *manager,
|
||||
Link *link,
|
||||
|
Loading…
Reference in New Issue
Block a user