Merge pull request #11805 from opensourcerouting/fix/treat_as_withdraw_if_as_set

bgpd: Treat as withdraw if we receive as path with AS_SET / AS_CONFED_SET
This commit is contained in:
Russ White 2022-08-16 11:17:41 -04:00 committed by GitHub
commit fdbff7d1a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1515,6 +1515,19 @@ static int bgp_attr_aspath(struct bgp_attr_parser_args *args)
0); 0);
} }
/* Conformant BGP speakers SHOULD NOT send BGP
* UPDATE messages containing AS_SET or AS_CONFED_SET. Upon receipt of
* such messages, conformant BGP speakers SHOULD use the "Treat-as-
* withdraw" error handling behavior as per [RFC7606].
*/
if (peer->bgp->reject_as_sets && aspath_check_as_sets(attr->aspath)) {
flog_err(EC_BGP_ATTR_MAL_AS_PATH,
"AS_SET and AS_CONFED_SET are deprecated from %pBP",
peer);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_MAL_AS_PATH,
0);
}
/* Set aspath attribute flag. */ /* Set aspath attribute flag. */
attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AS_PATH); attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AS_PATH);
@ -1595,6 +1608,19 @@ static int bgp_attr_as4_path(struct bgp_attr_parser_args *args,
0); 0);
} }
/* Conformant BGP speakers SHOULD NOT send BGP
* UPDATE messages containing AS_SET or AS_CONFED_SET. Upon receipt of
* such messages, conformant BGP speakers SHOULD use the "Treat-as-
* withdraw" error handling behavior as per [RFC7606].
*/
if (peer->bgp->reject_as_sets && aspath_check_as_sets(attr->aspath)) {
flog_err(EC_BGP_ATTR_MAL_AS_PATH,
"AS_SET and AS_CONFED_SET are deprecated from %pBP",
peer);
return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_MAL_AS_PATH,
0);
}
/* Set aspath attribute flag. */ /* Set aspath attribute flag. */
attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AS4_PATH); attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AS4_PATH);