diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-04-18 17:37:51 +0300 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-04-18 17:44:51 +0300 |
| commit | 79cf6512f4adf3a25e78355832aff7b6179d2e30 (patch) | |
| tree | 956b8fcf64e0ad1a2fc6127cc6db584ee0948e5e | |
| parent | 8e7fb950c13779d700fa79f82423bfcb64974b39 (diff) | |
bgpd: Include capabilities when sending NOTIFICATION(7)
RFC5492 says:
This document defines a new Error Subcode, Unsupported Capability.
The value of this Subcode is 7. The Data field in the NOTIFICATION
message MUST list the set of capabilities that causes the speaker to
send the message. Each such capability is encoded in the same way as
it would be encoded in the OPEN message.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
| -rw-r--r-- | bgpd/bgp_open.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 4037fd8aef..1c3bb6e775 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -1452,8 +1452,10 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length, /* All OPEN option is parsed. Check capability when strict compare flag is enabled.*/ if (CHECK_FLAG(peer->flags, PEER_FLAG_STRICT_CAP_MATCH)) { - /* If Unsupported Capability exists. */ - if (error != error_data) { + /* If Unsupported Capability exists or local capability does + * not negotiated with remote peer + */ + if (error != error_data || !strict_capability_same(peer)) { bgp_notify_send_with_data(peer->connection, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_UNSUP_CAPBL, @@ -1461,14 +1463,6 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length, error - error_data); return -1; } - - /* Check local capability does not negotiated with remote - peer. */ - if (!strict_capability_same(peer)) { - bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR, - BGP_NOTIFY_OPEN_UNSUP_CAPBL); - return -1; - } } /* Extended Message Support */ @@ -1503,17 +1497,11 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length, "%s [Error] Configured AFI/SAFIs do not overlap with received MP capabilities", peer->host); - if (error != error_data) - bgp_notify_send_with_data(peer->connection, - BGP_NOTIFY_OPEN_ERR, - BGP_NOTIFY_OPEN_UNSUP_CAPBL, - error_data, - error - error_data); - else - bgp_notify_send(peer->connection, - BGP_NOTIFY_OPEN_ERR, - BGP_NOTIFY_OPEN_UNSUP_CAPBL); - return -1; + bgp_notify_send_with_data(peer->connection, + BGP_NOTIFY_OPEN_ERR, + BGP_NOTIFY_OPEN_UNSUP_CAPBL, + error_data, + error - error_data); } } return 0; |
