diff options
author | Russ White <russ@riw.us> | 2019-04-26 00:43:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-26 00:43:10 +0200 |
commit | 798b3c3469d2c63bda01ca730af41949c8974242 (patch) | |
tree | 89b3b3d6e5772518e0a59cafc7f366e22782f1ed /bgpd/bgp_route.c | |
parent | Merge pull request #4126 from karamalla0406/4113 (diff) | |
parent | bgpd: Do not send UPDATE message with maximum-prefix (diff) | |
download | frr-798b3c3469d2c63bda01ca730af41949c8974242.tar.xz frr-798b3c3469d2c63bda01ca730af41949c8974242.zip |
Merge pull request #4140 from ton31337/fix/do_not_send_notification_again_with_invalid_nlri
bgpd: Do not send UPDATE message with maximum-prefix
Diffstat (limited to 'bgpd/bgp_route.c')
-rw-r--r-- | bgpd/bgp_route.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 36d1369eb..063cc24dc 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4340,7 +4340,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, /* When packet overflow occurs return immediately. */ if (pnt + BGP_ADDPATH_ID_LEN > lim) - return -1; + return BGP_NLRI_PARSE_ERROR_PACKET_OVERFLOW; addpath_id = ntohl(*((uint32_t *)pnt)); pnt += BGP_ADDPATH_ID_LEN; @@ -4358,7 +4358,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, EC_BGP_UPDATE_RCV, "%s [Error] Update packet error (wrong prefix length %d for afi %u)", peer->host, p.prefixlen, packet->afi); - return -1; + return BGP_NLRI_PARSE_ERROR_PREFIX_LENGTH; } /* Packet size overflow check. */ @@ -4370,7 +4370,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, EC_BGP_UPDATE_RCV, "%s [Error] Update packet error (prefix length %d overflows packet)", peer->host, p.prefixlen); - return -1; + return BGP_NLRI_PARSE_ERROR_PACKET_OVERFLOW; } /* Defensive coding, double-check the psize fits in a struct @@ -4380,7 +4380,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, EC_BGP_UPDATE_RCV, "%s [Error] Update packet error (prefix length %d too large for prefix storage %zu)", peer->host, p.prefixlen, sizeof(p.u)); - return -1; + return BGP_NLRI_PARSE_ERROR_PACKET_LENGTH; } /* Fetch prefix from NLRI packet. */ @@ -4445,10 +4445,14 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, BGP_ROUTE_NORMAL, NULL, NULL, 0, NULL); - /* Address family configuration mismatch or maximum-prefix count - overflow. */ + /* Do not send BGP notification twice when maximum-prefix count + * overflow. */ + if (CHECK_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) + return BGP_NLRI_PARSE_ERROR_PREFIX_OVERFLOW; + + /* Address family configuration mismatch. */ if (ret < 0) - return -1; + return BGP_NLRI_PARSE_ERROR_ADDRESS_FAMILY; } /* Packet length consistency check. */ @@ -4457,10 +4461,10 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, EC_BGP_UPDATE_RCV, "%s [Error] Update packet error (prefix length mismatch with total length)", peer->host); - return -1; + return BGP_NLRI_PARSE_ERROR_PACKET_LENGTH; } - return 0; + return BGP_NLRI_PARSE_OK; } static struct bgp_static *bgp_static_new(void) |