Browse Source

ripd & ripngd: avoid the zero interface metric

The interface metric is initialized to 0 in the commit db19c85:
zebra: set metric for directly connected routes via netlink to 0

Ripd and ripngd must be aware of it and avoid increase the
route metric by 0.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Lu Feng 5 years ago
parent
commit
7b3b98ae3e
2 changed files with 2 additions and 2 deletions
  1. 1 1
      ripd/ripd.c
  2. 1 1
      ripngd/ripngd.c

+ 1 - 1
ripd/ripd.c

@@ -433,7 +433,7 @@ rip_rte_process (struct rte *rte, struct sockaddr_in *from,
   /* If offset-list does not modify the metric use interface's
      metric. */
   if (!ret)
-    rte->metric += ifp->metric;
+    rte->metric += ifp->metric ? ifp->metric : 1;
 
   if (rte->metric > RIP_METRIC_INFINITY)
     rte->metric = RIP_METRIC_INFINITY;

+ 1 - 1
ripngd/ripngd.c

@@ -717,7 +717,7 @@ ripng_route_process (struct rte *rte, struct sockaddr_in6 *from,
   /* If offset-list does not modify the metric use interface's
    * one. */
   if (! ret)
-    rte->metric += ifp->metric;
+    rte->metric += ifp->metric ? ifp->metric : 1;
 
   if (rte->metric > RIPNG_METRIC_INFINITY)
     rte->metric = RIPNG_METRIC_INFINITY;