]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: Fix connected route nexthop fix from 66f5152f
authorMartin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
Fri, 8 Jun 2018 16:26:39 +0000 (18:26 +0200)
committerMartin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
Fri, 8 Jun 2018 16:29:04 +0000 (18:29 +0200)
Fix a couple of problems in my 1st fix for PIM nexthops reachable via a
connected route:

Use NEXTHOP_TYPE_IPV4_IFINDEX instead of NEXTHOP_TYPE_IPV4 since we add an
IPv4 address to an already known ifindex.

Assign nexthop_tab[num_ifindex].protocol_distance and .route_metric before
incrementing num_ifindex.

Revert the default: to individual switch case statement conversion in
zclient_read_nexthop() as requested by donaldsharp in #2347

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
pimd/pim_nht.c
pimd/pim_zlookup.c

index 3cbd11a9ae2a44be70fc1cc5f285e89ed0976bdb..fa6486a83e76312b406e2f9626809d85aa4044b8 100644 (file)
@@ -667,7 +667,7 @@ int pim_parse_nexthop_update(int command, struct zclient *zclient,
                                 * RPF address from nexthop cache (i.e.
                                 * destination) as PIM nexthop.
                                 */
-                               nexthop->type = NEXTHOP_TYPE_IPV4;
+                               nexthop->type = NEXTHOP_TYPE_IPV4_IFINDEX;
                                nexthop->gate.ipv4 =
                                        pnc->rpf.rpf_addr.u.prefix4;
                                break;
index 9295b231cb0236ac97cc7428f1d20c32b150d8d2..fb616e1b0dda8ea586c9993c3834516471a06c9a 100644 (file)
@@ -215,6 +215,8 @@ static int zclient_read_nexthop(struct pim_instance *pim,
                                tab_size, addr_str, pim->vrf->name);
                        return num_ifindex;
                }
+               nexthop_tab[num_ifindex].protocol_distance = distance;
+               nexthop_tab[num_ifindex].route_metric = metric;
                switch (nexthop_type) {
                case NEXTHOP_TYPE_IFINDEX:
                        nexthop_tab[num_ifindex].ifindex = stream_getl(s);
@@ -276,13 +278,19 @@ static int zclient_read_nexthop(struct pim_instance *pim,
                        }
                        ++num_ifindex;
                        break;
-               case NEXTHOP_TYPE_IPV6:
-               case NEXTHOP_TYPE_BLACKHOLE:
-                       /* ignore */
-                       continue;
+               default:
+                       /* do nothing */
+                       {
+                               char addr_str[INET_ADDRSTRLEN];
+                               pim_inet4_dump("<addr?>", addr, addr_str,
+                                              sizeof(addr_str));
+                               zlog_warn(
+                                       "%s: found non-ifindex nexthop type=%d for address %s(%s)",
+                                       __PRETTY_FUNCTION__, nexthop_type,
+                                       addr_str, pim->vrf->name);
+                       }
+                       break;
                }
-               nexthop_tab[num_ifindex].protocol_distance = distance;
-               nexthop_tab[num_ifindex].route_metric = metric;
        }
 
        return num_ifindex;