From 7fe041ac83786e9014460a69296591d7981763f6 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Wed, 21 Sep 2016 13:38:34 -0300 Subject: [PATCH] zserv: always send all information about each route 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 --- zebra/zserv.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/zebra/zserv.c b/zebra/zserv.c index 4c68f6acb9..5f0b4d5e20 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -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); -- 2.39.5