summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-03-12 12:13:52 +0100
committerGitHub <noreply@github.com>2024-03-12 12:13:52 +0100
commitabc238d65fd150ee806d3b204a4f6950bb4d1bbb (patch)
tree3885178733e815385fef5b59611012867e9c87fa
parente4885819f5b4447fb9ee00b45803555628c984b2 (diff)
parentbaf24d2fec25087fcd445d9939924966144d1b76 (diff)
Merge pull request #15519 from FRRouting/mergify/bp/dev/10.0/pr-15513
bgpd: Fix `no` form for `neighbor X capability software-version` (backport #15513)
-rw-r--r--bgpd/bgp_open.c1
-rw-r--r--bgpd/bgp_vty.c16
-rw-r--r--bgpd/bgpd.c3
3 files changed, 16 insertions, 4 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 43a59e2448..6447586ba3 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -1951,7 +1951,6 @@ uint16_t bgp_open_capability(struct stream *s, struct peer *peer,
* or disable its use, and that switch MUST be off by default.
*/
if (peergroup_flag_check(peer, PEER_FLAG_CAPABILITY_SOFT_VERSION) ||
- CHECK_FLAG(peer->bgp->flags, BGP_FLAG_SOFT_VERSION_CAPABILITY) ||
peer->sort == BGP_PEER_IBGP || peer->sub_sort == BGP_PEER_EBGP_OAD) {
SET_FLAG(peer->cap, PEER_CAP_SOFT_VERSION_ADV);
stream_putc(s, BGP_OPEN_OPT_CAP);
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 31524e2221..a158f738d9 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -18238,9 +18238,19 @@ static void bgp_config_write_peer_global(struct vty *vty, struct bgp *bgp,
}
/* capability software-version */
- if (peergroup_flag_check(peer, PEER_FLAG_CAPABILITY_SOFT_VERSION))
- vty_out(vty, " neighbor %s capability software-version\n",
- addr);
+ if (CHECK_FLAG(bgp->flags, BGP_FLAG_SOFT_VERSION_CAPABILITY)) {
+ if (!peergroup_flag_check(peer,
+ PEER_FLAG_CAPABILITY_SOFT_VERSION))
+ vty_out(vty,
+ " no neighbor %s capability software-version\n",
+ addr);
+ } else {
+ if (peergroup_flag_check(peer,
+ PEER_FLAG_CAPABILITY_SOFT_VERSION))
+ vty_out(vty,
+ " neighbor %s capability software-version\n",
+ addr);
+ }
/* dont-capability-negotiation */
if (peergroup_flag_check(peer, PEER_FLAG_DONT_CAPABILITY))
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 8fc52652a2..1a03a06844 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1539,6 +1539,9 @@ struct peer *peer_new(struct bgp *bgp)
if (CHECK_FLAG(bgp->flags, BGP_FLAG_ENFORCE_FIRST_AS))
SET_FLAG(peer->flags, PEER_FLAG_ENFORCE_FIRST_AS);
+ if (CHECK_FLAG(bgp->flags, BGP_FLAG_SOFT_VERSION_CAPABILITY))
+ SET_FLAG(peer->flags, PEER_FLAG_CAPABILITY_SOFT_VERSION);
+
SET_FLAG(peer->flags_invert, PEER_FLAG_CAPABILITY_FQDN);
SET_FLAG(peer->flags, PEER_FLAG_CAPABILITY_FQDN);