]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: interface speed change during intf add 2908/head
authorChirag Shah <chirag@cumulusnetworks.com>
Fri, 24 Aug 2018 22:15:36 +0000 (15:15 -0700)
committerChirag Shah <chirag@cumulusnetworks.com>
Fri, 24 Aug 2018 22:26:42 +0000 (15:26 -0700)
The problem is seen where speed mismatch caused ECMP route
not being reflected with correct number paths (NHs).

During cold boot, some interface speed updated by zebra as
part of one shot timer and triggers interface add to clients.
In this case, ospf already have created interface (bond interface),
but speed was not updated, trigger to do interface speed change
as part of interface add, which will trigger all Router LSA to
use updated speed into cost calculation.

Ticket:CM-22170
Testing Done:
Bring up CLOS config with Spine and leafs. Leaf have CLAG pair,
with same VRR ip address.
At spine one of the bond connecting to leaf node was having
higher speed than the paired device, With this fix, at spine (DUT)
bond interface speed is equal from all peer nodes.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
ospfd/ospf_ase.c
ospfd/ospf_zebra.c

index d84fd26ac4af74b90d1e3f2640d9ed907cae964e..0221d1e1b272afa7d13bb59ec02cc26412ce2674 100644 (file)
@@ -288,6 +288,7 @@ int ospf_ase_calculate_route(struct ospf *ospf, struct ospf_lsa *lsa)
        struct prefix_ipv4 asbr, p;
        struct route_node *rn;
        struct ospf_route *new, * or ;
+       char buf1[INET_ADDRSTRLEN];
        int ret;
 
        assert(lsa);
@@ -304,10 +305,14 @@ int ospf_ase_calculate_route(struct ospf *ospf, struct ospf_lsa *lsa)
                return 0;
        }
 
-       if (IS_DEBUG_OSPF(lsa, LSA))
+       if (IS_DEBUG_OSPF(lsa, LSA)) {
+               snprintf(buf1, INET_ADDRSTRLEN, "%s",
+                        inet_ntoa(al->header.adv_router));
                zlog_debug(
-                       "Route[External]: Calculate AS-external-LSA to %s/%d",
-                       inet_ntoa(al->header.id), ip_masklen(al->mask));
+                       "Route[External]: Calculate AS-external-LSA to %s/%d adv_router %s",
+                       inet_ntoa(al->header.id), ip_masklen(al->mask), buf1);
+       }
+
        /* (1) If the cost specified by the LSA is LSInfinity, or if the
               LSA's LS age is equal to MaxAge, then examine the next LSA. */
        if ((metric = GET_METRIC(al->e[0].metric)) >= OSPF_LS_INFINITY) {
@@ -459,8 +464,9 @@ int ospf_ase_calculate_route(struct ospf *ospf, struct ospf_lsa *lsa)
 
        if (!rn || (or = rn->info) == NULL) {
                if (IS_DEBUG_OSPF(lsa, LSA))
-                       zlog_debug("Route[External]: Adding a new route %s/%d",
-                                  inet_ntoa(p.prefix), p.prefixlen);
+                       zlog_debug("Route[External]: Adding a new route %s/%d with paths %u",
+                                  inet_ntoa(p.prefix), p.prefixlen,
+                                  listcount(asbr_route->paths));
 
                ospf_route_add(ospf->new_external_route, &p, new, asbr_route);
 
index 0a7776cced054c5dac2eb563530f0e3c80c46b7f..8c94a8ef9949bde227fa446aa0b05d7014a7e82e 100644 (file)
@@ -111,10 +111,11 @@ static int ospf_interface_add(int command, struct zclient *zclient,
 
        if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
                zlog_debug(
-                       "Zebra: interface add %s vrf %s[%u] index %d flags %llx metric %d mtu %d",
+                       "Zebra: interface add %s vrf %s[%u] index %d flags %llx metric %d mtu %d speed %u",
                        ifp->name, ospf_vrf_id_to_name(ifp->vrf_id),
                        ifp->vrf_id, ifp->ifindex,
-                       (unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
+                       (unsigned long long)ifp->flags, ifp->metric, ifp->mtu,
+                       ifp->speed);
 
        assert(ifp->info);
 
@@ -128,6 +129,8 @@ static int ospf_interface_add(int command, struct zclient *zclient,
        if (!ospf)
                return 0;
 
+       ospf_if_recalculate_output_cost(ifp);
+
        ospf_if_update(ospf, ifp);
 
        hook_call(ospf_if_update, ifp);
@@ -448,14 +451,17 @@ void ospf_zebra_add(struct ospf *ospf, struct prefix_ipv4 *p,
                count++;
 
                if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
-                       char buf[2][PREFIX2STR_BUFFER];
+                       char buf[2][INET_ADDRSTRLEN];
+                       struct interface *ifp;
+
+                       ifp = if_lookup_by_index(path->ifindex, ospf->vrf_id);
 
                        zlog_debug(
-                               "Zebra: Route add %s nexthop %s, ifindex=%d",
+                               "Zebra: Route add %s nexthop %s, ifindex=%d %s",
                                prefix2str(p, buf[0], sizeof(buf[0])),
                                inet_ntop(AF_INET, &path->nexthop,
                                          buf[1], sizeof(buf[1])),
-                               path->ifindex);
+                               path->ifindex, ifp ? ifp->name : " ");
                }
        }
        api.nexthop_num = count;