Skip to content

Commit 2cee556

Browse files
bgpd: flowspec: remove sizelimit check applied to the wrong length field (issue 18557)
Section 4.1 of RFC8955 defines how the length field of flowspec NLRIs is encoded. The method use implies a maximum length of 4095 for a single flowspec NLRI. However, in bgp_flowspec.c, we check the length attribute of the bgp_nlri structure against this maximum value, which actually is the *total* length of all NLRI included in the considered MP_REACH_NLRI path attribute. Due to this confusion, frr would reject valid announces that contain many flowspec NLRIs, when their cummulative length exceeds 4095, and close the session. The proposed change removes that check entirely. Indeed, there is no need to check the length field of each invidual NLRI because the method employed make it impossible to encode a length greater than 4095. Signed-off-by: Stephane Poignant <[email protected]>
1 parent 9f8027b commit 2cee556

File tree

3 files changed

+0
-9
lines changed

3 files changed

+0
-9
lines changed

bgpd/bgp_flowspec.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,6 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
105105
if (!attr)
106106
withdraw = true;
107107

108-
if (packet->length >= FLOWSPEC_NLRI_SIZELIMIT_EXTENDED) {
109-
flog_err(EC_BGP_FLOWSPEC_PACKET,
110-
"BGP flowspec nlri length maximum reached (%u)",
111-
packet->length);
112-
return BGP_NLRI_PARSE_ERROR_FLOWSPEC_NLRI_SIZELIMIT;
113-
}
114-
115108
for (; pnt < lim; pnt += psize) {
116109
/* Clear prefix structure. */
117110
memset(&p, 0, sizeof(p));

bgpd/bgp_flowspec_private.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#define _FRR_BGP_FLOWSPEC_PRIVATE_H
88

99
#define FLOWSPEC_NLRI_SIZELIMIT 240
10-
#define FLOWSPEC_NLRI_SIZELIMIT_EXTENDED 4095
1110

1211
/* Flowspec raffic action bit*/
1312
#define FLOWSPEC_TRAFFIC_ACTION_TERMINAL 1

bgpd/bgp_route.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ enum bgp_show_adj_route_type {
8888
#define BGP_NLRI_PARSE_ERROR_EVPN_TYPE4_SIZE -9
8989
#define BGP_NLRI_PARSE_ERROR_EVPN_TYPE5_SIZE -10
9090
#define BGP_NLRI_PARSE_ERROR_FLOWSPEC_IPV6_NOT_SUPPORTED -11
91-
#define BGP_NLRI_PARSE_ERROR_FLOWSPEC_NLRI_SIZELIMIT -12
9291
#define BGP_NLRI_PARSE_ERROR_FLOWSPEC_BAD_FORMAT -13
9392
#define BGP_NLRI_PARSE_ERROR_ADDRESS_FAMILY -14
9493
#define BGP_NLRI_PARSE_ERROR_EVPN_TYPE1_SIZE -15

0 commit comments

Comments
 (0)