diff options
Diffstat (limited to 'bgpd/bgp_route.c')
| -rw-r--r-- | bgpd/bgp_route.c | 68 |
1 files changed, 33 insertions, 35 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index cb4d88859e..38e696d11b 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -53,7 +53,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgp_filter.h" #include "bgpd/bgp_fsm.h" #include "bgpd/bgp_mplsvpn.h" -#include "bgpd/bgp_encap.h" #include "bgpd/bgp_nexthop.h" #include "bgpd/bgp_damp.h" #include "bgpd/bgp_advertise.h" @@ -4008,7 +4007,7 @@ bgp_static_update_safi (struct bgp *bgp, struct prefix *p, if ((safi == SAFI_EVPN) || (safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP)) { - if (bgp_static->igpnexthop.s_addr) + if (afi == AFI_IP) { bgp_attr_extra_get (&attr)->mp_nexthop_global_in = bgp_static->igpnexthop; bgp_attr_extra_get (&attr)->mp_nexthop_len = IPV4_MAX_BYTELEN; @@ -4454,7 +4453,7 @@ bgp_purge_static_redist_routes (struct bgp *bgp) */ int bgp_static_set_safi (afi_t afi, safi_t safi, struct vty *vty, const char *ip_str, - const char *rd_str, const char *tag_str, + const char *rd_str, const char *label_str, const char *rmap_str, int evpn_type, const char *esi, const char *gwip, const char *ethtag, const char *routermac) { @@ -4491,18 +4490,15 @@ bgp_static_set_safi (afi_t afi, safi_t safi, struct vty *vty, const char *ip_str return CMD_WARNING; } - if (tag_str) + if (label_str) { - ret = str2tag (tag_str, tag); - if (! ret) - { - vty_out (vty, "%% Malformed tag%s", VTY_NEWLINE); - return CMD_WARNING; - } + unsigned long label_val; + VTY_GET_INTEGER_RANGE("Label/tag", label_val, label_str, 0, 16777215); + encode_label (label_val, tag); } else { - encode_label (0, tag); + memset (tag, 0, sizeof(tag)); /* empty, not even BoS */ } if (safi == SAFI_EVPN) { @@ -4562,8 +4558,8 @@ bgp_static_set_safi (afi_t afi, safi_t safi, struct vty *vty, const char *ip_str if (rmap_str) { if (bgp_static->rmap.name) - free (bgp_static->rmap.name); - bgp_static->rmap.name = strdup (rmap_str); + XFREE(MTYPE_ROUTE_MAP_NAME, bgp_static->rmap.name); + bgp_static->rmap.name = XSTRDUP(MTYPE_ROUTE_MAP_NAME, rmap_str); bgp_static->rmap.map = route_map_lookup_by_name (rmap_str); } @@ -4594,7 +4590,7 @@ bgp_static_set_safi (afi_t afi, safi_t safi, struct vty *vty, const char *ip_str /* Configure static BGP network. */ int bgp_static_unset_safi(afi_t afi, safi_t safi, struct vty *vty, const char *ip_str, - const char *rd_str, const char *tag_str, + const char *rd_str, const char *label_str, int evpn_type, const char *esi, const char *gwip, const char *ethtag) { VTY_DECLVAR_CONTEXT(bgp, bgp); @@ -4628,11 +4624,15 @@ bgp_static_unset_safi(afi_t afi, safi_t safi, struct vty *vty, const char *ip_st return CMD_WARNING; } - ret = str2tag (tag_str, tag); - if (! ret) + if (label_str) { - vty_out (vty, "%% Malformed tag%s", VTY_NEWLINE); - return CMD_WARNING; + unsigned long label_val; + VTY_GET_INTEGER_RANGE("Label/tag", label_val, label_str, 0, MPLS_LABEL_MAX); + encode_label (label_val, tag); + } + else + { + memset (tag, 0, sizeof(tag)); /* empty, not even BoS */ } prn = bgp_node_get (bgp->route[afi][safi], @@ -7839,12 +7839,6 @@ bgp_show (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, return bgp_show_mpls_vpn(vty, afi, NULL, type, output_arg, 0, use_json); } - if (safi == SAFI_ENCAP) - { - return bgp_show_encap(vty, afi, NULL, type, output_arg, - 0); - } - table = bgp->rib[afi][safi]; @@ -8216,7 +8210,7 @@ bgp_show_lcommunity_list (struct vty *vty, struct bgp *bgp, const char *lcom, DEFUN (show_ip_bgp_large_community_list, show_ip_bgp_large_community_list_cmd, - "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]] large-community-list <(1-500)|WORD> [json]", + "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn>]] large-community-list <(1-500)|WORD> [json]", SHOW_STR IP_STR BGP_STR @@ -8226,7 +8220,6 @@ DEFUN (show_ip_bgp_large_community_list, "Address Family modifier\n" "Address Family modifier\n" "Address Family modifier\n" - "Address Family modifier\n" "Display routes matching the large-community-list\n" "large-community-list number\n" "large-community-list name\n" @@ -8262,7 +8255,7 @@ DEFUN (show_ip_bgp_large_community_list, } DEFUN (show_ip_bgp_large_community, show_ip_bgp_large_community_cmd, - "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]] large-community [AA:BB:CC] [json]", + "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn>]] large-community [AA:BB:CC] [json]", SHOW_STR IP_STR BGP_STR @@ -8272,7 +8265,6 @@ DEFUN (show_ip_bgp_large_community, "Address Family modifier\n" "Address Family modifier\n" "Address Family modifier\n" - "Address Family modifier\n" "Display routes matching the large-communities\n" "List of large-community numbers\n" JSON_STR) @@ -8428,8 +8420,6 @@ DEFUN (show_ip_bgp, if (safi == SAFI_MPLS_VPN) return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_normal, NULL, 0, uj); - else if (safi == SAFI_ENCAP) - return bgp_show_encap (vty, afi, NULL, bgp_show_type_normal, NULL, 0); else return bgp_show (vty, bgp, afi, safi, sh_type, NULL, uj); } @@ -9213,7 +9203,7 @@ bgp_peer_counts (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, u_c DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, show_ip_bgp_instance_neighbor_prefix_counts_cmd, - "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]] " + "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn>]] " "neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", SHOW_STR IP_STR @@ -9224,7 +9214,6 @@ DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, "Address Family modifier\n" "Address Family modifier\n" "Address Family modifier\n" - "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" @@ -10433,10 +10422,19 @@ bgp_config_write_network_vpn (struct vty *vty, struct bgp *bgp, prefix_rd2str (prd, rdbuf, RD_ADDRSTRLEN); label = decode_label (bgp_static->tag); - vty_out (vty, " network %s/%d rd %s tag %d", + vty_out (vty, " network %s/%d rd %s", inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen, - rdbuf, label); + p->prefixlen, rdbuf); + if (safi == SAFI_MPLS_VPN) + vty_out (vty, " label %u", label); + + if (bgp_static->rmap.name) + vty_out (vty, " route-map %s", bgp_static->rmap.name); + else + { + if (bgp_static->backdoor) + vty_out (vty, " backdoor"); + } vty_out (vty, "%s", VTY_NEWLINE); } return 0; |
