[quagga-dev 10218] [PATCH 1/4] bgpd: don't try to reconcile AS4_PATH with NULL

David Lamparter equinox at opensourcerouting.org
Wed Jan 23 05:06:01 GMT 2013

bgp_attr_munge_as4_attrs would previously try to reintegrate an AS4_PATH
with a NULL AS_PATH, leading to a rather nasty SEGV.  Let's go by
RFC6793 and treat missing AS_PATH as 0-length AS_PATH, which in turn
means discarding the AS4_PATH.

[NB: we don't actually stick to the actual rule, which is discarding
AS4_PATH if it's longer than AS_PATH; indeed we should probably fix that

Signed-off-by: David Lamparter <equinox at opensourcerouting.org>
 bgpd/bgp_attr.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 1dce39b..cbf2902 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1360,6 +1360,9 @@ bgp_attr_munge_as4_attrs (struct peer *const peer,
   /* need to reconcile NEW_AS_PATH and AS_PATH */
   if (!ignore_as4_path && (attr->flag & (ATTR_FLAG_BIT( BGP_ATTR_AS4_PATH))))
+       if (!attr->aspath)
+         return BGP_ATTR_PARSE_PROCEED;
        newpath = aspath_reconcile_as4 (attr->aspath, as4_path);
        aspath_unintern (&attr->aspath);
        attr->aspath = aspath_intern (newpath);

More information about the Quagga-dev mailing list