]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd, zebra: Pass the ifindex for NEXTHOP_TYPE_IPV4
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 14 Sep 2016 23:17:54 +0000 (19:17 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:09 +0000 (20:26 -0500)
NEXTHOP_TYPE_IPV4 has the ifindex of the route.  Pass it
along so the other side can use it if it is needed.

This will make pim much happier in that we will need to do less
recursive lookups.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_zlookup.c
zebra/zserv.c

index f6490980609e4329aa455c2367d7f6f0fbf5e07f..f81c6e87812ec74308484dc1b4aab4c82d645352 100644 (file)
@@ -233,8 +233,10 @@ static int zclient_read_nexthop(struct zclient *zlookup,
     switch (nexthop_type) {
     case NEXTHOP_TYPE_IFINDEX:
     case NEXTHOP_TYPE_IPV4_IFINDEX:
+    case NEXTHOP_TYPE_IPV4:
       nexthop_tab[num_ifindex].nexthop_addr.family = AF_INET;
-      if (nexthop_type == NEXTHOP_TYPE_IPV4_IFINDEX) {
+      if (nexthop_type == NEXTHOP_TYPE_IPV4_IFINDEX ||
+         nexthop_type == NEXTHOP_TYPE_IPV4) {
        nexthop_tab[num_ifindex].nexthop_addr.u.prefix4.s_addr = stream_get_ipv4(s);
       }
       else {
@@ -245,23 +247,6 @@ static int zclient_read_nexthop(struct zclient *zlookup,
       nexthop_tab[num_ifindex].route_metric      = metric;
       ++num_ifindex;
       break;
-    case NEXTHOP_TYPE_IPV4:
-      nexthop_tab[num_ifindex].nexthop_addr.family = AF_INET;
-      nexthop_tab[num_ifindex].nexthop_addr.u.prefix4.s_addr = stream_get_ipv4(s);
-      nexthop_tab[num_ifindex].ifindex             = 0;
-      nexthop_tab[num_ifindex].protocol_distance   = distance;
-      nexthop_tab[num_ifindex].route_metric        = metric;
-      if (PIM_DEBUG_ZEBRA) {
-       char addr_str[100];
-       char nexthop_str[100];
-       pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
-       pim_addr_dump("<nexthop?>", &nexthop_tab[num_ifindex].nexthop_addr, nexthop_str, sizeof(nexthop_str));
-       zlog_debug("%s %s: zebra returned recursive nexthop %s for address %s",
-                  __FILE__, __PRETTY_FUNCTION__,
-                  nexthop_str, addr_str);
-      }
-      ++num_ifindex;
-      break;
     case NEXTHOP_TYPE_IPV6_IFINDEX:
       nexthop_tab[num_ifindex].nexthop_addr.family = AF_INET6;
       stream_get (&nexthop_tab[num_ifindex].nexthop_addr.u.prefix6, s, 16);
index 44e29a8bb0ae2647f04ad3b2578db317bc908cae..bdfa03e1eee665fb06ff9cb08a2398df4d05cd4d 100644 (file)
@@ -786,8 +786,6 @@ zsend_write_nexthop (struct stream *s, struct nexthop *nexthop)
   switch (nexthop->type)
     {
     case NEXTHOP_TYPE_IPV4:
-      stream_put_in_addr (s, &nexthop->gate.ipv4);
-      break;
     case NEXTHOP_TYPE_IPV4_IFINDEX:
       stream_put_in_addr (s, &nexthop->gate.ipv4);
       stream_putl (s, nexthop->ifindex);