]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Show extended parameters support for the OPEN messages 16423/head
authorDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 19 Jul 2024 02:20:04 +0000 (05:20 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 19 Jul 2024 02:20:04 +0000 (05:20 +0300)
We did that for the receiving side, but not for a sending side, let's fix it.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_packet.c

index 4625f15778a2f80c2e29910f9a04df2e3271c63e..0fb59a94c28310cf20ebdec42edd45bd0e0f7a0e 100644 (file)
@@ -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;
@@ -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);
@@ -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); */