Skip to content

Commit

Permalink
Merge pull request #16423 from opensourcerouting/fix/show_if_the_open…
Browse files Browse the repository at this point in the history
…_message_is_extended

bgpd: Show extended parameters support for the OPEN messages
  • Loading branch information
Jafaral authored Jul 19, 2024
2 parents 7aeb51e + e8169f9 commit 9de961d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions bgpd/bgp_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ void bgp_open_send(struct peer_connection *connection)
uint16_t send_holdtime;
as_t local_as;
struct peer *peer = connection->peer;
bool ext_opt_params = false;

if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER))
send_holdtime = peer->holdtime;
Expand All @@ -677,15 +678,17 @@ void bgp_open_send(struct peer_connection *connection)

/* Set capabilities */
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 {
struct stream *tmp = stream_new(STREAM_SIZE(s));

stream_copy(tmp, s);
if (bgp_open_capability(tmp, peer, false)
> BGP_OPEN_NON_EXT_OPT_LEN) {
if (bgp_open_capability(tmp, peer, ext_opt_params) >
BGP_OPEN_NON_EXT_OPT_LEN) {
stream_free(tmp);
(void)bgp_open_capability(s, peer, true);
ext_opt_params = true;
(void)bgp_open_capability(s, peer, ext_opt_params);
} else {
stream_copy(s, tmp);
stream_free(tmp);
Expand All @@ -696,9 +699,10 @@ void bgp_open_send(struct peer_connection *connection)
bgp_packet_set_size(s);

if (bgp_debug_neighbor_events(peer))
zlog_debug("%pBP fd %d sending OPEN, version %d, my as %u, holdtime %d, id %pI4",
peer, peer->connection->fd, BGP_VERSION_4, local_as,
send_holdtime, &peer->local_id);
zlog_debug("%pBP fd %d sending OPEN%s, version %d, my as %u, holdtime %d, id %pI4",
peer, peer->connection->fd,
ext_opt_params ? " (Extended)" : "", BGP_VERSION_4,
local_as, send_holdtime, &peer->local_id);

/* Dump packet if debug option is set. */
/* bgp_packet_dump (s); */
Expand Down

0 comments on commit 9de961d

Please sign in to comment.