summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-08-09 09:13:33 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-08-09 09:17:20 -0400
commitf19435a8b432bbeddf484df54b02e2bd3e847350 (patch)
tree3d7a3668a2ef6341f09648a9f87e3b9b92fb84e2 /zebra/zebra_rib.c
parent9cdce038c51d259e4416c3e2f15d70e76c5e176f (diff)
zebra: Pay attention to metric from kernel
When the linux kernel adds/deletes routes, the metric is important, but our routing protocols add/delete in a slightly different manner, so allow kernel metrics to match so that our rib matches the kernel's fib. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index e61c2e7b0e..ed53554265 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2274,7 +2274,8 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
u_short instance, int flags, struct prefix *p,
struct prefix_ipv6 *src_p, union g_addr *gate,
- ifindex_t ifindex, u_int32_t table_id)
+ ifindex_t ifindex, u_int32_t table_id,
+ u_int32_t metric)
{
struct route_table *table;
struct route_node *rn;
@@ -2328,6 +2329,9 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
continue;
if (re->instance != instance)
continue;
+ if (re->type == ZEBRA_ROUTE_KERNEL &&
+ re->metric != metric)
+ continue;
if (re->type == ZEBRA_ROUTE_CONNECT && (nexthop = re->nexthop)
&& nexthop->type == NEXTHOP_TYPE_IFINDEX) {
if (nexthop->ifindex != ifindex)
@@ -2468,6 +2472,9 @@ int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
continue;
if (re->instance != instance)
continue;
+ if (re->type == ZEBRA_ROUTE_KERNEL &&
+ re->metric != metric)
+ continue;
if (!RIB_SYSTEM_ROUTE(re)) {
same = re;
break;