Merge pull request #12604 from donaldsharp/distance_metric_offload_fixes

Distance/metric offload fixes
This commit is contained in:
Russ White 2023-01-18 15:57:48 -05:00 committed by GitHub
commit bb1d52b3c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 6 deletions

View File

@ -35,6 +35,8 @@
extern "C" {
#endif
#define ROUTE_INSTALLATION_METRIC 20
#define RKERNEL_ROUTE(type) ((type) == ZEBRA_ROUTE_KERNEL)
#define RSYSTEM_ROUTE(type) \

View File

@ -2077,7 +2077,7 @@ ssize_t netlink_route_multipath_msg_encode(int cmd,
* by the routing protocol and for communicating with protocol peers.
*/
if (!nl_attr_put32(&req->n, datalen, RTA_PRIORITY,
NL_DEFAULT_ROUTE_METRIC))
ROUTE_INSTALLATION_METRIC))
return 0;
#if defined(SUPPORT_REALMS)

View File

@ -30,7 +30,6 @@
extern "C" {
#endif
#define NL_DEFAULT_ROUTE_METRIC 20
/*
* Additional protocol strings to push into routes

View File

@ -2712,10 +2712,6 @@ static void process_subq_early_route_add(struct zebra_early_route *ere)
if (ere->src_p_provided)
apply_mask_ipv6(&ere->src_p);
/* Set default distance by route type. */
if (re->distance == 0)
re->distance = route_distance(re->type);
/* Lookup route node.*/
rn = srcdest_rnode_get(table, &ere->p,
ere->src_p_provided ? &ere->src_p : NULL);
@ -2762,6 +2758,22 @@ static void process_subq_early_route_add(struct zebra_early_route *ere)
}
}
/* Set default distance by route type. */
if (re->distance == 0) {
if (same && !zebra_router_notify_on_ack())
re->distance = same->distance;
else
re->distance = route_distance(re->type);
}
if (re->metric == ROUTE_INSTALLATION_METRIC &&
CHECK_FLAG(re->flags, ZEBRA_FLAG_SELFROUTE)) {
if (same && !zebra_router_notify_on_ack())
re->metric = same->metric;
else
re->metric = 0;
}
/* If this route is kernel/connected route, notify the dataplane. */
if (RIB_SYSTEM_ROUTE(re)) {
/* Notify dataplane */