]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Revert "zebra: clean up client routes when client goes away"
authorDavid Lamparter <equinox@diac24.net>
Fri, 20 Apr 2012 15:23:39 +0000 (17:23 +0200)
committerDavid Lamparter <equinox@diac24.net>
Fri, 20 Apr 2012 15:29:31 +0000 (17:29 +0200)
This reverts commit af56d404cd56d94ad3b2ec3f159650eb72baef0a,
which was accidentally duplicating functionality from commit
2ea1ab1 "zebra: ZEBRA_HELLO and mopping up routes (BZ#448)"

Conflicts:

zebra/zebra_rib.c

Signed-off-by: David Lamparter <equinox@diac24.net>
zebra/zebra_rib.c
zebra/zserv.c
zebra/zserv.h

index 2fa439c0a136202889b569217c94ef31cf6a6101..154e8d5518ceab81244f0019a1b076f9e2ea22ce 100644 (file)
@@ -2920,62 +2920,6 @@ rib_sweep_route (void)
   rib_sweep_table (vrf_table (AFI_IP, SAFI_UNICAST, 0));
   rib_sweep_table (vrf_table (AFI_IP6, SAFI_UNICAST, 0));
 }
-\f
-/* Delete routes learned from a given client.  */
-/* TODO(wsun) May need to split the sweep process into multiple batches,
- * so that the process won't take too long if the table is large. */
-static void
-rib_sweep_client_table (struct route_table *table, int rib_type)
-{
-  struct route_node *rn;
-  struct rib *rib;
-  struct rib *next;
-  int ret = 0;
-
-  if (table)
-    for (rn = route_top (table); rn; rn = route_next (rn))
-      for (rib = rn->info; rib; rib = next)
-       {
-         next = rib->next;
-
-         if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
-           continue;
-
-         if (rib->type == rib_type)
-            if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
-             {
-                /* TODO(wsun) Is this mandatory? What about graceful restart/
-                 * non-stop forwarding */
-               ret = rib_uninstall_kernel (rn, rib);
-               if (! ret)
-                  rib_delnode (rn, rib);
-                else
-                  zlog_err ("%s: could not delete routes from kernel!",
-                            __func__);
-             }
-            else
-              {
-                /* Always delete the node. */
-                rib_delnode (rn, rib);
-              }
-       }
-}
-
-/* Sweep all routes learned from a given client from RIB tables.  */
-void
-rib_sweep_client_route (struct zserv *client)
-{
-  assert(client);
-  int route_type = client->route_type;
-  if (route_type != ZEBRA_ROUTE_MAX)
-    {
-      zlog_debug ("%s: Removing existing routes from client type %d",
-                  __func__, route_type);
-      rib_sweep_client_table (vrf_table (AFI_IP, SAFI_UNICAST, 0), route_type);
-      rib_sweep_client_table (vrf_table (AFI_IP6, SAFI_UNICAST, 0), route_type);
-    }
-}
-\f
 
 /* Remove specific by protocol routes from 'table'. */
 static unsigned long
index b1f539d3aa1d870eb68868705a3bb934682b1cee..09152170cccd3c05a4f068d1143bf32ccbcacee6 100644 (file)
@@ -741,13 +741,6 @@ zread_ipv4_add (struct zserv *client, u_short length)
   
   /* Type, flags, message. */
   rib->type = stream_getc (s);
-  /* Update client's route type if it is not done yet. */
-  /* It is done here since only zread_ipv4/6_add() and
-   * zread_ipv4/6_delete() decode Zebra messages and retrieve
-   * route types. */
-  if (client->route_type == ZEBRA_ROUTE_MAX)
-    client->route_type = rib->type;
-
   rib->flags = stream_getc (s);
   message = stream_getc (s); 
   safi = stream_getw (s);
@@ -924,11 +917,6 @@ zread_ipv6_add (struct zserv *client, u_short length)
 
   /* Type, flags, message. */
   api.type = stream_getc (s);
-  /* Update the route type of the client. 
-   * Same as in zread_ipv4_add(). */
-  if (client->route_type == ZEBRA_ROUTE_MAX)
-    client->route_type = api.type;
-
   api.flags = stream_getc (s);
   api.message = stream_getc (s);
   api.safi = stream_getw (s);
@@ -1127,14 +1115,6 @@ zebra_score_rib (int client_sock)
 static void
 zebra_client_close (struct zserv *client)
 {
-  struct stream *s;
-
-  /* Sweep all routes learned from the client first. */
-  rib_sweep_client_route(client);
-  /* Reset the route type. It may not be necessary since the
-   * whole client will be freed. */
-  client->route_type = ZEBRA_ROUTE_MAX;
-
   /* Close file descriptor. */
   if (client->sock)
     {
@@ -1174,9 +1154,6 @@ zebra_client_create (int sock)
 
   /* Make client input/output buffer. */
   client->sock = sock;
-  /* Set the default route type to ZEBRA_ROUTE_MAX; it will be updated
-   * once new routes are received. */
-  client->route_type = ZEBRA_ROUTE_MAX;
   client->ibuf = stream_new (ZEBRA_MAX_PACKET_SIZ);
   client->obuf = stream_new (ZEBRA_MAX_PACKET_SIZ);
   client->wb = buffer_new(0);
index 3d7ebbcd85da9b1ee885cc486c4853b3b692775e..5e8bccac31247b2146066f499c4d13b8d4086720 100644 (file)
@@ -38,10 +38,6 @@ struct zserv
   /* Client file descriptor. */
   int sock;
 
-  /* Client route type. */
-  /* Assuming each client contains only one type of route. */
-  int route_type;
-
   /* Input/output buffer to the client. */
   struct stream *ibuf;
   struct stream *obuf;