Fixes 518a4b7eadcb "bgpd: Regularise bgp_update_receive,
add missing notifies and checks"
Error message "UPDATE with unsupported AFI/SAFI 0/0" is wrongly
displayed for a packet which does not have the matching NLRI entry.
The patch checks presence of nlri in bgp update message.

Signed-off-by: Philippe Guibert <philippe.guib...@6wind.com>
---
 bgpd/bgp_packet.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 740b0f1ce603..601d39d1c1ad 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1781,6 +1781,14 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
   /* Parse any given NLRIs */
   for (i = NLRI_UPDATE; i < NLRI_TYPE_MAX; i++)
     {
+      /* ignore empty nlri entries */
+      if ((i == NLRI_WITHDRAW) && (withdraw_len == 0))
+        continue;
+      else if ((i == NLRI_UPDATE) && (update_len == 0))
+        continue;
+      else if ( ((i == NLRI_MP_UPDATE) || (i == NLRI_MP_WITHDRAW)) &&  \
+                (attribute_len == 0))
+        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.1.4


_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to