]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: tweak deletion of routes without nexthop addr
authorSubbaiah Venkata <svenkata@google.com>
Wed, 28 Mar 2012 02:21:29 +0000 (19:21 -0700)
committerAvneesh Sachdev <avneesh@opensourcerouting.org>
Sat, 7 Apr 2012 20:54:24 +0000 (13:54 -0700)
  * zebra/zserv.c

    - zread_ipv4_delete(): Pass a null 'gate' parameter to
      rib_delete_ipv4() if the route being deleted does not specify a
      next hop IP address. We were previously passing a pointer to a
      cleared out IP address.

    - zread_ipv4_add(): Fix indentation.

From: Subbaiah Venkata <svenkata@google.com>
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@diac24.net>
zebra/zserv.c

index dc3d432bd85f6c264d8f13ba354f756b2481b2f4..9e6f6253c7e6dd701a64722e8531142f3084f160 100644 (file)
@@ -786,10 +786,10 @@ zread_ipv4_add (struct zserv *client, u_short length)
            case ZEBRA_NEXTHOP_IPV6:
              stream_forward_getp (s, IPV6_MAX_BYTELEN);
              break;
-      case ZEBRA_NEXTHOP_BLACKHOLE:
-        nexthop_blackhole_add (rib);
-        break;
-           }
+            case ZEBRA_NEXTHOP_BLACKHOLE:
+              nexthop_blackhole_add (rib);
+              break;
+            }
        }
     }
 
@@ -814,7 +814,7 @@ zread_ipv4_delete (struct zserv *client, u_short length)
   int i;
   struct stream *s;
   struct zapi_ipv4 api;
-  struct in_addr nexthop;
+  struct in_addr nexthop, *nexthop_p;
   unsigned long ifindex;
   struct prefix_ipv4 p;
   u_char nexthop_num;
@@ -824,6 +824,7 @@ zread_ipv4_delete (struct zserv *client, u_short length)
   s = client->ibuf;
   ifindex = 0;
   nexthop.s_addr = 0;
+  nexthop_p = NULL;
 
   /* Type, flags, message. */
   api.type = stream_getc (s);
@@ -856,6 +857,7 @@ zread_ipv4_delete (struct zserv *client, u_short length)
              break;
            case ZEBRA_NEXTHOP_IPV4:
              nexthop.s_addr = stream_get_ipv4 (s);
+             nexthop_p = &nexthop;
              break;
            case ZEBRA_NEXTHOP_IPV6:
              stream_forward_getp (s, IPV6_MAX_BYTELEN);
@@ -876,7 +878,7 @@ zread_ipv4_delete (struct zserv *client, u_short length)
   else
     api.metric = 0;
     
-  rib_delete_ipv4 (api.type, api.flags, &p, &nexthop, ifindex,
+  rib_delete_ipv4 (api.type, api.flags, &p, nexthop_p, ifindex,
                   client->rtm_table);
   return 0;
 }