]> git.proxmox.com Git - mirror_frr.git/commitdiff
ldpd: improve processing of redistributed routes
authorRenato Westphal <renato@opensourcerouting.org>
Wed, 29 Nov 2017 20:30:26 +0000 (18:30 -0200)
committerRenato Westphal <renato@opensourcerouting.org>
Wed, 29 Nov 2017 22:39:23 +0000 (20:39 -0200)
ldpd should ignore blackhole routes and any other route that doesn't
have a nexthop address (connected routes being an exception).

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

index e703a9ff61adad1896e7c36e45f43b3e775ecf4e..a12a4b913ee45d5dc7d3ddf37fae73b487162de9 100644 (file)
@@ -450,18 +450,38 @@ ldp_zebra_read_route(int command, struct zclient *zclient, zebra_size_t length,
        /* loop through all the nexthops */
        for (i = 0; i < api.nexthop_num; i++) {
                api_nh = &api.nexthops[i];
-
-               switch (kr.af) {
-               case AF_INET:
+               switch (api_nh->type) {
+               case NEXTHOP_TYPE_IPV4:
+                       if (kr.af != AF_INET)
+                               continue;
+                       kr.nexthop.v4 = api_nh->gate.ipv4;
+                       kr.ifindex = 0;
+                       break;
+               case NEXTHOP_TYPE_IPV4_IFINDEX:
+                       if (kr.af != AF_INET)
+                               continue;
                        kr.nexthop.v4 = api_nh->gate.ipv4;
+                       kr.ifindex = api_nh->ifindex;
                        break;
-               case AF_INET6:
+               case NEXTHOP_TYPE_IPV6:
+                       if (kr.af != AF_INET6)
+                               continue;
                        kr.nexthop.v6 = api_nh->gate.ipv6;
+                       kr.ifindex = 0;
                        break;
-               default:
+               case NEXTHOP_TYPE_IPV6_IFINDEX:
+                       if (kr.af != AF_INET6)
+                               continue;
+                       kr.nexthop.v6 = api_nh->gate.ipv6;
+                       kr.ifindex = api_nh->ifindex;
+                       break;
+               case NEXTHOP_TYPE_IFINDEX:
+                       if (!(kr.flags & F_CONNECTED))
+                               continue;
                        break;
+               default:
+                       continue;
                }
-               kr.ifindex = api_nh->ifindex;;
 
                debug_zebra_in("route %s %s/%d nexthop %s ifindex %u (%s)",
                    (add) ? "add" : "delete", log_addr(kr.af, &kr.prefix),