]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_vty.c
Merge pull request #12114 from opensourcerouting/feature/bgp_aigp_attribute
[mirror_frr.git] / bgpd / bgp_vty.c
index d84d0919f722d3f5c58d531e59a2134c0b8994df..73919ffab24b00d319c2f775e05a55d521cc010c 100644 (file)
@@ -78,6 +78,8 @@
 #ifdef ENABLE_BGP_VNC
 #include "bgpd/rfapi/bgp_rfapi_cfg.h"
 #endif
+#include "bgpd/bgp_orr.h"
+
 
 FRR_CFG_DEFAULT_BOOL(BGP_IMPORT_CHECK,
        {
@@ -298,7 +300,6 @@ static int bgp_srv6_locator_unset(struct bgp *bgp)
        struct srv6_locator_chunk *chunk;
        struct bgp_srv6_function *func;
        struct bgp *bgp_vrf;
-       struct in6_addr *tovpn_sid;
 
        /* release chunk notification via ZAPI */
        ret = bgp_zebra_srv6_manager_release_locator_chunk(
@@ -309,7 +310,7 @@ static int bgp_srv6_locator_unset(struct bgp *bgp)
        /* refresh chunks */
        for (ALL_LIST_ELEMENTS(bgp->srv6_locator_chunks, node, nnode, chunk)) {
                listnode_delete(bgp->srv6_locator_chunks, chunk);
-               srv6_locator_chunk_free(chunk);
+               srv6_locator_chunk_free(&chunk);
        }
 
        /* refresh functions */
@@ -324,16 +325,15 @@ static int bgp_srv6_locator_unset(struct bgp *bgp)
                        continue;
 
                /* refresh vpnv4 tovpn_sid */
-               tovpn_sid = bgp_vrf->vpn_policy[AFI_IP].tovpn_sid;
-               if (tovpn_sid)
-                       XFREE(MTYPE_BGP_SRV6_SID,
-                             bgp_vrf->vpn_policy[AFI_IP].tovpn_sid);
+               XFREE(MTYPE_BGP_SRV6_SID,
+                     bgp_vrf->vpn_policy[AFI_IP].tovpn_sid);
 
                /* refresh vpnv6 tovpn_sid */
-               tovpn_sid = bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid;
-               if (tovpn_sid)
-                       XFREE(MTYPE_BGP_SRV6_SID,
-                             bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid);
+               XFREE(MTYPE_BGP_SRV6_SID,
+                     bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid);
+
+               /* refresh per-vrf tovpn_sid */
+               XFREE(MTYPE_BGP_SRV6_SID, bgp_vrf->tovpn_sid);
        }
 
        /* update vpn bgp processes */
@@ -345,12 +345,15 @@ static int bgp_srv6_locator_unset(struct bgp *bgp)
                        continue;
 
                /* refresh vpnv4 tovpn_sid_locator */
-               XFREE(MTYPE_BGP_SRV6_SID,
-                     bgp_vrf->vpn_policy[AFI_IP].tovpn_sid_locator);
+               srv6_locator_chunk_free(
+                       &bgp_vrf->vpn_policy[AFI_IP].tovpn_sid_locator);
 
                /* refresh vpnv6 tovpn_sid_locator */
-               XFREE(MTYPE_BGP_SRV6_SID,
-                     bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid_locator);
+               srv6_locator_chunk_free(
+                       &bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid_locator);
+
+               /* refresh per-vrf tovpn_sid_locator */
+               srv6_locator_chunk_free(&bgp_vrf->tovpn_sid_locator);
        }
 
        /* clear locator name */
@@ -873,9 +876,6 @@ int bgp_vty_return(struct vty *vty, enum bgp_create_error_code ret)
        case BGP_ERR_REMOVE_PRIVATE_AS:
                str = "remove-private-AS cannot be configured for IBGP peers";
                break;
-       case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
-               str = "Local-AS allowed only for EBGP peers";
-               break;
        case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
                str = "Cannot have local-as same as BGP AS number";
                break;
@@ -936,9 +936,6 @@ int bgp_vty_return(struct vty *vty, enum bgp_create_error_code ret)
        case BGP_ERR_AF_UNCONFIGURED:
                str = "AFI/SAFI specified is not currently configured.";
                break;
-       case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS_REMOTE_AS:
-               str = "AS specified for local as is the same as the remote as and this is not allowed.";
-               break;
        case BGP_ERR_INVALID_AS:
                str = "Confederation AS specified is the same AS as our AS.";
                break;
@@ -948,6 +945,9 @@ int bgp_vty_return(struct vty *vty, enum bgp_create_error_code ret)
        case BGP_ERR_INVALID_INTERNAL_ROLE:
                str = "External roles can be set only on eBGP session";
                break;
+       case BGP_ERR_PEER_ORR_CONFIGURED:
+               str = "Deconfigure optimal-route-reflection on this peer first";
+               break;
        }
        if (str) {
                vty_out(vty, "%% %s\n", str);
@@ -2354,6 +2354,15 @@ void bgp_config_write_coalesce_time(struct vty *vty, struct bgp *bgp)
                vty_out(vty, " coalesce-time %u\n", bgp->coalesce_time);
 }
 
