Skip to content

Commit ab0b65e

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 ab0b65e

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

bgpd/bgp_flowspec.c

Lines changed: 1 addition & 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));
@@ -126,6 +119,7 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
126119
psize = psize << 8;
127120
psize |= *pnt++;
128121
}
122+
129123
/* When packet overflow occur return immediately. */
130124
if (pnt + psize > lim) {
131125
flog_err(

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

0 commit comments

Comments
 (0)