From ca87e1d37b3c30648e9bacb476a3c89729512f6d Mon Sep 17 00:00:00 2001 From: Vasilis Tsiligiannis Date: Mon, 20 Jul 2009 01:28:35 +0300 Subject: bgpd: Implement BGP confederation error handling (RFC5065, Par. 5) This patch implements BGP confederation error handling in Quagga as described in RFC5065, paragraph 5. * bgp_aspath.c: (aspath_confed_check, aspath_left_confed_check) new functions * bgp_attr.c: (bgp_attr_aspath_check) apply previous and NOTIFY if there's a problem. --- bgpd/bgp_attr.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'bgpd/bgp_attr.c') diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 94168372..a664858c 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -872,6 +872,17 @@ static int bgp_attr_aspath_check( struct peer *peer, bgp = peer->bgp; + /* Confederation sanity check. */ + if ((peer_sort (peer) == BGP_PEER_CONFED && ! aspath_left_confed_check (attr->aspath)) || + (peer_sort (peer) == BGP_PEER_EBGP && aspath_confed_check (attr->aspath))) + { + zlog (peer->log, LOG_ERR, "Malformed AS path from %s", peer->host); + bgp_notify_send (peer, + BGP_NOTIFY_UPDATE_ERR, + BGP_NOTIFY_UPDATE_MAL_AS_PATH); + return -1; + } + /* First AS check for EBGP. */ if (bgp != NULL && bgp_flag_check (bgp, BGP_FLAG_ENFORCE_FIRST_AS)) { -- cgit v1.2.1