+/* BGP TCP keepalive */
+static void bgp_config_tcp_keepalive(struct vty *vty, struct bgp *bgp)
+{
+       if (bgp->tcp_keepalive_idle) {
+               vty_out(vty, " bgp tcp-keepalive %u %u %u\n",
+                       bgp->tcp_keepalive_idle, bgp->tcp_keepalive_intvl,
+                       bgp->tcp_keepalive_probes);
+       }
+}
 
 DEFUN (bgp_coalesce_time,
        bgp_coalesce_time_cmd,
@@ -2577,6 +2586,38 @@ DEFUN(no_bgp_minimum_holdtime, no_bgp_minimum_holdtime_cmd,
        return CMD_SUCCESS;
 }
 
+DEFPY(bgp_tcp_keepalive, bgp_tcp_keepalive_cmd,
+      "bgp tcp-keepalive (1-65535)$idle (1-65535)$intvl (1-30)$probes",
+      BGP_STR
+      "TCP keepalive parameters\n"
+      "TCP keepalive idle time (seconds)\n"
+      "TCP keepalive interval (seconds)\n"
+      "TCP keepalive maximum probes\n")
+{
+       VTY_DECLVAR_CONTEXT(bgp, bgp);
+
+       bgp_tcp_keepalive_set(bgp, (uint16_t)idle, (uint16_t)intvl,
+                             (uint16_t)probes);
+
+       return CMD_SUCCESS;
+}
+
+DEFPY(no_bgp_tcp_keepalive, no_bgp_tcp_keepalive_cmd,
+      "no bgp tcp-keepalive [(1-65535) (1-65535) (1-30)]",
+      NO_STR
+      BGP_STR
+      "TCP keepalive parameters\n"
+      "TCP keepalive idle time (seconds)\n"
+      "TCP keepalive interval (seconds)\n"
+      "TCP keepalive maximum probes\n")
+{
+       VTY_DECLVAR_CONTEXT(bgp, bgp);
+
+       bgp_tcp_keepalive_unset(bgp);
+
+       return CMD_SUCCESS;
+}
+
 DEFUN (bgp_client_to_client_reflection,
        bgp_client_to_client_reflection_cmd,
        "bgp client-to-client reflection",
@@ -3526,6 +3567,26 @@ DEFUN (no_bgp_fast_external_failover,
        return CMD_SUCCESS;
 }
 
+DEFPY (bgp_bestpath_aigp,
+       bgp_bestpath_aigp_cmd,
+       "[no$no] bgp bestpath aigp",
+       NO_STR
+       BGP_STR
+       "Change the default bestpath selection\n"
+       "Evaluate the AIGP attribute during the best path selection process\n")
+{
+       VTY_DECLVAR_CONTEXT(bgp, bgp);
+
+       if (no)
+               UNSET_FLAG(bgp->flags, BGP_FLAG_COMPARE_AIGP);
+       else
+               SET_FLAG(bgp->flags, BGP_FLAG_COMPARE_AIGP);
+
+       bgp_recalculate_all_bestpaths(bgp);
+
+       return CMD_SUCCESS;
+}
+
 /* "bgp bestpath compare-routerid" configuration.  */
 DEFUN (bgp_bestpath_compare_router_id,
        bgp_bestpath_compare_router_id_cmd,
@@ -5773,7 +5834,7 @@ ALIAS_HIDDEN(neighbor_remove_private_as_all,
             "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
             NEIGHBOR_STR NEIGHBOR_ADDR_STR2
             "Remove private ASNs in outbound updates\n"
-            "Apply to all AS numbers")
+            "Apply to all AS numbers\n")
 
 DEFUN (neighbor_remove_private_as_replace_as,
        neighbor_remove_private_as_replace_as_cmd,
@@ -6163,6 +6224,43 @@ ALIAS_HIDDEN(no_neighbor_route_reflector_client,
             NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
             "Configure a neighbor as Route Reflector client\n")
 
+/* optimal-route-reflection Root Routers configuration */
+DEFPY (optimal_route_reflection,
+       optimal_route_reflection_cmd,
+       "[no$no] optimal-route-reflection WORD$orr_group [<A.B.C.D|X:X::X:X>$primary [<A.B.C.D|X:X::X:X>$secondary [<A.B.C.D|X:X::X:X>$tertiary]]]",
+       NO_STR
+       "Create ORR group and assign root router(s)\n"
+       "ORR Group name\n"
+       "Primary Root address\n"
+       "Primary Root IPv6 address\n"
+       "Secondary Root address\n"
+       "Secondary Root IPv6 address\n"
+       "Tertiary Root address\n"
+       "Tertiary Root IPv6 address\n")
+{
+       if (!no && !primary) {
+               vty_out(vty, "%% Specify Primary Root address\n");
+               return CMD_WARNING_CONFIG_FAILED;
+       }
+       return bgp_afi_safi_orr_group_set_vty(
+               vty, bgp_node_afi(vty), bgp_node_safi(vty), orr_group,
+               primary_str, secondary_str, tertiary_str, !!no);
+}
+
+/* neighbor optimal-route-reflection group*/
+DEFPY (neighbor_optimal_route_reflection,
+       neighbor_optimal_route_reflection_cmd,
+       "[no$no] neighbor <A.B.C.D|X:X::X:X|WORD>$neighbor optimal-route-reflection WORD$orr_group",
+       NO_STR
+       NEIGHBOR_STR
+       NEIGHBOR_ADDR_STR2
+       "Apply ORR group configuration to the neighbor\n"
+       "ORR group name\n")
+{
+       return peer_orr_group_set_vty(vty, neighbor, bgp_node_afi(vty),
+                                     bgp_node_safi(vty), orr_group, !!no);
+}
+
 /* neighbor route-server-client. */
 DEFUN (neighbor_route_server_client,
        neighbor_route_server_client_cmd,
@@ -6469,6 +6567,26 @@ DEFUN (no_neighbor_ebgp_multihop,
        return peer_ebgp_multihop_unset_vty(vty, argv[idx_peer]->arg);
 }
 
+DEFPY (neighbor_aigp,
+       neighbor_aigp_cmd,
+       "[no$no] neighbor <A.B.C.D|X:X::X:X|WORD>$neighbor aigp",
+       NO_STR
+       NEIGHBOR_STR
+       NEIGHBOR_ADDR_STR2
+       "Enable send and receive of the AIGP attribute per neighbor\n")
+{
+       struct peer *peer;
+
+       peer = peer_and_group_lookup_vty(vty, neighbor);
+       if (!peer)
+               return CMD_WARNING_CONFIG_FAILED;
+
+       if (no)
+               return peer_flag_unset_vty(vty, neighbor, PEER_FLAG_AIGP);
+       else
+               return peer_flag_set_vty(vty, neighbor, PEER_FLAG_AIGP);
+}
+
 static uint8_t get_role_by_name(const char *role_str)
 {
        if (strncmp(role_str, "peer", 2) == 0)
@@ -8247,6 +8365,32 @@ ALIAS_HIDDEN(
        "Only give warning message when limit is exceeded\n"
        "Force checking all received routes not only accepted\n")
 
+/* "neighbor accept-own" */
+DEFPY (neighbor_accept_own,
+       neighbor_accept_own_cmd,
+       "[no$no] neighbor <A.B.C.D|X:X::X:X|WORD>$neighbor accept-own",
+       NO_STR
+       NEIGHBOR_STR
+       NEIGHBOR_ADDR_STR2
+       "Enable handling of self-originated VPN routes containing ACCEPT_OWN community\n")
+{
+       struct peer *peer;
+       afi_t afi = bgp_node_afi(vty);
+       safi_t safi = bgp_node_safi(vty);
+       int ret;
+
+       peer = peer_and_group_lookup_vty(vty, neighbor);
+       if (!peer)
+               return CMD_WARNING_CONFIG_FAILED;
+
+       if (no)
+               ret = peer_af_flag_unset(peer, afi, safi, PEER_FLAG_ACCEPT_OWN);
+       else
+               ret = peer_af_flag_set(peer, afi, safi, PEER_FLAG_ACCEPT_OWN);
+
+       return bgp_vty_return(vty, ret);
+}
+
 /* "neighbor soo" */
 DEFPY (neighbor_soo,
        neighbor_soo_cmd,
@@ -8860,7 +9004,7 @@ DEFPY (af_label_vpn_export,
 
 DEFPY (af_sid_vpn_export,
        af_sid_vpn_export_cmd,
-       "[no] sid vpn export <(1-255)$sid_idx|auto$sid_auto>",
+       "[no] sid vpn export <(1-1048575)$sid_idx|auto$sid_auto>",
        NO_STR
        "sid value for VRF\n"
        "Between current address-family and vpn\n"
@@ -8889,6 +9033,14 @@ DEFPY (af_sid_vpn_export,
                return CMD_WARNING_CONFIG_FAILED;
        }
 
+       if (bgp->tovpn_sid_index != 0 ||
+           CHECK_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO)) {
+               vty_out(vty,
+                       "per-vrf sid and per-af sid are mutually exclusive\n"
+                       "Failed: per-vrf sid is configured. Remove per-vrf sid before configuring per-af sid\n");
+               return CMD_WARNING_CONFIG_FAILED;
+       }
+
        /* skip when it's already configured */
        if ((sid_idx != 0 && bgp->vpn_policy[afi].tovpn_sid_index != 0)
            || (sid_auto && CHECK_FLAG(bgp->vpn_policy[afi].flags,
@@ -8930,6 +9082,92 @@ DEFPY (af_sid_vpn_export,
        return CMD_SUCCESS;
 }
 
+DEFPY (bgp_sid_vpn_export,
+       bgp_sid_vpn_export_cmd,
+       "[no] sid vpn per-vrf export <(1-255)$sid_idx|auto$sid_auto>",
+       NO_STR
+       "sid value for VRF\n"
+       "Between current vrf and vpn\n"
+       "sid per-VRF (both IPv4 and IPv6 address families)\n"
+       "For routes leaked from current vrf to vpn\n"
+       "Sid allocation index\n"
+       "Automatically assign a label\n")
+{
+       VTY_DECLVAR_CONTEXT(bgp, bgp);
+       int debug;
+
+       debug = (BGP_DEBUG(vpn, VPN_LEAK_TO_VRF) |
+                BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF));
+
+       if (no) {
+               /* when per-VRF SID is not set, do nothing */
+               if (bgp->tovpn_sid_index == 0 &&
+                   !CHECK_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO))
+                       return CMD_SUCCESS;
+
+               sid_idx = 0;
+               sid_auto = false;
+               bgp->tovpn_sid_index = 0;
+               UNSET_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO);
+       }
+
+       if (bgp->vpn_policy[AFI_IP].tovpn_sid_index != 0 ||
+           CHECK_FLAG(bgp->vpn_policy[AFI_IP].flags,
+                      BGP_VPN_POLICY_TOVPN_SID_AUTO) ||
+           bgp->vpn_policy[AFI_IP6].tovpn_sid_index != 0 ||
+           CHECK_FLAG(bgp->vpn_policy[AFI_IP6].flags,
+                      BGP_VPN_POLICY_TOVPN_SID_AUTO)) {
+               vty_out(vty,
+                       "per-vrf sid and per-af sid are mutually exclusive\n"
+                       "Failed: per-af sid is configured. Remove per-af sid before configuring per-vrf sid\n");
+               return CMD_WARNING_CONFIG_FAILED;
+       }
+
+       /* skip when it's already configured */
+       if ((sid_idx != 0 && bgp->tovpn_sid_index != 0) ||
+           (sid_auto && CHECK_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO)))
+               return CMD_SUCCESS;
+
+       /*
+        * mode change between sid_idx and sid_auto isn't supported.
+        * user must negate sid vpn export when they want to change the mode
+        */
+       if ((sid_auto && bgp->tovpn_sid_index != 0) ||
+           (sid_idx != 0 &&
+            CHECK_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO))) {
+               vty_out(vty, "it's already configured as %s.\n",
+                       sid_auto ? "auto-mode" : "idx-mode");
+               return CMD_WARNING_CONFIG_FAILED;
+       }
+
+       /* pre-change */
+       vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN, AFI_IP, bgp_get_default(),
+                          bgp);
+       vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN, AFI_IP6, bgp_get_default(),
+                          bgp);
+
+       if (sid_auto) {
+               /* SID allocation auto-mode */
+               if (debug)
+                       zlog_debug("%s: auto per-vrf sid alloc.", __func__);
+               SET_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO);
+       } else if (sid_idx != 0) {
+               /* SID allocation index-mode */
+               if (debug)
+                       zlog_debug("%s: idx %ld per-vrf sid alloc.", __func__,
+                                  sid_idx);
+               bgp->tovpn_sid_index = sid_idx;
+       }
+
+       /* post-change */
+       vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN, AFI_IP, bgp_get_default(),
+                           bgp);
+       vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN, AFI_IP6,
+                           bgp_get_default(), bgp);
+
+       return CMD_SUCCESS;
+}
+
 ALIAS (af_label_vpn_export,
        af_no_label_vpn_export_cmd,
        "no label vpn export",
@@ -8938,6 +9176,15 @@ ALIAS (af_label_vpn_export,
        "Between current address-family and vpn\n"
        "For routes leaked from current address-family to vpn\n")
 
+ALIAS (bgp_sid_vpn_export,
+       no_bgp_sid_vpn_export_cmd,
+       "no$no sid vpn per-vrf export",
+       NO_STR
+       "sid value for VRF\n"
+       "Between current vrf and vpn\n"
+       "sid per-VRF (both IPv4 and IPv6 address families)\n"
+       "For routes leaked from current vrf to vpn\n")
+
 DEFPY (af_nexthop_vpn_export,
        af_nexthop_vpn_export_cmd,
        "[no] nexthop vpn export [<A.B.C.D|X:X::X:X>$nexthop_su]",
@@ -9637,11 +9884,7 @@ DEFPY (show_bgp_srv6,
        struct listnode *node;
        struct srv6_locator_chunk *chunk;
        struct bgp_srv6_function *func;
-       struct in6_addr *tovpn4_sid;
-       struct in6_addr *tovpn6_sid;
        char buf[256];
-       char buf_tovpn4_sid[256];
-       char buf_tovpn6_sid[256];
 
        bgp = bgp_get_default();
        if (!bgp)
@@ -9649,8 +9892,14 @@ DEFPY (show_bgp_srv6,
 
        vty_out(vty, "locator_name: %s\n", bgp->srv6_locator_name);
        vty_out(vty, "locator_chunks:\n");
-       for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, chunk))
+       for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, chunk)) {
                vty_out(vty, "- %pFX\n", &chunk->prefix);
+               vty_out(vty, "  block-length: %d\n", chunk->block_bits_length);
+               vty_out(vty, "  node-length: %d\n", chunk->node_bits_length);
+               vty_out(vty, "  func-length: %d\n",
+                       chunk->function_bits_length);
+               vty_out(vty, "  arg-length: %d\n", chunk->argument_bits_length);
+       }
 
        vty_out(vty, "functions:\n");
        for (ALL_LIST_ELEMENTS_RO(bgp->srv6_functions, node, func)) {
@@ -9664,19 +9913,11 @@ DEFPY (show_bgp_srv6,
                vty_out(vty, "- name: %s\n",
                        bgp->name ? bgp->name : "default");
 
-               tovpn4_sid = bgp->vpn_policy[AFI_IP].tovpn_sid;
-               tovpn6_sid = bgp->vpn_policy[AFI_IP6].tovpn_sid;
-               if (tovpn4_sid)
-                       inet_ntop(AF_INET6, tovpn4_sid, buf_tovpn4_sid,
-                                 sizeof(buf_tovpn4_sid));
-               if (tovpn6_sid)
-                       inet_ntop(AF_INET6, tovpn6_sid, buf_tovpn6_sid,
-                                 sizeof(buf_tovpn6_sid));
-
-               vty_out(vty, "  vpn_policy[AFI_IP].tovpn_sid: %s\n",
-                       tovpn4_sid ? buf_tovpn4_sid : "none");
-               vty_out(vty, "  vpn_policy[AFI_IP6].tovpn_sid: %s\n",
-                       tovpn6_sid ? buf_tovpn6_sid : "none");
+               vty_out(vty, "  vpn_policy[AFI_IP].tovpn_sid: %pI6\n",
+                       bgp->vpn_policy[AFI_IP].tovpn_sid);
+               vty_out(vty, "  vpn_policy[AFI_IP6].tovpn_sid: %pI6\n",
+                       bgp->vpn_policy[AFI_IP6].tovpn_sid);
+               vty_out(vty, "  per-vrf tovpn_sid: %pI6\n", bgp->tovpn_sid);
        }
 
        return CMD_SUCCESS;
@@ -12073,6 +12314,16 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
                                json_addr,
                                "privateAsNumsRemovedInUpdatesToNbr");
 
+               if (CHECK_FLAG(p->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN)) {
+                       if (CHECK_FLAG(p->af_flags[afi][safi],
+                                      PEER_FLAG_ALLOWAS_IN_ORIGIN))
+                               json_object_boolean_true_add(json_addr,
+                                                            "allowAsInOrigin");
+                       else
+                               json_object_int_add(json_addr, "allowAsInCount",
+                                                   p->allowas_in[afi][safi]);
+               }
+
                if (p->addpath_type[afi][safi] != BGP_ADDPATH_NONE)
                        json_object_boolean_true_add(
                                json_addr,
@@ -12363,6 +12614,11 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
                if (CHECK_FLAG(p->af_flags[afi][safi],
                               PEER_FLAG_RSERVER_CLIENT))
                        vty_out(vty, "  Route-Server Client\n");
+
+               if (peer_af_flag_check(p, afi, safi, PEER_FLAG_ORR_GROUP))
+                       vty_out(vty, "  ORR group (configured) : %s\n",
+                               p->orr_group_name[afi][safi]);
+
                if (CHECK_FLAG(p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
                        vty_out(vty,
                                "  Inbound soft reconfiguration allowed\n");
@@ -12384,6 +12640,17 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
                        vty_out(vty,
                                "  Private AS numbers removed in updates to this neighbor\n");
 
+               if (CHECK_FLAG(p->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN)) {
+                       if (CHECK_FLAG(p->af_flags[afi][safi],
+                                      PEER_FLAG_ALLOWAS_IN_ORIGIN))
+                               vty_out(vty,
+                                       "  Local AS allowed as path origin\n");
+                       else
+                               vty_out(vty,
+                                       "  Local AS allowed in path, %d occurrences\n",
+                                       p->allowas_in[afi][safi]);
+               }
+
                if (p->addpath_type[afi][safi] != BGP_ADDPATH_NONE)
                        vty_out(vty, "  %s\n",
                                bgp_addpath_names(p->addpath_type[afi][safi])
@@ -14735,7 +15002,7 @@ static int bgp_show_neighbor_vty(struct vty *vty, const char *name,
 
 
 /* "show [ip] bgp neighbors graceful-restart" commands.  */
-DEFUN (show_ip_bgp_neighbors_gracrful_restart,
+DEFUN (show_ip_bgp_neighbors_graceful_restart,
        show_ip_bgp_neighbors_graceful_restart_cmd,
        "show bgp [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|WORD>] graceful-restart [json]",
        SHOW_STR
@@ -14993,7 +15260,6 @@ static int bgp_show_route_leak_vty(struct vty *vty, const char *name,
        struct bgp *bgp;
        struct listnode *node;
        char *vname;
-       char buf1[INET6_ADDRSTRLEN];
        char *ecom_str;
        enum vpn_policy_direction dir;
 
@@ -15058,9 +15324,9 @@ static int bgp_show_route_leak_vty(struct vty *vty, const char *name,
                                                json_object_new_string(vname));
                        json_object_object_add(json, "exportToVrfs",
                                               json_export_vrfs);
-                       json_object_string_add(json, "routeDistinguisher",
-                                  prefix_rd2str(&bgp->vpn_policy[afi].tovpn_rd,
-                                                buf1, RD_ADDRSTRLEN));
+                       json_object_string_addf(json, "routeDistinguisher",
+                                               "%pRD",
+                                               &bgp->vpn_policy[afi].tovpn_rd);
 
                        dir = BGP_VPN_POLICY_DIR_TOVPN;
                        if (bgp->vpn_policy[afi].rtlist[dir]) {
@@ -15129,9 +15395,8 @@ static int bgp_show_route_leak_vty(struct vty *vty, const char *name,
                                                node, vname))
                                vty_out(vty, "  %s\n", vname);
 
-                       vty_out(vty, "RD: %s\n",
-                               prefix_rd2str(&bgp->vpn_policy[afi].tovpn_rd,
-                                             buf1, RD_ADDRSTRLEN));
+                       vty_out(vty, "RD: %pRD\n",
+                               &bgp->vpn_policy[afi].tovpn_rd);
 
                        dir = BGP_VPN_POLICY_DIR_TOVPN;
                        if (bgp->vpn_policy[afi].rtlist[dir]) {
@@ -16621,13 +16886,10 @@ static void bgp_vpn_policy_config_write_afi(struct vty *vty, struct bgp *bgp,
                        tovpn_sid_index);
        }
 
-       if (CHECK_FLAG(bgp->vpn_policy[afi].flags,
-                      BGP_VPN_POLICY_TOVPN_RD_SET)) {
-               char buf[RD_ADDRSTRLEN];
-               vty_out(vty, "%*srd vpn export %s\n", indent, "",
-                       prefix_rd2str(&bgp->vpn_policy[afi].tovpn_rd, buf,
-                                     sizeof(buf)));
-       }
+       if (CHECK_FLAG(bgp->vpn_policy[afi].flags, BGP_VPN_POLICY_TOVPN_RD_SET))
+               vty_out(vty, "%*srd vpn export %pRD\n", indent, "",
+                       &bgp->vpn_policy[afi].tovpn_rd);
+
        if (CHECK_FLAG(bgp->vpn_policy[afi].flags,
                       BGP_VPN_POLICY_TOVPN_NEXTHOP_SET)) {
 
@@ -16932,6 +17194,10 @@ static void bgp_config_write_peer_global(struct vty *vty, struct bgp *bgp,
                }
        }
 
+       /* aigp */
+       if (peergroup_flag_check(peer, PEER_FLAG_AIGP))
+               vty_out(vty, " neighbor %s aigp\n", addr);
+
        /* role */
        if (peergroup_flag_check(peer, PEER_FLAG_ROLE) &&
            peer->local_role != ROLE_UNDEFINED)
@@ -17295,6 +17561,10 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
                }
        }
 
+       /* accept-own */
+       if (peergroup_af_flag_check(peer, afi, safi, PEER_FLAG_ACCEPT_OWN))
+               vty_out(vty, "  neighbor %s accept-own\n", addr);
+
        /* soo */
        if (peergroup_af_flag_check(peer, afi, safi, PEER_FLAG_SOO)) {
                char *soo_str = ecommunity_ecom2str(
@@ -17344,6 +17614,10 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
                                        : "");
                }
        }
+
+       if (peer_af_flag_check(peer, afi, safi, PEER_FLAG_ORR_GROUP))
+               vty_out(vty, "  neighbor %s optimal-route-reflection %s\n",
+                       addr, peer->orr_group_name[afi][safi]);
 }
 
 static void bgp_vpn_config_write(struct vty *vty, struct bgp *bgp, afi_t afi,
@@ -17450,6 +17724,9 @@ static void bgp_config_write_family(struct vty *vty, struct bgp *bgp, afi_t afi,
                }
        }
 
+       /* Optimal Route Reflection */
+       bgp_config_write_orr(vty, bgp, afi, safi);
+
        vty_endframe(vty, " exit-address-family\n");
 }
 
@@ -17462,6 +17739,7 @@ int bgp_config_write(struct vty *vty)
        struct listnode *mnode, *mnnode;
        afi_t afi;
        safi_t safi;
+       uint32_t tovpn_sid_index = 0;
 
        if (bm->rmap_update_timer != RMAP_DEFAULT_UPDATE_TIMER)
                vty_out(vty, "bgp route-map delay-timer %u\n",
@@ -17491,6 +17769,10 @@ int bgp_config_write(struct vty *vty)
        if (bm->tcp_dscp != IPTOS_PREC_INTERNETCONTROL)
                vty_out(vty, "bgp session-dscp %u\n", bm->tcp_dscp >> 2);
 
+       /* BGP InQ limit */
+       if (bm->inq_limit != BM_DEFAULT_INQ_LIMIT)
+               vty_out(vty, "bgp input-queue-limit %u\n", bm->inq_limit);
+
        /* BGP configuration. */
        for (ALL_LIST_ELEMENTS(bm->bgp, mnode, mnnode, bgp)) {
 
@@ -17722,6 +18004,9 @@ int bgp_config_write(struct vty *vty)
                        vty_out(vty,
                                " bgp graceful-restart preserve-fw-state\n");
 
+               /* BGP TCP keepalive */
+               bgp_config_tcp_keepalive(vty, bgp);
+
                /* Stale timer for RIB */
                if (bgp->rib_stale_time != BGP_DEFAULT_RIB_STALE_TIME)
                        vty_out(vty,
@@ -17751,6 +18036,8 @@ int bgp_config_write(struct vty *vty)
                }
                if (CHECK_FLAG(bgp->flags, BGP_FLAG_COMPARE_ROUTER_ID))
                        vty_out(vty, " bgp bestpath compare-routerid\n");
+               if (CHECK_FLAG(bgp->flags, BGP_FLAG_COMPARE_AIGP))
+                       vty_out(vty, " bgp bestpath aigp\n");
                if (CHECK_FLAG(bgp->flags, BGP_FLAG_MED_CONFED)
                    || CHECK_FLAG(bgp->flags, BGP_FLAG_MED_MISSING_AS_WORST)) {
                        vty_out(vty, " bgp bestpath med");
@@ -17843,6 +18130,13 @@ int bgp_config_write(struct vty *vty)
                        vty_endframe(vty, " exit\n");
                }
 
+               tovpn_sid_index = bgp->tovpn_sid_index;
+               if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO)) {
+                       vty_out(vty, " sid vpn per-vrf export auto\n");
+               } else if (tovpn_sid_index != 0) {
+                       vty_out(vty, " sid vpn per-vrf export %d\n",
+                               tovpn_sid_index);
+               }
 
                /* IPv4 unicast configuration.  */
                bgp_config_write_family(vty, bgp, AFI_IP, SAFI_UNICAST);
@@ -18193,6 +18487,31 @@ DEFPY(mpls_bgp_forwarding, mpls_bgp_forwarding_cmd,
        return CMD_SUCCESS;
 }
 
+DEFPY (bgp_inq_limit,
+       bgp_inq_limit_cmd,
+       "bgp input-queue-limit (1-4294967295)$limit",
+       BGP_STR
+       "Set the BGP Input Queue limit for all peers when message parsing\n"
+       "Input-Queue limit\n")
+{
+       bm->inq_limit = limit;
+
+       return CMD_SUCCESS;
+}
+
+DEFPY (no_bgp_inq_limit,
+       no_bgp_inq_limit_cmd,
+       "no bgp input-queue-limit [(1-4294967295)$limit]",
+       NO_STR
+       BGP_STR
+       "Set the BGP Input Queue limit for all peers when message parsing\n"
+       "Input-Queue limit\n")
+{
+       bm->inq_limit = BM_DEFAULT_INQ_LIMIT;
+
+       return CMD_SUCCESS;
+}
+
 /* Initialization of BGP interface. */
 static void bgp_vty_if_init(void)
 {
@@ -18242,6 +18561,10 @@ void bgp_vty_init(void)
        install_default(BGP_EVPN_VNI_NODE);
        install_default(BGP_SRV6_NODE);
 
+       /* "global bgp inq-limit command */
+       install_element(CONFIG_NODE, &bgp_inq_limit_cmd);
+       install_element(CONFIG_NODE, &no_bgp_inq_limit_cmd);
+
        /* "bgp local-mac" hidden commands. */
        install_element(CONFIG_NODE, &bgp_local_mac_cmd);
        install_element(CONFIG_NODE, &no_bgp_local_mac_cmd);
@@ -18318,6 +18641,9 @@ void bgp_vty_init(void)
        install_element(BGP_NODE, &neighbor_role_strict_cmd);
        install_element(BGP_NODE, &no_neighbor_role_cmd);
 
+       /* "neighbor aigp" commands. */
+       install_element(BGP_NODE, &neighbor_aigp_cmd);
+
        /* bgp disable-ebgp-connected-nh-check */
        install_element(BGP_NODE, &bgp_disable_connected_route_check_cmd);
        install_element(BGP_NODE, &no_bgp_disable_connected_route_check_cmd);
@@ -18437,6 +18763,10 @@ void bgp_vty_init(void)
        install_element(BGP_NODE, &bgp_graceful_restart_rib_stale_time_cmd);
        install_element(BGP_NODE, &no_bgp_graceful_restart_rib_stale_time_cmd);
 
+       /* "bgp inq-limit command */
+       install_element(BGP_NODE, &bgp_inq_limit_cmd);
+       install_element(BGP_NODE, &no_bgp_inq_limit_cmd);
+
        /* "bgp graceful-shutdown" commands */
        install_element(BGP_NODE, &bgp_graceful_shutdown_cmd);
        install_element(BGP_NODE, &no_bgp_graceful_shutdown_cmd);
@@ -18452,6 +18782,9 @@ void bgp_vty_init(void)
        install_element(BGP_NODE, &bgp_fast_external_failover_cmd);
        install_element(BGP_NODE, &no_bgp_fast_external_failover_cmd);
 
+       /* "bgp bestpath aigp" commands */
+       install_element(BGP_NODE, &bgp_bestpath_aigp_cmd);
+
        /* "bgp bestpath compare-routerid" commands */
        install_element(BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
        install_element(BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
@@ -18956,6 +19289,34 @@ void bgp_vty_init(void)
        install_element(BGP_EVPN_NODE, &neighbor_route_reflector_client_cmd);
        install_element(BGP_EVPN_NODE, &no_neighbor_route_reflector_client_cmd);
 
+       /* "optimal-route-reflection" commands */
+       install_element(BGP_IPV4_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_IPV4M_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_IPV4L_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_IPV6_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_IPV6M_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_IPV6L_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_VPNV4_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_VPNV6_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_FLOWSPECV4_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_FLOWSPECV6_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_EVPN_NODE, &optimal_route_reflection_cmd);
+
+       /* "neighbor optimal-route-reflection" commands */
+       install_element(BGP_IPV4_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_IPV4M_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_IPV4L_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_IPV6_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_IPV6M_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_IPV6L_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_VPNV4_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_VPNV6_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_FLOWSPECV4_NODE,
+                       &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_FLOWSPECV6_NODE,
+                       &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_EVPN_NODE, &neighbor_optimal_route_reflection_cmd);
+
        /* "neighbor route-server" commands.*/
        install_element(BGP_NODE, &neighbor_route_server_client_hidden_cmd);
        install_element(BGP_NODE, &no_neighbor_route_server_client_hidden_cmd);
@@ -19466,6 +19827,10 @@ void bgp_vty_init(void)
        install_element(BGP_EVPN_NODE, &neighbor_allowas_in_cmd);
        install_element(BGP_EVPN_NODE, &no_neighbor_allowas_in_cmd);
 
+       /* neighbor accept-own */
+       install_element(BGP_VPNV4_NODE, &neighbor_accept_own_cmd);
+       install_element(BGP_VPNV6_NODE, &neighbor_accept_own_cmd);
+
        /* "neighbor soo" */
        install_element(BGP_IPV4_NODE, &neighbor_soo_cmd);
        install_element(BGP_IPV4_NODE, &no_neighbor_soo_cmd);
@@ -19601,6 +19966,10 @@ void bgp_vty_init(void)
        install_element(BGP_NODE, &neighbor_ttl_security_cmd);
        install_element(BGP_NODE, &no_neighbor_ttl_security_cmd);
 
+       /* "bgp tcp-keepalive" commands */
+       install_element(BGP_NODE, &bgp_tcp_keepalive_cmd);
+       install_element(BGP_NODE, &no_bgp_tcp_keepalive_cmd);
+
        /* "show [ip] bgp memory" commands. */
        install_element(VIEW_NODE, &show_bgp_memory_cmd);
 
@@ -19660,6 +20029,8 @@ void bgp_vty_init(void)
        install_element(BGP_SRV6_NODE, &no_bgp_srv6_locator_cmd);
        install_element(BGP_IPV4_NODE, &af_sid_vpn_export_cmd);
        install_element(BGP_IPV6_NODE, &af_sid_vpn_export_cmd);
+       install_element(BGP_NODE, &bgp_sid_vpn_export_cmd);
+       install_element(BGP_NODE, &no_bgp_sid_vpn_export_cmd);
 
        bgp_vty_if_init();
 }