]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: fix clang-SA warning
authorDavid Lamparter <equinox@diac24.net>
Wed, 12 Jun 2019 20:32:30 +0000 (22:32 +0200)
committerDavid Lamparter <equinox@diac24.net>
Thu, 13 Jun 2019 11:35:33 +0000 (13:35 +0200)
Signed-off-by: David Lamparter <equinox@diac24.net>
ospfd/ospf_spf.c

index 296a05bdf141ca5d769c447add2802a34b9e5d71..f5fe51d54704d88f6d0543dd12265fd29c7ebd2f 100644 (file)
@@ -879,6 +879,9 @@ static void ospf_spf_next(struct vertex *v, struct ospf *ospf,
                                          "Invalid LSA link type %d", type);
                                continue;
                        }
+
+                       /* step (d) below */
+                       distance = v->distance + ntohs(l->m[0].metric);
                } else {
                        /* In case of V is Network-LSA. */
                        r = (struct in_addr *)p;
@@ -892,6 +895,9 @@ static void ospf_spf_next(struct vertex *v, struct ospf *ospf,
                                        zlog_debug("found Router LSA %s",
                                                   inet_ntoa(w_lsa->data->id));
                        }
+
+                       /* step (d) below */
+                       distance = v->distance;
                }
 
                /* (b cont.) If the LSA does not exist, or its LS age is equal
@@ -929,11 +935,7 @@ static void ospf_spf_next(struct vertex *v, struct ospf *ospf,
                   vertex V and the advertised cost of the link between vertices
                   V and W.  If D is: */
 
-               /* calculate link cost D. */
-               if (v->lsa->type == OSPF_ROUTER_LSA)
-                       distance = v->distance + ntohs(l->m[0].metric);
-               else /* v is not a Router-LSA */
-                       distance = v->distance;
+               /* calculate link cost D -- moved above */
 
                /* Is there already vertex W in candidate list? */
                if (w_lsa->stat == LSA_SPF_NOT_EXPLORED) {