Merge pull request #16423 from opensourcerouting/fix/show_if_the_open_message_is_extended

bgpd: Show extended parameters support for the OPEN messages
This commit is contained in:
Jafar Al-Gharaibeh 2024-07-19 16:33:23 -04:00 committed by GitHub
commit 9de961dc42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -651,6 +651,7 @@ void bgp_open_send(struct peer_connection *connection)
uint16_t send_holdtime; uint16_t send_holdtime;
as_t local_as; as_t local_as;
struct peer *peer = connection->peer; struct peer *peer = connection->peer;
bool ext_opt_params = false;
if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER)) if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER))
send_holdtime = peer->holdtime; send_holdtime = peer->holdtime;
@ -677,15 +678,17 @@ void bgp_open_send(struct peer_connection *connection)
/* Set capabilities */ /* Set capabilities */
if (CHECK_FLAG(peer->flags, PEER_FLAG_EXTENDED_OPT_PARAMS)) { if (CHECK_FLAG(peer->flags, PEER_FLAG_EXTENDED_OPT_PARAMS)) {
(void)bgp_open_capability(s, peer, true); ext_opt_params = true;
(void)bgp_open_capability(s, peer, ext_opt_params);
} else { } else {
struct stream *tmp = stream_new(STREAM_SIZE(s)); struct stream *tmp = stream_new(STREAM_SIZE(s));
stream_copy(tmp, s); stream_copy(tmp, s);
if (bgp_open_capability(tmp, peer, false) if (bgp_open_capability(tmp, peer, ext_opt_params) >
> BGP_OPEN_NON_EXT_OPT_LEN) { BGP_OPEN_NON_EXT_OPT_LEN) {
stream_free(tmp); stream_free(tmp);
(void)bgp_open_capability(s, peer, true); ext_opt_params = true;
(void)bgp_open_capability(s, peer, ext_opt_params);
} else { } else {
stream_copy(s, tmp); stream_copy(s, tmp);
stream_free(tmp); stream_free(tmp);
@ -696,9 +699,10 @@ void bgp_open_send(struct peer_connection *connection)
bgp_packet_set_size(s); bgp_packet_set_size(s);
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug("%pBP fd %d sending OPEN, version %d, my as %u, holdtime %d, id %pI4", zlog_debug("%pBP fd %d sending OPEN%s, version %d, my as %u, holdtime %d, id %pI4",
peer, peer->connection->fd, BGP_VERSION_4, local_as, peer, peer->connection->fd,
send_holdtime, &peer->local_id); ext_opt_params ? " (Extended)" : "", BGP_VERSION_4,
local_as, send_holdtime, &peer->local_id);
/* Dump packet if debug option is set. */ /* Dump packet if debug option is set. */
/* bgp_packet_dump (s); */ /* bgp_packet_dump (s); */