Skip to content

Commit

Permalink
bgpd: Ignore validating the attribute flags if path-attribute is conf…
Browse files Browse the repository at this point in the history
…igured

E.g. Cisco sends AIGP attribute as transitive, but it's wrong. Hence, the session
is teared down, because of this bgp_attr_flag_invalid() test.

Relax this check if we have `neighbor X path-attribute <discard|treat-as-withdraw>`
configured.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
  • Loading branch information
ton31337 committed May 1, 2024
1 parent 48f5d82 commit 714e5be
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bgpd/bgp_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1526,13 +1526,22 @@ static bool bgp_attr_flag_invalid(struct bgp_attr_parser_args *args)
uint8_t mask = BGP_ATTR_FLAG_EXTLEN;
const uint8_t flags = args->flags;
const uint8_t attr_code = args->type;
struct peer *peer = args->peer;

/* there may be attributes we don't know about */
if (attr_code > attr_flags_values_max)
return false;
if (attr_flags_values[attr_code] == 0)
return false;

/* If `neighbor X path-attribute <discard|treat-as-withdraw>` is
* configured, then ignore checking optional, trasitive flags.
* The attribute/route will be discarded/withdrawned later instead
* of dropping the session.
*/
if (peer->discard_attrs[attr_code] || peer->withdraw_attrs[attr_code])
return false;

/* RFC4271, "For well-known attributes, the Transitive bit MUST be set
* to
* 1."
Expand Down

0 comments on commit 714e5be

Please sign in to comment.