* bgp_packet.c: (bgp_update_receive) doesn't differentiate between NLRIs that
are 0 AFI/SAFI cause they weren't set, and those because a peer sent a
bogus AFI/SAFI. Causing a misleading, spurious log message.
Could also just ignore afi == 0, simpler but would hide wire errors
potentially.
---
bgpd/bgp_packet.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 77b08d0..6b04e88 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1633,7 +1633,9 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
NLRI_TYPE_MAX,
};
struct bgp_nlri nlris[NLRI_TYPE_MAX];
-
+
+ bool nlris_set[NLRI_TYPE_MAX];
+
/* Status must be Established. */
if (peer->status != Established)
{
@@ -1647,6 +1649,8 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
memset (&attr, 0, sizeof (struct attr));
memset (&extra, 0, sizeof (struct attr_extra));
memset (&nlris, 0, sizeof nlris);
+ memset (&nlris_set, 0, sizeof nlris_set);
+
attr.extra = &extra;
s = peer->ibuf;
@@ -1687,6 +1691,7 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
nlris[NLRI_WITHDRAW].safi = SAFI_UNICAST;
nlris[NLRI_WITHDRAW].nlri = stream_pnt (s);
nlris[NLRI_WITHDRAW].length = withdraw_len;
+ nlris_set[NLRI_WITHDRAW] = true;
if (BGP_DEBUG (packet, PACKET_RECV))
zlog_debug ("%s [Update:RECV] Unfeasible NLRI received", peer->host);
@@ -1743,6 +1748,10 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
bgp_attr_flush (&attr);
return -1;
}
+ if (CHECK_FLAG (attr.flag, ATTR_FLAG_BIT (BGP_ATTR_MP_REACH_NLRI)))
+ nlris_set[NLRI_MP_UPDATE] = true;
+ if (CHECK_FLAG (attr.flag, ATTR_FLAG_BIT (BGP_ATTR_MP_UNREACH_NLRI)))
+ nlris_set[NLRI_MP_WITHDRAW] = true;
}
/* Logging the attribute. */
@@ -1776,6 +1785,7 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
nlris[NLRI_UPDATE].safi = SAFI_UNICAST;
nlris[NLRI_UPDATE].nlri = stream_pnt (s);
nlris[NLRI_UPDATE].length = update_len;
+ nlris_set[NLRI_UPDATE] = true;
stream_forward_getp (s, update_len);
}
@@ -1783,6 +1793,8 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
/* Parse any given NLRIs */
for (i = NLRI_UPDATE; i < NLRI_TYPE_MAX; i++)
{
+ if (!nlris_set[i]) continue;
+
/* We use afi and safi as indices into tables and what not. It would
* be impossible, at this time, to support unknown afi/safis. And
* anyway, the peer needs to be configured to enable the afi/safi
--
2.5.5
_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev