summaryrefslogtreecommitdiff
path: root/bgpd/bgp_vty.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_vty.c')
-rw-r--r--bgpd/bgp_vty.c83
1 files changed, 63 insertions, 20 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 4b79789b0c..a6c00d5735 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -3727,6 +3727,29 @@ DEFPY (no_bgp_bestpath_bw,
return CMD_SUCCESS;
}
+/* "no bgp default ipv6-unicast". */
+DEFUN(no_bgp_default_ipv6_unicast, no_bgp_default_ipv6_unicast_cmd,
+ "no bgp default ipv6-unicast", NO_STR
+ "BGP specific commands\n"
+ "Configure BGP defaults\n"
+ "Activate ipv6-unicast for a peer by default\n")
+{
+ VTY_DECLVAR_CONTEXT(bgp, bgp);
+ UNSET_FLAG(bgp->flags, BGP_FLAG_DEFAULT_IPV6);
+ return CMD_SUCCESS;
+}
+
+DEFUN(bgp_default_ipv6_unicast, bgp_default_ipv6_unicast_cmd,
+ "bgp default ipv6-unicast",
+ "BGP specific commands\n"
+ "Configure BGP defaults\n"
+ "Activate ipv6-unicast for a peer by default\n")
+{
+ VTY_DECLVAR_CONTEXT(bgp, bgp);
+ SET_FLAG(bgp->flags, BGP_FLAG_DEFAULT_IPV6);
+ return CMD_SUCCESS;
+}
+
/* "no bgp default ipv4-unicast". */
DEFUN (no_bgp_default_ipv4_unicast,
no_bgp_default_ipv4_unicast_cmd,
@@ -4368,10 +4391,10 @@ DEFUN_YANG(neighbor_remote_as,
return nb_cli_apply_changes(vty, base_xpath);
}
-int peer_conf_interface_create(struct bgp *bgp, const char *conf_if, afi_t afi,
- safi_t safi, bool v6only,
- const char *peer_group_name, int as_type,
- as_t as, char *errmsg, size_t errmsg_len)
+int peer_conf_interface_create(struct bgp *bgp, const char *conf_if,
+ bool v6only, const char *peer_group_name,
+ int as_type, as_t as, char *errmsg,
+ size_t errmsg_len)
{
struct peer *peer;
struct peer_group *group;
@@ -4388,16 +4411,10 @@ int peer_conf_interface_create(struct bgp *bgp, const char *conf_if, afi_t afi,
peer = peer_lookup_by_conf_if(bgp, conf_if);
if (peer) {
if (as_type != AS_UNSPECIFIED)
- ret = peer_remote_as(bgp, NULL, conf_if, &as, as_type,
- afi, safi);
+ ret = peer_remote_as(bgp, NULL, conf_if, &as, as_type);
} else {
- if (CHECK_FLAG(bgp->flags, BGP_FLAG_NO_DEFAULT_IPV4)
- && afi == AFI_IP && safi == SAFI_UNICAST)
- peer = peer_create(NULL, conf_if, bgp, bgp->as, as,
- as_type, 0, 0, NULL);
- else
- peer = peer_create(NULL, conf_if, bgp, bgp->as, as,
- as_type, afi, safi, NULL);
+ peer = peer_create(NULL, conf_if, bgp, bgp->as, as, as_type,
+ NULL);
if (!peer) {
snprintf(errmsg, errmsg_len,
@@ -17002,18 +17019,36 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
}
} else {
if (peer->afc[afi][safi]) {
- if ((afi == AFI_IP) && (safi == SAFI_UNICAST)) {
- if (CHECK_FLAG(bgp->flags,
- BGP_FLAG_NO_DEFAULT_IPV4)) {
+ if ((afi == AFI_IP || afi == AFI_IP6)
+ && safi == SAFI_UNICAST) {
+ if (afi == AFI_IP
+ && CHECK_FLAG(bgp->flags,
+ BGP_FLAG_NO_DEFAULT_IPV4)) {
+ vty_out(vty, " neighbor %s activate\n",
+ addr);
+ } else if (afi == AFI_IP6
+ && !CHECK_FLAG(
+ bgp->flags,
+ BGP_FLAG_DEFAULT_IPV6)) {
vty_out(vty, " neighbor %s activate\n",
addr);
}
- } else
+ } else {
vty_out(vty, " neighbor %s activate\n", addr);
+ }
} else {
- if ((afi == AFI_IP) && (safi == SAFI_UNICAST)) {
- if (!CHECK_FLAG(bgp->flags,
- BGP_FLAG_NO_DEFAULT_IPV4)) {
+ if ((afi == AFI_IP || afi == AFI_IP6)
+ && safi == SAFI_UNICAST) {
+ if (afi == AFI_IP
+ && !CHECK_FLAG(bgp->flags,
+ BGP_FLAG_NO_DEFAULT_IPV4)) {
+ vty_out(vty,
+ " no neighbor %s activate\n",
+ addr);
+ } else if (afi == AFI_IP6
+ && CHECK_FLAG(
+ bgp->flags,
+ BGP_FLAG_DEFAULT_IPV6)) {
vty_out(vty,
" no neighbor %s activate\n",
addr);
@@ -17447,6 +17482,10 @@ int bgp_config_write(struct vty *vty)
if (CHECK_FLAG(bgp->flags, BGP_FLAG_NO_DEFAULT_IPV4))
vty_out(vty, " no bgp default ipv4-unicast\n");
+ /* BGP default ipv6-unicast. */
+ if (CHECK_FLAG(bgp->flags, BGP_FLAG_DEFAULT_IPV6))
+ vty_out(vty, " bgp default ipv6-unicast\n");
+
/* BGP default local-preference. */
if (bgp->default_local_pref != BGP_DEFAULT_LOCAL_PREF)
vty_out(vty, " bgp default local-preference %u\n",
@@ -18117,6 +18156,10 @@ void bgp_vty_init(void)
install_element(BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
install_element(BGP_NODE, &bgp_default_ipv4_unicast_cmd);
+ /* "no bgp default ipv6-unicast" commands. */
+ install_element(BGP_NODE, &no_bgp_default_ipv6_unicast_cmd);
+ install_element(BGP_NODE, &bgp_default_ipv6_unicast_cmd);
+
/* "bgp network import-check" commands. */
install_element(BGP_NODE, &bgp_network_import_check_cmd);
install_element(BGP_NODE, &bgp_network_import_check_exact_cmd);