]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d: Set metric from default values when route-map metric not present
authorYash Ranjan <ranjany@vmware.com>
Wed, 2 Jun 2021 12:45:18 +0000 (05:45 -0700)
committermergify-bot <noreply@mergify.io>
Thu, 22 Jul 2021 22:44:47 +0000 (22:44 +0000)
For redistribute commands if route map is set, then route takes it's metric
values from the route map. But in the case that routemap is set but the
metric for the route map is not, then the route metric is set to type-1.

Check if the metric is set for the routemap. If not then set it as per
redistributed default values (type 2)

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
(cherry picked from commit f84504e686aa52591e0a3c211cfd1b5afe324756)

ospf6d/ospf6_asbr.c

index afdacefc7d4ff27117f87a2b1efb25ddc2876845..dab3a79fd962ac06a572e8caba2f623605227bc1 100644 (file)
@@ -1238,8 +1238,13 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
                        if (troute.path.metric_type)
                                match->path.metric_type =
                                        troute.path.metric_type;
+                       else
+                               match->path.metric_type =
+                                       metric_type(ospf6, type, 0);
                        if (troute.path.cost)
                                match->path.cost = troute.path.cost;
+                       else
+                               match->path.cost = metric_value(ospf6, type, 0);
                        if (!IN6_IS_ADDR_UNSPECIFIED(&tinfo.forwarding))
                                memcpy(&info->forwarding, &tinfo.forwarding,
                                       sizeof(struct in6_addr));
@@ -1295,8 +1300,12 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
        if (ROUTEMAP(red)) {
                if (troute.path.metric_type)
                        route->path.metric_type = troute.path.metric_type;
+               else
+                       route->path.metric_type = metric_type(ospf6, type, 0);
                if (troute.path.cost)
                        route->path.cost = troute.path.cost;
+               else
+                       route->path.cost = metric_value(ospf6, type, 0);
                if (!IN6_IS_ADDR_UNSPECIFIED(&tinfo.forwarding))
                        memcpy(&info->forwarding, &tinfo.forwarding,
                               sizeof(struct in6_addr));