network/route: convert route before requesting
Previously, 1. use the passed Route object as is when a route is requested, 2. when the route becomes ready to configure, convert the Route object if necessary, to resolve outgoing interface name, and split multipath routes, and save them to the associated interfaces, 3. configure the route with the passed Route object. However, there are several inconsistencies with what kernel does: - The kernel does not merge nor split IPv4 multipath routes. However, we unconditionally split multipath routes to manage. - The kernel does not set gateway or so to a route if it has nexthop ID. Fortunately, I do not find any issues caused by the inconsistencies. But for safety, let's manage routes in a consistent way with the kernel. This makes, 1. when a route is requested, split IPv6 multipath routes, but keep IPv4 multipath routes as is, and queue (possibly multiple) requests for the route. 2. when the route becomes ready to configure, resolve nexthop and interface name, and requeue request if necessary. 3. configure the (possibly split) route. By using the logic, - Now we manage routes in a mostly consistent way with the kernel. - We can drop ConvertedRoutes object. - Hopefully the code becomes much simpler.
This commit is contained in:
@@ -58,7 +58,7 @@ static void request_hash_func(const Request *req, struct siphash *state) {
|
||||
|
||||
siphash24_compress_typesafe(req->type, state);
|
||||
|
||||
if (req->type != REQUEST_TYPE_NEXTHOP) {
|
||||
if (!IN_SET(req->type, REQUEST_TYPE_NEXTHOP, REQUEST_TYPE_ROUTE)) {
|
||||
siphash24_compress_boolean(req->link, state);
|
||||
if (req->link)
|
||||
siphash24_compress_typesafe(req->link->ifindex, state);
|
||||
@@ -81,7 +81,7 @@ static int request_compare_func(const struct Request *a, const struct Request *b
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
if (a->type != REQUEST_TYPE_NEXTHOP) {
|
||||
if (!IN_SET(a->type, REQUEST_TYPE_NEXTHOP, REQUEST_TYPE_ROUTE)) {
|
||||
r = CMP(!!a->link, !!b->link);
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
Reference in New Issue
Block a user