]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_rnh.c
Merge remote-tracking branch 'origin/cmaster' into cmaster-next
[mirror_frr.git] / zebra / zebra_rnh.c
index fdb187a23a6db089d76d37c19106084b904f0bfe..8df9277cb34c74b9e8f29e66a6af55c2111fc976 100644 (file)
@@ -543,31 +543,28 @@ zebra_rnh_process_static_routes (vrf_id_t vrfid, int family,
       RNODE_FOREACH_RIB(static_rn, srib)
         {
           if (srib->type == ZEBRA_ROUTE_STATIC)
-            break; /* currently works for only 1 static route. */
-        }
+            continue;
 
-      if (!srib) // unexpected
-        continue;
+         /* Set the filter flag for the correct nexthop - static route may
+          * be having multiple. We care here only about registered nexthops.
+          */
+         for (nexthop = srib->nexthop; nexthop; nexthop = nexthop->next)
+           {
+             switch (nexthop->type)
+               {
+               case NEXTHOP_TYPE_IPV4:
+               case NEXTHOP_TYPE_IPV4_IFINDEX:
+                 if (nexthop->gate.ipv4.s_addr == nrn->p.u.prefix4.s_addr)
+                   {
+                     if (num_resolving_nh)
+                       UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FILTERED);
+                     else
+                       SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FILTERED);
+                   }
+                 break;
+               case NEXTHOP_TYPE_IPV6:
+               case NEXTHOP_TYPE_IPV6_IFINDEX:
 
-      /* Set the filter flag for the correct nexthop - static route may
-       * be having multiple. We care here only about registered nexthops.
-       */
-      for (nexthop = srib->nexthop; nexthop; nexthop = nexthop->next)
-        {
-          switch (nexthop->type)
-            {
-            case NEXTHOP_TYPE_IPV4:
-            case NEXTHOP_TYPE_IPV4_IFINDEX:
-              if (nexthop->gate.ipv4.s_addr == nrn->p.u.prefix4.s_addr)
-                {
-                  if (num_resolving_nh)
-                    UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FILTERED);
-                  else
-                    SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FILTERED);
-                }
-              break;
-            case NEXTHOP_TYPE_IPV6:
-            case NEXTHOP_TYPE_IPV6_IFINDEX:
               if (memcmp(&nexthop->gate.ipv6,&nrn->p.u.prefix6, 16) == 0)
                 {
                   if (num_resolving_nh)
@@ -581,20 +578,22 @@ zebra_rnh_process_static_routes (vrf_id_t vrfid, int family,
             }
         }
 
-      if (IS_ZEBRA_DEBUG_NHT)
-        {
-          prefix2str(&static_rn->p, bufs, INET6_ADDRSTRLEN);
-          if (prn && rib)
-            zlog_debug("%u:%s: NH change %s, scheduling static route %s",
-                       vrfid, bufn, num_resolving_nh ?
-                        "" : "(filtered by route-map)", bufs);
-          else
-            zlog_debug("%u:%s: NH unreachable, scheduling static route %s",
-                       vrfid, bufn, bufs);
+         if (IS_ZEBRA_DEBUG_NHT)
+           {
+             prefix2str(&static_rn->p, bufs, INET6_ADDRSTRLEN);
+             if (prn && rib)
+               zlog_debug("%u:%s: NH change %s, scheduling static route %s",
+                          vrfid, bufn, num_resolving_nh ?
+                          "" : "(filtered by route-map)", bufs);
+             else
+               zlog_debug("%u:%s: NH unreachable, scheduling static route %s",
+                          vrfid, bufn, bufs);
+           }
+
+          SET_FLAG(srib->status, RIB_ENTRY_CHANGED);
+          SET_FLAG(srib->status, RIB_ENTRY_NEXTHOPS_CHANGED);
         }
 
-      SET_FLAG(srib->status, RIB_ENTRY_CHANGED);
-      SET_FLAG(srib->status, RIB_ENTRY_NEXTHOPS_CHANGED);
       rib_queue_add(static_rn);
     }
 }