#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"
#define NEXTHOP_IS_V6 (\
(safi != SAFI_ENCAP && safi != SAFI_MPLS_VPN &&\
- (p->family == AF_INET6 || peer_cap_enhe(peer, AFI_IP6, safi))) || \
+ (p->family == AF_INET6 || peer_cap_enhe(peer, afi, safi))) || \
((safi == SAFI_ENCAP || safi == SAFI_MPLS_VPN) &&\
attr->extra->mp_nexthop_len >= IPV6_MAX_BYTELEN))
peer->rcvd_attr_printed = 1;
}
- zlog_debug ("%s rcvd %s%s ", peer->host,
+ zlog_debug ("%s rcvd %s %s ", peer->host,
bgp_debug_rdpfxpath2str (prd, p, addpath_id ? 1 : 0,
addpath_id, pfx_buf, sizeof (pfx_buf)), label_buf);
}
/* Nexthop reachability check. */
if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK) &&
- safi == SAFI_UNICAST)
+ (safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST))
{
- if (bgp_find_or_add_nexthop (bgp, afi, ri, NULL, 0) &&
- safi == SAFI_UNICAST)
+ if (bgp_find_or_add_nexthop (bgp, afi, ri, NULL, 0))
bgp_info_set_flag (rn, ri, BGP_INFO_VALID);
else
{
new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0, bgp->peer_self, attr_new,
rn);
/* Nexthop reachability check. */
- if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK))
+ if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK) &&
+ (safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST))
{
if (bgp_find_or_add_nexthop (bgp, afi, new, NULL, 0))
bgp_info_set_flag (rn, new, BGP_INFO_VALID);
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;
* I think it can probably be factored with bgp_static_set.
*/
int
-bgp_static_set_safi (safi_t safi, struct vty *vty, const char *ip_str,
- const char *rd_str, const char *tag_str,
+bgp_static_set_safi (afi_t afi, safi_t safi, struct vty *vty, const char *ip_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)
{
struct bgp_table *table;
struct bgp_static *bgp_static;
u_char tag[3];
- afi_t afi;
struct prefix gw_ip;
- if(safi == SAFI_EVPN)
- afi = AFI_L2VPN;
- else
- afi = AFI_IP;
-
/* validate ip prefix */
ret = str2prefix (ip_str, &p);
if (! ret)
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)
{
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);
}
/* Configure static BGP network. */
int
-bgp_static_unset_safi(safi_t safi, struct vty *vty, const char *ip_str,
- const char *rd_str, const char *tag_str,
+bgp_static_unset_safi(afi_t afi, safi_t safi, struct vty *vty, const char *ip_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);
struct bgp_table *table;
struct bgp_static *bgp_static;
u_char tag[3];
- afi_t afi;
-
- if(safi == SAFI_EVPN)
- afi = AFI_L2VPN;
- else
- afi = AFI_IP;
/* Convert IP prefix string to struct prefix. */
ret = str2prefix (ip_str, &p);
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],
DEFUN (bgp_network_label_index,
bgp_network_label_index_cmd,
- "network A.B.C.D/M label-index (0-4294967294)",
+ "network A.B.C.D/M label-index (0-1048560)",
"Specify a network to announce via BGP\n"
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
"Label index to associate with the prefix\n"
DEFUN (bgp_network_label_index_route_map,
bgp_network_label_index_route_map_cmd,
- "network A.B.C.D/M label-index (0-4294967294) route-map WORD",
+ "network A.B.C.D/M label-index (0-1048560) route-map WORD",
"Specify a network to announce via BGP\n"
"IP prefix\n"
"Label index to associate with the prefix\n"
ALIAS (no_bgp_network,
no_bgp_network_label_index_cmd,
- "no network A.B.C.D/M label-index (0-4294967294)",
+ "no network A.B.C.D/M label-index (0-1048560)",
NO_STR
"Specify a network to announce via BGP\n"
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
ALIAS (no_bgp_network,
no_bgp_network_label_index_route_map_cmd,
- "no network A.B.C.D/M label-index (0-4294967294) route-map WORD",
+ "no network A.B.C.D/M label-index (0-1048560) route-map WORD",
NO_STR
"Specify a network to announce via BGP\n"
"IP prefix\n"
DEFUN (ipv6_bgp_network_label_index,
ipv6_bgp_network_label_index_cmd,
- "network X:X::X:X/M label-index (0-4294967294)",
+ "network X:X::X:X/M label-index (0-1048560)",
"Specify a network to announce via BGP\n"
"IPv6 prefix <network>/<length>\n"
"Label index to associate with the prefix\n"
DEFUN (ipv6_bgp_network_label_index_route_map,
ipv6_bgp_network_label_index_route_map_cmd,
- "network X:X::X:X/M label-index (0-4294967294) route-map WORD",
+ "network X:X::X:X/M label-index (0-1048560) route-map WORD",
"Specify a network to announce via BGP\n"
"IPv6 prefix\n"
"Label index to associate with the prefix\n"
ALIAS (no_ipv6_bgp_network,
no_ipv6_bgp_network_label_index_cmd,
- "no network X:X::X:X/M label-index (0-4294967294)",
+ "no network X:X::X:X/M label-index (0-1048560)",
NO_STR
"Specify a network to announce via BGP\n"
"IPv6 prefix <network>/<length>\n"
ALIAS (no_ipv6_bgp_network,
no_ipv6_bgp_network_label_index_route_map_cmd,
- "no network X:X::X:X/M label-index (0-4294967294) route-map WORD",
+ "no network X:X::X:X/M label-index (0-1048560) route-map WORD",
NO_STR
"Specify a network to announce via BGP\n"
"IPv6 prefix\n"
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];
{
struct listnode *node, *nnode;
struct bgp *bgp;
- struct bgp_table *table;
int is_first = 1;
if (use_json)
? "Default" : bgp->name,
VTY_NEWLINE);
}
- table = bgp->rib[afi][safi];
- bgp_show_table (vty, bgp, table,
- bgp_show_type_normal, NULL, use_json);
+ bgp_show (vty, bgp, afi, safi, bgp_show_type_normal, NULL, use_json);
}
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|labeled-unicast>]] large-community-list <(1-500)|WORD> [json]",
+ "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]] large-community-list <(1-500)|WORD> [json]",
SHOW_STR
IP_STR
BGP_STR
"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"
}
DEFUN (show_ip_bgp_large_community,
show_ip_bgp_large_community_cmd,
- "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap|labeled-unicast>]] large-community [AA:BB:CC] [json]",
+ "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]] large-community [AA:BB:CC] [json]",
SHOW_STR
IP_STR
BGP_STR
"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)
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);
}
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|labeled-unicast>]] "
+ "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]] "
"neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]",
SHOW_STR
IP_STR
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;
install_element (BGP_IPV6_NODE, &ipv6_bgp_network_route_map_cmd);
install_element (BGP_IPV6_NODE, &no_bgp_table_map_cmd);
install_element (BGP_IPV6_NODE, &no_ipv6_bgp_network_cmd);
- install_element (BGP_IPV6_NODE, &ipv6_bgp_network_label_index_cmd);
- install_element (BGP_IPV6_NODE, &no_ipv6_bgp_network_label_index_cmd);
- install_element (BGP_IPV6_NODE, &ipv6_bgp_network_label_index_route_map_cmd);
- install_element (BGP_IPV6_NODE, &no_ipv6_bgp_network_label_index_route_map_cmd);
+ install_element (BGP_IPV6L_NODE, &ipv6_bgp_network_label_index_cmd);
+ install_element (BGP_IPV6L_NODE, &no_ipv6_bgp_network_label_index_cmd);
+ install_element (BGP_IPV6L_NODE, &ipv6_bgp_network_label_index_route_map_cmd);
+ install_element (BGP_IPV6L_NODE, &no_ipv6_bgp_network_label_index_route_map_cmd);
install_element (BGP_IPV6_NODE, &ipv6_aggregate_address_cmd);
install_element (BGP_IPV6_NODE, &no_ipv6_aggregate_address_cmd);