diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-05-01 16:01:38 +0300 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-05-01 16:01:38 +0300 |
| commit | 714e5be9a0804c0da2c9429bead274bbaefc9939 (patch) | |
| tree | 7ce4cefa7a8db502e8e903aaf1e1f410cc6d675e /bgpd/bgp_attr.c | |
| parent | 48f5d828e3ed00bce92e5f916acf19304d0bf647 (diff) | |
bgpd: Ignore validating the attribute flags if path-attribute is configured
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>
Diffstat (limited to 'bgpd/bgp_attr.c')
| -rw-r--r-- | bgpd/bgp_attr.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 913634bf59..71f02a7f83 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -1526,6 +1526,7 @@ 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) @@ -1533,6 +1534,14 @@ static bool bgp_attr_flag_invalid(struct bgp_attr_parser_args *args) 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." |
