summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2024-03-26 10:09:50 -0400
committerGitHub <noreply@github.com>2024-03-26 10:09:50 -0400
commit73e0b7a198c8a2f483af2140e116e53df1e5cb5d (patch)
tree1bebca2cda89e8b47438033530da72b2fdf7b3ee
parent67aaa4b076a81bb5e6608bd49dd7eaf05b88cc69 (diff)
parente2ac728c82f365b9e9f1f102d40c3c4e172a3b4f (diff)
Merge pull request #15585 from opensourcerouting/feature/enable_dynamic_capability_for_datacenter_profile
bgpd: Enable BGP dynamic capability by default for datacenter profile
-rw-r--r--bgpd/bgp_open.c2
-rw-r--r--bgpd/bgp_vty.c49
-rw-r--r--bgpd/bgpd.c10
-rw-r--r--bgpd/bgpd.h1
-rw-r--r--doc/user/bgp.rst13
5 files changed, 68 insertions, 7 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 15738e673b..4037fd8aef 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -1975,7 +1975,7 @@ uint16_t bgp_open_capability(struct stream *s, struct peer *peer,
}
/* Dynamic capability. */
- if (CHECK_FLAG(peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY)) {
+ if (peergroup_flag_check(peer, PEER_FLAG_DYNAMIC_CAPABILITY)) {
SET_FLAG(peer->cap, PEER_CAP_DYNAMIC_ADV);
stream_putc(s, BGP_OPEN_OPT_CAP);
ext_opt_params
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index cd0d6def7d..0a1cf3362b 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -126,6 +126,10 @@ FRR_CFG_DEFAULT_BOOL(BGP_SOFT_VERSION_CAPABILITY,
{ .val_bool = true, .match_profile = "datacenter", },
{ .val_bool = false },
);
+FRR_CFG_DEFAULT_BOOL(BGP_DYNAMIC_CAPABILITY,
+ { .val_bool = true, .match_profile = "datacenter", },
+ { .val_bool = false },
+);
FRR_CFG_DEFAULT_BOOL(BGP_ENFORCE_FIRST_AS,
{ .val_bool = false, .match_version = "< 9.1", },
{ .val_bool = true },
@@ -623,6 +627,9 @@ int bgp_get_vty(struct bgp **bgp, as_t *as, const char *name,
if (DFLT_BGP_SOFT_VERSION_CAPABILITY)
SET_FLAG((*bgp)->flags,
BGP_FLAG_SOFT_VERSION_CAPABILITY);
+ if (DFLT_BGP_DYNAMIC_CAPABILITY)
+ SET_FLAG((*bgp)->flags,
+ BGP_FLAG_DYNAMIC_CAPABILITY);
if (DFLT_BGP_ENFORCE_FIRST_AS)
SET_FLAG((*bgp)->flags, BGP_FLAG_ENFORCE_FIRST_AS);
@@ -4298,6 +4305,24 @@ DEFPY (bgp_default_software_version_capability,
return CMD_SUCCESS;
}
+DEFPY (bgp_default_dynamic_capability,
+ bgp_default_dynamic_capability_cmd,
+ "[no] bgp default dynamic-capability",
+ NO_STR
+ BGP_STR
+ "Configure BGP defaults\n"
+ "Advertise dynamic capability for all neighbors\n")
+{
+ VTY_DECLVAR_CONTEXT(bgp, bgp);
+
+ if (no)
+ UNSET_FLAG(bgp->flags, BGP_FLAG_DYNAMIC_CAPABILITY);
+ else
+ SET_FLAG(bgp->flags, BGP_FLAG_DYNAMIC_CAPABILITY);
+
+ return CMD_SUCCESS;
+}
+
/* "bgp network import-check" configuration. */
DEFUN (bgp_network_import_check,
bgp_network_import_check_cmd,
@@ -18383,9 +18408,15 @@ static void bgp_config_write_peer_global(struct vty *vty, struct bgp *bgp,
vty_out(vty, " neighbor %s timers delayopen %u\n", addr,
peer->bgp->default_delayopen);
- /* capability dynamic */
- if (peergroup_flag_check(peer, PEER_FLAG_DYNAMIC_CAPABILITY))
- vty_out(vty, " neighbor %s capability dynamic\n", addr);
+ /* capability software-version */
+ if (CHECK_FLAG(bgp->flags, BGP_FLAG_DYNAMIC_CAPABILITY)) {
+ if (!peergroup_flag_check(peer, PEER_FLAG_DYNAMIC_CAPABILITY))
+ vty_out(vty, " no neighbor %s capability dynamic\n",
+ addr);
+ } else {
+ if (peergroup_flag_check(peer, PEER_FLAG_DYNAMIC_CAPABILITY))
+ vty_out(vty, " neighbor %s capability dynamic\n", addr);
+ }
/* capability extended-nexthop */
if (peergroup_flag_check(peer, PEER_FLAG_CAPABILITY_ENHE)) {
@@ -19076,6 +19107,15 @@ int bgp_config_write(struct vty *vty)
? ""
: "no ");
+ if (!!CHECK_FLAG(bgp->flags, BGP_FLAG_DYNAMIC_CAPABILITY) !=
+ SAVE_BGP_DYNAMIC_CAPABILITY)
+ vty_out(vty,
+ " %sbgp default dynamic-capability\n",
+ CHECK_FLAG(bgp->flags,
+ BGP_FLAG_DYNAMIC_CAPABILITY)
+ ? ""
+ : "no ");
+
/* BGP default subgroup-pkt-queue-max. */
if (bgp->default_subgroup_pkt_queue_max
!= BGP_DEFAULT_SUBGROUP_PKT_QUEUE_MAX)
@@ -20124,6 +20164,9 @@ void bgp_vty_init(void)
/* bgp default software-version-capability */
install_element(BGP_NODE, &bgp_default_software_version_capability_cmd);
+ /* bgp default dynamic-capability */
+ install_element(BGP_NODE, &bgp_default_dynamic_capability_cmd);
+
/* "bgp default subgroup-pkt-queue-max" commands. */
install_element(BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd);
install_element(BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 5d6561abea..d98df754ef 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1544,6 +1544,9 @@ struct peer *peer_new(struct bgp *bgp)
if (CHECK_FLAG(bgp->flags, BGP_FLAG_SOFT_VERSION_CAPABILITY))
SET_FLAG(peer->flags, PEER_FLAG_CAPABILITY_SOFT_VERSION);
+ if (CHECK_FLAG(bgp->flags, BGP_FLAG_DYNAMIC_CAPABILITY))
+ SET_FLAG(peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY);
+
SET_FLAG(peer->flags_invert, PEER_FLAG_CAPABILITY_FQDN);
SET_FLAG(peer->flags, PEER_FLAG_CAPABILITY_FQDN);
@@ -2919,6 +2922,13 @@ static void peer_group2peer_config_copy(struct peer_group *group,
SET_FLAG(peer->flags,
PEER_FLAG_CAPABILITY_SOFT_VERSION);
+ /* capability dynamic apply */
+ if (!CHECK_FLAG(peer->flags_override,
+ PEER_FLAG_DYNAMIC_CAPABILITY))
+ if (CHECK_FLAG(conf->flags, PEER_FLAG_DYNAMIC_CAPABILITY))
+ SET_FLAG(peer->flags,
+ PEER_FLAG_DYNAMIC_CAPABILITY);
+
/* password apply */
if (!CHECK_FLAG(peer->flags_override, PEER_FLAG_PASSWORD))
PEER_STR_ATTR_INHERIT(peer, group, password,
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 1130a285fb..c0fefd53ba 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -529,6 +529,7 @@ struct bgp {
#define BGP_FLAG_LU_IPV6_EXPLICIT_NULL (1ULL << 34)
#define BGP_FLAG_SOFT_VERSION_CAPABILITY (1ULL << 35)
#define BGP_FLAG_ENFORCE_FIRST_AS (1ULL << 36)
+#define BGP_FLAG_DYNAMIC_CAPABILITY (1ULL << 37)
/* BGP default address-families.
* New peers inherit enabled afi/safis from bgp instance.
diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst
index 9ae9508b02..3b8591fd52 100644
--- a/doc/user/bgp.rst
+++ b/doc/user/bgp.rst
@@ -1816,7 +1816,7 @@ Configuring Peers
This includes changing graceful-restart (LLGR also) timers,
enabling/disabling add-path, and other supported capabilities.
-.. clicmd:: neighbor PEER capability fqdn
+.. clicmd:: neighbor PEER capability fqdn
Allow BGP to negotiate the FQDN Capability with its peers.
@@ -1825,7 +1825,7 @@ Configuring Peers
This capability is activated by default. The ``no neighbor PEER capability
fqdn`` avoid negotiation of that capability. This is useful for peers who
- are not supporting this capability or supporting BGP Capabilities
+ are not supporting this capability or supporting BGP Capabilities
Negotiation RFC 2842.
.. clicmd:: neighbor <A.B.C.D|X:X::X:X|WORD> accept-own
@@ -1949,6 +1949,13 @@ Configuring Peers
outputs. It's easier to troubleshoot if you have a number of BGP peers
and a number of routes to check.
+.. clicmd:: bgp default dynamic-capability
+
+ This command enables dynamic capability advertisement by default
+ for all the neighbors.
+
+ For ``datacenter`` profile, this is enabled by default.
+
.. clicmd:: bgp default software-version-capability
This command enables software version capability advertisement by default
@@ -3219,7 +3226,7 @@ that the 2001:db8:2:2:: prefix is valid.
.. code-block:: frr
- r1# show bgp nexthop detail
+ r1# show bgp nexthop detail
Current BGP nexthop cache:
2001:db8:2:2:: valid [IGP metric 0], #paths 4
gate 2001:db8:12::2, if eth0