]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zserv: always send all information about each route
authorRenato Westphal <renato@opensourcerouting.org>
Wed, 21 Sep 2016 16:38:34 +0000 (13:38 -0300)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 23 Sep 2016 13:31:22 +0000 (09:31 -0400)
Most routing daemons are not interested in certain pieces of information
when a redistributed route is being removed, like its metric and distance.

ldpd, in the other hand, needs to know the distance of the removed routes
in order to work properly. Now, instead of adding another exception in
zserv's code for ldpd, let's make zebra always send all information
about each route to its clients, independently if the route is being
added or removed. This is ok because all daemons are already prepared
to process these additional fields when the appropriate flags are set
in the zebra messages.

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

index 4c68f6acb96186415274e8294c1a3e558e17559c..5f0b4d5e20f9f874714184e7c73bbecb314d8534 100644 (file)
@@ -720,24 +720,25 @@ zsend_redistribute_route (int cmd, struct zserv *client, struct prefix *p,
         }
     }
 
+  /* Distance */
+  SET_FLAG (zapi_flags, ZAPI_MESSAGE_DISTANCE);
+  stream_putc (s, rib->distance);
+
   /* Metric */
-  if (cmd == ZEBRA_REDISTRIBUTE_IPV4_ADD || cmd == ZEBRA_REDISTRIBUTE_IPV6_ADD)
-    {
-      SET_FLAG (zapi_flags, ZAPI_MESSAGE_DISTANCE);
-      stream_putc (s, rib->distance);
-      SET_FLAG (zapi_flags, ZAPI_MESSAGE_METRIC);
-      stream_putl (s, rib->metric);
+  SET_FLAG (zapi_flags, ZAPI_MESSAGE_METRIC);
+  stream_putl (s, rib->metric);
 
-      /* tag */
-      if (rib->tag)
-        {
-          SET_FLAG(zapi_flags, ZAPI_MESSAGE_TAG);
-          stream_putw(s, rib->tag);
-        }
-      SET_FLAG (zapi_flags, ZAPI_MESSAGE_MTU);
-      stream_putl (s, rib->mtu);
+  /* Tag */
+  if (rib->tag)
+    {
+      SET_FLAG(zapi_flags, ZAPI_MESSAGE_TAG);
+      stream_putw(s, rib->tag);
     }
 
+  /* MTU */
+  SET_FLAG (zapi_flags, ZAPI_MESSAGE_MTU);
+  stream_putl (s, rib->mtu);
+
   /* write real message flags value */
   stream_putc_at (s, messmark, zapi_flags);