diff options
| -rw-r--r-- | bgpd/bgp_route.c | 44 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 91 | ||||
| -rw-r--r-- | bgpd/bgpd.c | 158 | ||||
| -rw-r--r-- | bgpd/bgpd.h | 6 |
4 files changed, 46 insertions, 253 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 31243c899d..0b94d1ffbf 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -12373,30 +12373,9 @@ void bgp_config_write_network(struct vty *vty, struct bgp *bgp, afi_t afi, p = &rn->p; - /* "network" configuration display. */ - if (bgp_option_check(BGP_OPT_CONFIG_CISCO) && afi == AFI_IP) { - uint32_t destination; - struct in_addr netmask; - - destination = ntohl(p->u.prefix4.s_addr); - masklen2ip(p->prefixlen, &netmask); - vty_out(vty, " network %s", - inet_ntop(p->family, &p->u.prefix, buf, - SU_ADDRSTRLEN)); - - if ((IN_CLASSC(destination) && p->prefixlen == 24) - || (IN_CLASSB(destination) && p->prefixlen == 16) - || (IN_CLASSA(destination) && p->prefixlen == 8) - || p->u.prefix4.s_addr == 0) { - /* Natural mask is not display. */ - } else - vty_out(vty, " mask %s", inet_ntoa(netmask)); - } else { - vty_out(vty, " network %s/%d", - inet_ntop(p->family, &p->u.prefix, buf, - SU_ADDRSTRLEN), - p->prefixlen); - } + vty_out(vty, " network %s/%d", + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen); if (bgp_static->label_index != BGP_INVALID_LABEL_INDEX) vty_out(vty, " label-index %u", @@ -12420,20 +12399,9 @@ void bgp_config_write_network(struct vty *vty, struct bgp *bgp, afi_t afi, p = &rn->p; - if (bgp_option_check(BGP_OPT_CONFIG_CISCO) && afi == AFI_IP) { - struct in_addr netmask; - - masklen2ip(p->prefixlen, &netmask); - vty_out(vty, " aggregate-address %s %s", - inet_ntop(p->family, &p->u.prefix, buf, - SU_ADDRSTRLEN), - inet_ntoa(netmask)); - } else { - vty_out(vty, " aggregate-address %s/%d", - inet_ntop(p->family, &p->u.prefix, buf, - SU_ADDRSTRLEN), - p->prefixlen); - } + vty_out(vty, " aggregate-address %s/%d", + inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), + p->prefixlen); if (bgp_aggregate->as_set) vty_out(vty, " as-set"); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 6451c8d8ed..7dc3f02b0d 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -815,41 +815,6 @@ static void bgp_clear_star_soft_out(struct vty *vty, const char *name) #include "bgpd/bgp_vty_clippy.c" #endif -/* BGP global configuration. */ -#if (CONFDATE > 20190601) -CPP_NOTICE("bgpd: time to remove deprecated bgp multiple-instance") -CPP_NOTICE("This includes BGP_OPT_MULTIPLE_INSTANCE") -#endif -DEFUN_HIDDEN (bgp_multiple_instance_func, - bgp_multiple_instance_cmd, - "bgp multiple-instance", - BGP_STR - "Enable bgp multiple instance\n") -{ - bgp_option_set(BGP_OPT_MULTIPLE_INSTANCE); - return CMD_SUCCESS; -} - -DEFUN_HIDDEN (no_bgp_multiple_instance, - no_bgp_multiple_instance_cmd, - "no bgp multiple-instance", - NO_STR - BGP_STR - "BGP multiple instance\n") -{ - int ret; - - vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n"); - vty_out(vty, "if you are using this please let the developers know\n"); - zlog_info("Deprecated option: `bgp multiple-instance` being used"); - ret = bgp_option_unset(BGP_OPT_MULTIPLE_INSTANCE); - if (ret < 0) { - vty_out(vty, "%% There are more than two BGP instances\n"); - return CMD_WARNING_CONFIG_FAILED; - } - return CMD_SUCCESS; -} - DEFUN_HIDDEN (bgp_local_mac, bgp_local_mac_cmd, "bgp local-mac vni " CMD_VNI_RANGE " mac WORD seq (0-4294967295)", @@ -931,44 +896,6 @@ DEFUN_HIDDEN (no_bgp_local_mac, return CMD_SUCCESS; } -#if (CONFDATE > 20190601) -CPP_NOTICE("bgpd: time to remove deprecated cli bgp config-type cisco") -CPP_NOTICE("This includes BGP_OPT_CISCO_CONFIG") -#endif -DEFUN_HIDDEN (bgp_config_type, - bgp_config_type_cmd, - "bgp config-type <cisco|zebra>", - BGP_STR - "Configuration type\n" - "cisco\n" - "zebra\n") -{ - int idx = 0; - if (argv_find(argv, argc, "cisco", &idx)) { - vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n"); - vty_out(vty, "if you are using this please let the developers know!\n"); - zlog_info("Deprecated option: `bgp config-type cisco` being used"); - bgp_option_set(BGP_OPT_CONFIG_CISCO); - } else - bgp_option_unset(BGP_OPT_CONFIG_CISCO); - - return CMD_SUCCESS; -} - -DEFUN_HIDDEN (no_bgp_config_type, - no_bgp_config_type_cmd, - "no bgp config-type [<cisco|zebra>]", - NO_STR - BGP_STR - "Display configuration type\n" - "cisco\n" - "zebra\n") -{ - bgp_option_unset(BGP_OPT_CONFIG_CISCO); - return CMD_SUCCESS; -} - - DEFUN (no_synchronization, no_synchronization_cmd, "no synchronization", @@ -7481,11 +7408,6 @@ DEFUN (show_bgp_views, struct listnode *node; struct bgp *bgp; - if (!bgp_option_check(BGP_OPT_MULTIPLE_INSTANCE)) { - vty_out(vty, "BGP Multiple Instance is not enabled\n"); - return CMD_WARNING; - } - vty_out(vty, "Defined BGP views:\n"); for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) { /* Skip VRFs. */ @@ -7516,11 +7438,6 @@ DEFUN (show_bgp_vrfs, json_object *json_vrfs = NULL; int count = 0; - if (!bgp_option_check(BGP_OPT_MULTIPLE_INSTANCE)) { - vty_out(vty, "BGP Multiple Instance is not enabled\n"); - return CMD_WARNING; - } - if (uj) { json = json_object_new_object(); json_vrfs = json_object_new_object(); @@ -12896,14 +12813,6 @@ void bgp_vty_init(void) install_default(BGP_EVPN_NODE); install_default(BGP_EVPN_VNI_NODE); - /* "bgp multiple-instance" commands. */ - install_element(CONFIG_NODE, &bgp_multiple_instance_cmd); - install_element(CONFIG_NODE, &no_bgp_multiple_instance_cmd); - - /* "bgp config-type" commands. */ - install_element(CONFIG_NODE, &bgp_config_type_cmd); - install_element(CONFIG_NODE, &no_bgp_config_type_cmd); - /* "bgp local-mac" hidden commands. */ install_element(CONFIG_NODE, &bgp_local_mac_cmd); install_element(CONFIG_NODE, &no_bgp_local_mac_cmd); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 2e648af1bb..02eda7a430 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -171,8 +171,6 @@ int bgp_option_set(int flag) { switch (flag) { case BGP_OPT_NO_FIB: - case BGP_OPT_MULTIPLE_INSTANCE: - case BGP_OPT_CONFIG_CISCO: case BGP_OPT_NO_LISTEN: case BGP_OPT_NO_ZEBRA: SET_FLAG(bm->options, flag); @@ -186,13 +184,9 @@ int bgp_option_set(int flag) int bgp_option_unset(int flag) { switch (flag) { - case BGP_OPT_MULTIPLE_INSTANCE: - if (listcount(bm->bgp) > 1) - return BGP_ERR_MULTIPLE_INSTANCE_USED; /* Fall through. */ case BGP_OPT_NO_ZEBRA: case BGP_OPT_NO_FIB: - case BGP_OPT_CONFIG_CISCO: UNSET_FLAG(bm->options, flag); break; default: @@ -1205,21 +1199,18 @@ struct peer *peer_new(struct bgp *bgp) /* Set default flags. */ FOREACH_AFI_SAFI (afi, safi) { - if (!bgp_option_check(BGP_OPT_CONFIG_CISCO)) { - SET_FLAG(peer->af_flags[afi][safi], - PEER_FLAG_SEND_COMMUNITY); - SET_FLAG(peer->af_flags[afi][safi], - PEER_FLAG_SEND_EXT_COMMUNITY); - SET_FLAG(peer->af_flags[afi][safi], - PEER_FLAG_SEND_LARGE_COMMUNITY); - - SET_FLAG(peer->af_flags_invert[afi][safi], - PEER_FLAG_SEND_COMMUNITY); - SET_FLAG(peer->af_flags_invert[afi][safi], - PEER_FLAG_SEND_EXT_COMMUNITY); - SET_FLAG(peer->af_flags_invert[afi][safi], - PEER_FLAG_SEND_LARGE_COMMUNITY); - } + SET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY); + SET_FLAG(peer->af_flags[afi][safi], + PEER_FLAG_SEND_EXT_COMMUNITY); + SET_FLAG(peer->af_flags[afi][safi], + PEER_FLAG_SEND_LARGE_COMMUNITY); + + SET_FLAG(peer->af_flags_invert[afi][safi], + PEER_FLAG_SEND_COMMUNITY); + SET_FLAG(peer->af_flags_invert[afi][safi], + PEER_FLAG_SEND_EXT_COMMUNITY); + SET_FLAG(peer->af_flags_invert[afi][safi], + PEER_FLAG_SEND_LARGE_COMMUNITY); peer->addpath_type[afi][safi] = BGP_ADDPATH_NONE; } @@ -3174,40 +3165,21 @@ int bgp_get(struct bgp **bgp_val, as_t *as, const char *name, struct vrf *vrf = NULL; /* Multiple instance check. */ - if (bgp_option_check(BGP_OPT_MULTIPLE_INSTANCE)) { - if (name) - bgp = bgp_lookup_by_name(name); - else - bgp = bgp_get_default(); - - /* Already exists. */ - if (bgp) { - if (bgp->as != *as) { - *as = bgp->as; - return BGP_ERR_INSTANCE_MISMATCH; - } - if (bgp->inst_type != inst_type) - return BGP_ERR_INSTANCE_MISMATCH; - *bgp_val = bgp; - return 0; - } - } else { - /* BGP instance name can not be specified for single instance. - */ - if (name) - return BGP_ERR_MULTIPLE_INSTANCE_NOT_SET; - - /* Get default BGP structure if exists. */ + if (name) + bgp = bgp_lookup_by_name(name); + else bgp = bgp_get_default(); - if (bgp) { - if (bgp->as != *as) { - *as = bgp->as; - return BGP_ERR_AS_MISMATCH; - } - *bgp_val = bgp; - return 0; + /* Already exists. */ + if (bgp) { + if (bgp->as != *as) { + *as = bgp->as; + return BGP_ERR_INSTANCE_MISMATCH; } + if (bgp->inst_type != inst_type) + return BGP_ERR_INSTANCE_MISMATCH; + *bgp_val = bgp; + return 0; } bgp = bgp_create(as, name, inst_type); @@ -7319,45 +7291,19 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp, flag_slcomm = peergroup_af_flag_check(peer, afi, safi, PEER_FLAG_SEND_LARGE_COMMUNITY); - if (!bgp_option_check(BGP_OPT_CONFIG_CISCO)) { - if (flag_scomm && flag_secomm && flag_slcomm) { - vty_out(vty, " no neighbor %s send-community all\n", - addr); - } else { - if (flag_scomm) - vty_out(vty, - " no neighbor %s send-community\n", - addr); - if (flag_secomm) - vty_out(vty, - " no neighbor %s send-community extended\n", - addr); - - if (flag_slcomm) - vty_out(vty, - " no neighbor %s send-community large\n", - addr); - } + if (flag_scomm && flag_secomm && flag_slcomm) { + vty_out(vty, " no neighbor %s send-community all\n", addr); } else { - if (flag_scomm && flag_secomm && flag_slcomm) { - vty_out(vty, " neighbor %s send-community all\n", + if (flag_scomm) + vty_out(vty, " no neighbor %s send-community\n", addr); + if (flag_secomm) + vty_out(vty, + " no neighbor %s send-community extended\n", addr); - } else if (flag_scomm && flag_secomm) { - vty_out(vty, " neighbor %s send-community both\n", + + if (flag_slcomm) + vty_out(vty, " no neighbor %s send-community large\n", addr); - } else { - if (flag_scomm) - vty_out(vty, " neighbor %s send-community\n", - addr); - if (flag_secomm) - vty_out(vty, - " neighbor %s send-community extended\n", - addr); - if (flag_slcomm) - vty_out(vty, - " neighbor %s send-community large\n", - addr); - } } /* Default information */ @@ -7568,18 +7514,6 @@ int bgp_config_write(struct vty *vty) struct listnode *node, *nnode; struct listnode *mnode, *mnnode; - /* BGP Multiple instance. */ - if (!bgp_option_check(BGP_OPT_MULTIPLE_INSTANCE)) { - vty_out(vty, "no bgp multiple-instance\n"); - write++; - } - - /* BGP Config type. */ - if (bgp_option_check(BGP_OPT_CONFIG_CISCO)) { - vty_out(vty, "bgp config-type cisco\n"); - write++; - } - if (bm->rmap_update_timer != RMAP_DEFAULT_UPDATE_TIMER) vty_out(vty, "bgp route-map delay-timer %u\n", bm->rmap_update_timer); @@ -7597,21 +7531,12 @@ int bgp_config_write(struct vty *vty) /* Router bgp ASN */ vty_out(vty, "router bgp %u", bgp->as); - if (bgp_option_check(BGP_OPT_MULTIPLE_INSTANCE)) { - if (bgp->name) - vty_out(vty, " %s %s", - (bgp->inst_type - == BGP_INSTANCE_TYPE_VIEW) - ? "view" - : "vrf", - bgp->name); - } + if (bgp->name) + vty_out(vty, " %s %s", + (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW) + ? "view" : "vrf", bgp->name); vty_out(vty, "\n"); - /* No Synchronization */ - if (bgp_option_check(BGP_OPT_CONFIG_CISCO)) - vty_out(vty, " no synchronization\n"); - /* BGP fast-external-failover. */ if (CHECK_FLAG(bgp->flags, BGP_FLAG_NO_FAST_EXT_FAILOVER)) vty_out(vty, " no bgp fast-external-failover\n"); @@ -7825,10 +7750,6 @@ int bgp_config_write(struct vty *vty) if (bgp->autoshutdown) vty_out(vty, " bgp default shutdown\n"); - /* No auto-summary */ - if (bgp_option_check(BGP_OPT_CONFIG_CISCO)) - vty_out(vty, " no auto-summary\n"); - /* IPv4 unicast configuration. */ bgp_config_write_family(vty, bgp, AFI_IP, SAFI_UNICAST); @@ -7904,9 +7825,6 @@ void bgp_master_init(struct thread_master *master) bf_init(bm->rd_idspace, UINT16_MAX); bf_assign_zero_index(bm->rd_idspace); - /* Enable multiple instances by default. */ - bgp_option_set(BGP_OPT_MULTIPLE_INSTANCE); - /* mpls label dynamic allocation pool */ bgp_lp_init(bm->master, &bm->labelpool); diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index c600d9f3f3..518f1f6714 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -134,10 +134,8 @@ struct bgp_master { /* Various BGP global configuration. */ uint8_t options; #define BGP_OPT_NO_FIB (1 << 0) -#define BGP_OPT_MULTIPLE_INSTANCE (1 << 1) -#define BGP_OPT_CONFIG_CISCO (1 << 2) -#define BGP_OPT_NO_LISTEN (1 << 3) -#define BGP_OPT_NO_ZEBRA (1 << 4) +#define BGP_OPT_NO_LISTEN (1 << 1) +#define BGP_OPT_NO_ZEBRA (1 << 2) uint64_t updgrp_idspace; uint64_t subgrp_idspace; |
