]> 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)
committerYash Ranjan <ranjany@vmware.com>
Fri, 18 Jun 2021 11:59:04 +0000 (04:59 -0700)
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>
ospf6d/ospf6_asbr.c

index cc4b220ec86c74c6317ccd9aa7a19fa727efff5d..c17af758b03e42fbe01c377f5a8ee76afde46284 100644 (file)
@@ -1378,8 +1378,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));
@@ -1440,8 +1445,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));