Mailing List Archive

route-map fail to match tag value
Hi guys,

I found a bug in the latest codebase, which makes routemap fail to
match tag value.
The root cause is the message format does not match between zebra and
other clients.

Here is the diff I used in our project. I'm wondering whether it is
feasible to contribute it back to upstream.
Could you help review it?

Thanks,
Wenxian

diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 40ecbce..48584bc 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -282,11 +282,13 @@ zebra_read_ipv4 (int command, struct zclient
*zclient, zebra_size_t length,
else
api.metric = 0;

+ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_MTU))
+ api.mtu = stream_getl (s);
+
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
api.tag = stream_getl (s);
else
api.tag = 0;
-
if (command == ZEBRA_IPV4_ROUTE_ADD)
{
if (BGP_DEBUG(zebra, ZEBRA))
@@ -369,6 +371,9 @@ zebra_read_ipv6 (int command, struct zclient
*zclient, zebra_size_t length,
else
api.metric = 0;

+ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_MTU))
+ api.mtu = stream_getl (s);
+
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
api.tag = stream_getl (s);
else
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index 2976214..a011151 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -247,6 +247,9 @@ ospf6_zebra_read_ipv6 (int command, struct zclient *zclient,
else
api.metric = 0;

+ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_MTU))
+ api.mtu = stream_getl (s);
+
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
api.tag = stream_getl (s);
else
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 95d2afe..43f59db 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -442,7 +442,6 @@ ospf_zebra_add (struct prefix_ipv4 *p, struct
ospf_route *or)
else
stream_putl (s, or->cost);
}
-
if (CHECK_FLAG (message, ZAPI_MESSAGE_TAG))
stream_putl (s, or->u.ext.tag);

@@ -899,6 +898,8 @@ ospf_zebra_read_ipv4 (int command, struct zclient *zclient,
api.distance = stream_getc (s);
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_METRIC))
api.metric = stream_getl (s);
+ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_MTU))
+ api.mtu = stream_getl (s);
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
api.tag = stream_getl (s);
else
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index efff100..d3f1dfc 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -582,6 +582,9 @@ static int redist_read_ipv4_route(int command,
struct zclient *zclient,
stream_getl(s) :
0;

+ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_MTU))
+ api.mtu = stream_getl (s);
+
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
api.tag = stream_getl (s);
else
diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c
index 0b51af5..e1a7c76 100644
--- a/ripd/rip_zebra.c
+++ b/ripd/rip_zebra.c
@@ -179,6 +179,9 @@ rip_zebra_read_ipv4 (int command, struct zclient
*zclient, zebra_size_t length,
else
api.metric = 0;

+ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_MTU))
+ api.mtu = stream_getl (s);
+
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
api.tag = stream_getl (s);
else
diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c
index a35bc99..459fa5c 100644
--- a/ripngd/ripng_zebra.c
+++ b/ripngd/ripng_zebra.c
@@ -178,6 +178,9 @@ ripng_zebra_read_ipv6 (int command, struct zclient *zclient,
else
api.metric = 0;

+ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_MTU))
+ api.mtu = stream_getl (s);
+
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
api.tag = stream_getl (s);
else
diff --git a/zebra/zserv.c b/zebra/zserv.c
index a96bcb1..a1df62d 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -1077,7 +1077,11 @@ zread_ipv4_delete (struct zserv *client,
u_short length, vrf_id_t vrf_id)
api.metric = stream_getl (s);
else
api.metric = 0;
-
+
+ /* MTU */
+ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_MTU))
+ api.mtu = stream_getl (s);
+
/* tag */
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
api.tag = stream_getl (s);
@@ -1299,6 +1303,10 @@ zread_ipv6_delete (struct zserv *client,
u_short length, vrf_id_t vrf_id)
api.metric = stream_getl (s);
else
api.metric = 0;
+
+ /* MTU */
+ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_MTU))
+ api.mtu = stream_getl (s);

/* tag */
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev