]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: fix installation of LDP labels on static routes
authorRenato Westphal <renato@opensourcerouting.org>
Tue, 7 Feb 2017 11:47:37 +0000 (09:47 -0200)
committerRenato Westphal <renato@opensourcerouting.org>
Tue, 7 Feb 2017 12:22:30 +0000 (10:22 -0200)
If the ifindex of a nexthop is not zero, we can't assume that its type is
NEXTHOP_TYPE_IPV4_IFINDEX or NEXTHOP_TYPE_IPV6_IFINDEX. Nexthops of type
NEXTHOP_TYPE_IPV[46] can have their ifindex set by the nexthop_active()
function.

With that said, we need to me more flexible when comparing nexthops
on mpls_ftn_update() to make sure that we'll always find the correct
route/nexthop to update.

Regression introduced by commit 88d88a ("zebra/ldpd: allow MPLS ECMP on
unnumbered interfaces") and found by ANVL.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
zebra/zebra_mpls.c

index decf3f5f8df41aee3bea4fdc2abf4326d470a845..56a6ca7afa0bcf8904473bec1c02622d6e2f01d8 100644 (file)
@@ -1308,22 +1308,26 @@ mpls_ftn_update (int add, struct zebra_vrf *zvrf, enum lsp_types_t type,
 
   for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
     {
-      if (nexthop->type != gtype)
-       continue;
-      switch (gtype)
+      switch (nexthop->type)
        {
        case NEXTHOP_TYPE_IPV4:
        case NEXTHOP_TYPE_IPV4_IFINDEX:
+         if (gtype != NEXTHOP_TYPE_IPV4 && gtype != NEXTHOP_TYPE_IPV4_IFINDEX)
+           continue;
          if (! IPV4_ADDR_SAME (&nexthop->gate.ipv4, &gate->ipv4))
            continue;
-         if (gtype == NEXTHOP_TYPE_IPV4_IFINDEX && nexthop->ifindex != ifindex)
+         if (nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX &&
+             nexthop->ifindex != ifindex)
            continue;
          goto found;
        case NEXTHOP_TYPE_IPV6:
        case NEXTHOP_TYPE_IPV6_IFINDEX:
+         if (gtype != NEXTHOP_TYPE_IPV6 && gtype != NEXTHOP_TYPE_IPV6_IFINDEX)
+           continue;
          if (! IPV6_ADDR_SAME (&nexthop->gate.ipv6, &gate->ipv6))
            continue;
-         if (gtype == NEXTHOP_TYPE_IPV6_IFINDEX && nexthop->ifindex != ifindex)
+         if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX &&
+             nexthop->ifindex != ifindex)
            continue;
          goto found;
        default: