From 76c5a0f27bb578b9069d779eed72f6c4f26976ac Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 5 May 2021 22:46:44 +0900 Subject: network: use request queue to configure addresses, routes, and nexthops Why is this necessary? Several examples below. - When a route sets prefsrc, then the address must be already assigned (see issue #19285), and also it must be ready if IPv6. - When a route or nexthop sets gateway, then the address must be reachable. - When a route sets nexthop ID, then the corresponding nexthop must be assigned. - When a route sets multipath routes on another interface, then the interface must exist and be ready to configure. - When configuring address, the same address must not be under removing (see issue #18108). Etc,. etc,... So, this makes all requests about addresses, routes, and nethops are once stored in the queue, and will be processed when they are ready to configure. Fixes #18108 and #19285. --- src/network/networkd-queue.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/network/networkd-queue.c') diff --git a/src/network/networkd-queue.c b/src/network/networkd-queue.c index c515e79716..3b9d17651e 100644 --- a/src/network/networkd-queue.c +++ b/src/network/networkd-queue.c @@ -10,9 +10,18 @@ static void request_free_object(RequestType type, void *object) { switch(type) { + case REQUEST_TYPE_ADDRESS: + address_free(object); + break; case REQUEST_TYPE_NEIGHBOR: neighbor_free(object); break; + case REQUEST_TYPE_NEXTHOP: + nexthop_free(object); + break; + case REQUEST_TYPE_ROUTE: + route_free(object); + break; case REQUEST_TYPE_ROUTING_POLICY_RULE: routing_policy_rule_free(object); break; @@ -107,9 +116,18 @@ int manager_process_requests(sd_event_source *s, void *userdata) { ORDERED_SET_FOREACH(req, manager->request_queue) { switch(req->type) { + case REQUEST_TYPE_ADDRESS: + r = request_process_address(req); + break; case REQUEST_TYPE_NEIGHBOR: r = request_process_neighbor(req); break; + case REQUEST_TYPE_NEXTHOP: + r = request_process_nexthop(req); + break; + case REQUEST_TYPE_ROUTE: + r = request_process_route(req); + break; case REQUEST_TYPE_ROUTING_POLICY_RULE: r = request_process_routing_policy_rule(req); break; -- cgit v1.2.1