summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zebra/rt.h2
-rw-r--r--zebra/rt_netlink.c2
-rw-r--r--zebra/rt_netlink.h1
-rw-r--r--zebra/zebra_rib.c20
4 files changed, 19 insertions, 6 deletions
diff --git a/zebra/rt.h b/zebra/rt.h
index d8a22d2cfc..4cf4c9d780 100644
--- a/zebra/rt.h
+++ b/zebra/rt.h
@@ -35,6 +35,8 @@
extern "C" {
#endif
+#define ROUTE_INSTALLATION_METRIC 20
+
#define RKERNEL_ROUTE(type) ((type) == ZEBRA_ROUTE_KERNEL)
#define RSYSTEM_ROUTE(type) \
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 39ec003047..1a090c78e3 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -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)
diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h
index b67169d6f0..351f98a2ca 100644
--- a/zebra/rt_netlink.h
+++ b/zebra/rt_netlink.h
@@ -30,7 +30,6 @@
extern "C" {
#endif
-#define NL_DEFAULT_ROUTE_METRIC 20
/*
* Additional protocol strings to push into routes
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index fcffb500e9..81910f68b7 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -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 */