summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2017-01-19 17:35:05 +0100
committerGitHub <noreply@github.com>2017-01-19 17:35:05 +0100
commit190a5df69fffaaf9d78a37cf97ec2c074723a988 (patch)
tree1b685bc2d7a30d27a6563be02aea2498422bc46e
parent88e5a8cbe199c33039108c0d1d41790438f96235 (diff)
parent7a4732c12b5e2dddba1c546fb02264db54581547 (diff)
Merge pull request #83 from LabNConsulting/working/2.0/patch-set/2-no-vrf
Fix a number of VPN/Encap SAFI related issues (no VRF CLI changes)
-rw-r--r--bgpd/bgp_attr.c5
-rw-r--r--bgpd/bgp_route.c179
-rw-r--r--bgpd/bgp_route.h4
-rw-r--r--bgpd/bgp_updgrp_packet.c57
-rw-r--r--bgpd/bgpd.c8
-rw-r--r--bgpd/rfapi/rfapi.c3
-rw-r--r--bgpd/rfapi/rfapi_ap.c60
-rw-r--r--bgpd/rfapi/rfapi_ap.h1
-rw-r--r--bgpd/rfapi/rfapi_encap_tlv.c3
-rw-r--r--bgpd/rfapi/rfapi_import.c5
-rw-r--r--bgpd/rfapi/rfapi_private.h19
-rw-r--r--bgpd/rfapi/rfapi_rib.c18
-rw-r--r--bgpd/rfapi/rfapi_rib.h33
-rw-r--r--bgpd/rfapi/rfapi_vty.c36
-rwxr-xr-xvtysh/extract.pl.in4
15 files changed, 255 insertions, 180 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 2115fb5efc..b1b245d42c 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -2643,6 +2643,8 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi,
stream_putw (s, afi);
stream_putc (s, (safi == SAFI_MPLS_VPN) ? SAFI_MPLS_LABELED_VPN : safi);
+ if (nh_afi == AFI_MAX)
+ nh_afi = BGP_NEXTHOP_AFI_FROM_NHLEN(attr->extra->mp_nexthop_len);
/* Nexthop */
switch (nh_afi)
{
@@ -2894,7 +2896,8 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
size_t mpattrlen_pos = 0;
mpattrlen_pos = bgp_packet_mpattr_start(s, afi, safi,
- (peer_cap_enhe(peer) ? AFI_IP6 : afi),
+ (peer_cap_enhe(peer) ? AFI_IP6 :
+ AFI_MAX), /* get from NH */
vecarr, attr);
bgp_packet_mpattr_prefix(s, afi, safi, p, prd, tag,
addpath_encode, addpath_tx_id);
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 90904e946c..81516640bd 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1435,9 +1435,10 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp,
#ifdef HAVE_IPV6
#define NEXTHOP_IS_V6 (\
- (safi != SAFI_ENCAP && \
+ (safi != SAFI_ENCAP && safi != SAFI_MPLS_VPN &&\
(p->family == AF_INET6 || peer_cap_enhe(peer))) || \
- (safi == SAFI_ENCAP && attr->extra->mp_nexthop_len == 16))
+ ((safi == SAFI_ENCAP || safi == SAFI_MPLS_VPN) &&\
+ attr->extra->mp_nexthop_len >= IPV6_MAX_BYTELEN))
/* IPv6/MP starts with 1 nexthop. The link-local address is passed only if
* the peer (group) is configured to receive link-local nexthop unchanged
@@ -8161,12 +8162,13 @@ DEFUN (show_ip_bgp,
DEFUN (show_ip_bgp_ipv4,
show_ip_bgp_ipv4_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" {json}",
+ "show ip bgp ipv4 (unicast|multicast) {json}",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"JavaScript Object Notation\n")
{
u_char uj = use_json(argc, argv);
@@ -8178,11 +8180,12 @@ DEFUN (show_ip_bgp_ipv4,
ALIAS (show_ip_bgp_ipv4,
show_bgp_ipv4_safi_cmd,
- "show bgp ipv4 "BGP_SAFI_CMD_STR" {json}",
+ "show bgp ipv4 (unicast|multicast) {json}",
SHOW_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"JavaScript Object Notation\n")
DEFUN (show_ip_bgp_route,
@@ -8636,11 +8639,12 @@ ALIAS (show_bgp,
DEFUN (show_bgp_ipv6_safi,
show_bgp_ipv6_safi_cmd,
- "show bgp ipv6 "BGP_SAFI_CMD_STR" {json}",
+ "show bgp ipv6 (unicast|multicast) {json}",
SHOW_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"JavaScript Object Notation\n")
{
u_char uj = use_json(argc, argv);
@@ -9246,12 +9250,13 @@ ALIAS (show_ip_bgp_flap_regexp,
DEFUN (show_ip_bgp_ipv4_regexp,
show_ip_bgp_ipv4_regexp_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" regexp .LINE",
+ "show ip bgp ipv4 (unicast|multicast) regexp .LINE",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the AS path regular expression\n"
"A regular-expression to match the BGP AS paths\n")
{
@@ -9393,12 +9398,13 @@ ALIAS (show_ip_bgp_flap_prefix_list,
DEFUN (show_ip_bgp_ipv4_prefix_list,
show_ip_bgp_ipv4_prefix_list_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" prefix-list WORD",
+ "show ip bgp ipv4 (unicast|multicast) prefix-list WORD",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes conforming to the prefix-list\n"
"IP prefix-list name\n")
{
@@ -9539,12 +9545,13 @@ ALIAS (show_ip_bgp_flap_filter_list,
DEFUN (show_ip_bgp_ipv4_filter_list,
show_ip_bgp_ipv4_filter_list_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" filter-list WORD",
+ "show ip bgp ipv4 (unicast|multicast) filter-list WORD",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes conforming to the filter-list\n"
"Regular expression access list name\n")
{
@@ -9622,12 +9629,13 @@ DEFUN (show_ip_bgp_dampening_info,
DEFUN (show_ip_bgp_ipv4_dampening_parameters,
show_ip_bgp_ipv4_dampening_parameters_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" dampening parameters",
+ "show ip bgp ipv4 (unicast|multicast) dampening parameters",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display detailed information about dampening\n"
"Display detail of configured dampening parameters\n")
{
@@ -9639,12 +9647,13 @@ DEFUN (show_ip_bgp_ipv4_dampening_parameters,
DEFUN (show_ip_bgp_ipv4_dampening_flap_stats,
show_ip_bgp_ipv4_dampening_flap_stats_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" dampening flap-statistics",
+ "show ip bgp ipv4 (unicast|multicast) dampening flap-statistics",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display detailed information about dampening\n"
"Display flap statistics of routes\n")
{
@@ -9656,12 +9665,13 @@ DEFUN (show_ip_bgp_ipv4_dampening_flap_stats,
DEFUN (show_ip_bgp_ipv4_dampening_dampd_paths,
show_ip_bgp_ipv4_dampening_dampd_paths_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" dampening dampened-paths",
+ "show ip bgp ipv4 (unicast|multicast) dampening dampened-paths",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display detailed information about dampening\n"
"Display paths suppressed due to dampening\n")
{
@@ -9750,12 +9760,13 @@ ALIAS (show_ip_bgp_flap_route_map,
DEFUN (show_ip_bgp_ipv4_route_map,
show_ip_bgp_ipv4_route_map_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" route-map WORD",
+ "show ip bgp ipv4 (unicast|multicast) route-map WORD",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the route-map\n"
"A route-map to match on\n")
{
@@ -9823,12 +9834,13 @@ ALIAS (show_ip_bgp_flap_cidr_only,
DEFUN (show_ip_bgp_ipv4_cidr_only,
show_ip_bgp_ipv4_cidr_only_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" cidr-only",
+ "show ip bgp ipv4 (unicast|multicast) cidr-only",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display only routes with non-natural netmasks\n")
{
safi_t safi;
@@ -9851,12 +9863,13 @@ DEFUN (show_ip_bgp_community_all,
DEFUN (show_ip_bgp_ipv4_community_all,
show_ip_bgp_ipv4_community_all_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community",
+ "show ip bgp ipv4 (unicast|multicast) community",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the communities\n")
{
safi_t safi;
@@ -10054,12 +10067,13 @@ ALIAS (show_ip_bgp_community,
DEFUN (show_ip_bgp_ipv4_community,
show_ip_bgp_ipv4_community_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export)",
+ "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the communities\n"
COMMUNITY_AANN_STR
"Do not send outside local AS (well-known community)\n"
@@ -10073,12 +10087,13 @@ DEFUN (show_ip_bgp_ipv4_community,
ALIAS (show_ip_bgp_ipv4_community,
show_ip_bgp_ipv4_community2_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
+ "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the communities\n"
COMMUNITY_AANN_STR
"Do not send outside local AS (well-known community)\n"
@@ -10091,12 +10106,13 @@ ALIAS (show_ip_bgp_ipv4_community,
ALIAS (show_ip_bgp_ipv4_community,
show_ip_bgp_ipv4_community3_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
+ "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the communities\n"
COMMUNITY_AANN_STR
"Do not send outside local AS (well-known community)\n"
@@ -10113,12 +10129,13 @@ ALIAS (show_ip_bgp_ipv4_community,
ALIAS (show_ip_bgp_ipv4_community,
show_ip_bgp_ipv4_community4_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
+ "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the communities\n"
COMMUNITY_AANN_STR
"Do not send outside local AS (well-known community)\n"
@@ -10139,11 +10156,14 @@ ALIAS (show_ip_bgp_ipv4_community,
DEFUN (show_bgp_instance_afi_safi_community_all,
show_bgp_instance_afi_safi_community_all_cmd,
- "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community",
+ "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community",
SHOW_STR
BGP_STR
BGP_INSTANCE_HELP_STR
- BGP_AFI_SAFI_HELP_STR
+ "Address family\n"
+ "Address family\n"
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the communities\n")
{
int afi;
@@ -10165,7 +10185,7 @@ DEFUN (show_bgp_instance_afi_safi_community_all,
DEFUN (show_bgp_instance_afi_safi_community,
show_bgp_instance_afi_safi_community_cmd,
- "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export)",
+ "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
SHOW_STR
BGP_STR
BGP_INSTANCE_HELP_STR
@@ -10189,7 +10209,7 @@ DEFUN (show_bgp_instance_afi_safi_community,
ALIAS (show_bgp_instance_afi_safi_community,
show_bgp_instance_afi_safi_community2_cmd,
- "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
+ "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
SHOW_STR
BGP_STR
BGP_INSTANCE_HELP_STR
@@ -10209,7 +10229,7 @@ ALIAS (show_bgp_instance_afi_safi_community,
ALIAS (show_bgp_instance_afi_safi_community,
show_bgp_instance_afi_safi_community3_cmd,
- "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
+ "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
SHOW_STR
BGP_STR
BGP_INSTANCE_HELP_STR
@@ -10233,7 +10253,7 @@ ALIAS (show_bgp_instance_afi_safi_community,
ALIAS (show_bgp_instance_afi_safi_community,
show_bgp_instance_afi_safi_community4_cmd,
- "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
+ "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
SHOW_STR
BGP_STR
BGP_INSTANCE_HELP_STR
@@ -10340,12 +10360,13 @@ ALIAS (show_ip_bgp_community_exact,
DEFUN (show_ip_bgp_ipv4_community_exact,
show_ip_bgp_ipv4_community_exact_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) exact-match",
+ "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the communities\n"
COMMUNITY_AANN_STR
"Do not send outside local AS (well-known community)\n"
@@ -10360,12 +10381,13 @@ DEFUN (show_ip_bgp_ipv4_community_exact,
ALIAS (show_ip_bgp_ipv4_community_exact,
show_ip_bgp_ipv4_community2_exact_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
+ "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the communities\n"
COMMUNITY_AANN_STR
"Do not send outside local AS (well-known community)\n"
@@ -10379,12 +10401,13 @@ ALIAS (show_ip_bgp_ipv4_community_exact,
ALIAS (show_ip_bgp_ipv4_community_exact,
show_ip_bgp_ipv4_community3_exact_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
+ "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the communities\n"
COMMUNITY_AANN_STR
"Do not send outside local AS (well-known community)\n"
@@ -10402,12 +10425,13 @@ ALIAS (show_ip_bgp_ipv4_community_exact,
ALIAS (show_ip_bgp_ipv4_community_exact,
show_ip_bgp_ipv4_community4_exact_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
+ "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the communities\n"
COMMUNITY_AANN_STR
"Do not send outside local AS (well-known community)\n"
@@ -11107,12 +11131,13 @@ DEFUN (show_ip_bgp_instance_community_list,
DEFUN (show_ip_bgp_ipv4_community_list,
show_ip_bgp_ipv4_community_list_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community-list (<1-500>|WORD)",
+ "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the community-list\n"
"community-list number\n"
"community-list name\n")
@@ -11138,12 +11163,13 @@ DEFUN (show_ip_bgp_community_list_exact,
DEFUN (show_ip_bgp_ipv4_community_list_exact,
show_ip_bgp_ipv4_community_list_exact_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community-list (<1-500>|WORD) exact-match",
+ "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"Display routes matching the community-list\n"
"community-list number\n"
"community-list name\n"
@@ -11343,12 +11369,13 @@ ALIAS (show_ip_bgp_flap_prefix_longer,
DEFUN (show_ip_bgp_ipv4_prefix_longer,
show_ip_bgp_ipv4_prefix_longer_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" A.B.C.D/M longer-prefixes",
+ "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "Address Family modifier\n"
+ "Address Family modifier\n"
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
"Display route and more specific routes\n")
{
@@ -11840,7 +11867,7 @@ DEFUN (show_bgp_statistics,
"show bgp "BGP_AFI_SAFI_CMD_STR" statistics",
SHOW_STR
BGP_STR
- BGP_INSTANCE_HELP_STR
+ BGP_AFI_SAFI_HELP_STR
"BGP RIB advertisement statistics\n")
{
return bgp_table_stats_vty (vty, NULL, argv[0], argv[1]);
@@ -12145,12 +12172,13 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts,
DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts,
show_ip_bgp_ipv4_neighbor_prefix_counts_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts {json}",
+ "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts {json}",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "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"
@@ -12495,12 +12523,13 @@ ALIAS (show_ip_bgp_instance_neighbor_advertised_route,
"JavaScript Object Notation\n")
DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route,
show_ip_bgp_ipv4_neighbor_advertised_route_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}",
+ "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "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"
@@ -12527,12 +12556,13 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route,
ALIAS (show_ip_bgp_ipv4_neighbor_advertised_route,
show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}",
+ "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "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"
@@ -12784,12 +12814,13 @@ ALIAS (show_ip_bgp_instance_neighbor_received_routes,
DEFUN (show_ip_bgp_ipv4_neighbor_received_routes,
show_ip_bgp_ipv4_neighbor_received_routes_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}",
+ "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "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"
@@ -12815,12 +12846,13 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes,
ALIAS (show_ip_bgp_ipv4_neighbor_received_routes,
show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}",
+ "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "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"
@@ -12830,11 +12862,14 @@ ALIAS (show_ip_bgp_ipv4_neighbor_received_routes,
DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes,
show_bgp_instance_afi_safi_neighbor_adv_recd_routes_cmd,
- "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes) {json}",
+ "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes) {json}",
SHOW_STR
BGP_STR
BGP_INSTANCE_HELP_STR
- BGP_AFI_SAFI_HELP_STR
+ "Address family\n"
+ "Address family\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"
@@ -12950,12 +12985,13 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter,
DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter,
show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}",
+ "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "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"
@@ -13450,12 +13486,13 @@ DEFUN (show_ip_bgp_neighbor_damp,
DEFUN (show_ip_bgp_ipv4_neighbor_routes,
show_ip_bgp_ipv4_neighbor_routes_cmd,
- "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}",
+ "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}",
SHOW_STR
IP_STR
BGP_STR
"Address family\n"
- BGP_SAFI_HELP_STR
+ "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"
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 63b18aa2d8..3c7aa83a0e 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -179,6 +179,10 @@ struct bgp_static
u_char tag[3];
};
+#define BGP_NEXTHOP_AFI_FROM_NHLEN(nhlen) \
+ ((nhlen) < IPV4_MAX_BYTELEN ? 0 : \
+ ((nhlen) < IPV6_MAX_BYTELEN ? AFI_IP : AFI_IP6))
+
#define BGP_ATTR_NEXTHOP_AFI_IP6(attr) \
(! CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP)) && \
(attr)->extra && ((attr)->extra->mp_nexthop_len == 16 || \
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c
index e18ba235c7..ce2e0dbca0 100644
--- a/bgpd/bgp_updgrp_packet.c
+++ b/bgpd/bgp_updgrp_packet.c
@@ -418,10 +418,20 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf)
if (CHECK_FLAG (vec->flags, BPKT_ATTRVEC_FLAGS_UPDATED))
{
u_int8_t nhlen;
+ afi_t nhafi = AFI_MAX; /* NH AFI is based on nhlen! */
int route_map_sets_nh;
nhlen = stream_getc_from (s, vec->offset);
-
- if (paf->afi == AFI_IP && !peer_cap_enhe(peer))
+ if (paf->afi == AFI_IP || paf->afi == AFI_IP6)
+ {
+ nhafi = BGP_NEXTHOP_AFI_FROM_NHLEN(nhlen);
+ if (peer_cap_enhe(peer))
+ nhafi = AFI_IP6;
+ if (paf->safi == SAFI_MPLS_VPN && /* if VPN && not global */
+ nhlen != BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL)
+ nhafi = AFI_MAX; /* no change allowed */
+ }
+
+ if (nhafi == AFI_IP)
{
struct in_addr v4nh, *mod_v4nh;
int nh_modified = 0;
@@ -462,23 +472,24 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf)
(bgp_multiaccess_check_v4 (v4nh, peer) == 0) &&
!CHECK_FLAG(vec->flags,
BPKT_ATTRVEC_FLAGS_RMAP_NH_UNCHANGED) &&
- !peer_af_flag_check (peer, paf->afi, paf->safi,
+ !peer_af_flag_check (peer, nhafi, paf->safi,
PEER_FLAG_NEXTHOP_UNCHANGED))
{
+ /* NOTE: not handling case where NH has new AFI */
mod_v4nh = &peer->nexthop.v4;
nh_modified = 1;
}
- if (nh_modified)
- stream_put_in_addr_at (s, vec->offset + 1, mod_v4nh);
+ if (nh_modified) /* allow for VPN RD */
+ stream_put_in_addr_at (s, vec->offset + 1 + nhlen - 4, mod_v4nh);
if (bgp_debug_update(peer, NULL, NULL, 0))
- zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ nexthop %s",
- PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id,
- peer->host, inet_ntoa (*mod_v4nh));
-
+ zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ nexthop %s%s",
+ PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id,
+ peer->host, inet_ntoa (*mod_v4nh),
+ (nhlen == 12 ? " and RD" : ""));
}
- else if (paf->afi == AFI_IP6 || peer_cap_enhe(peer))
+ else if (nhafi == AFI_IP6)
{
struct in6_addr v6nhglobal, *mod_v6nhg;
struct in6_addr v6nhlocal, *mod_v6nhl;
@@ -515,17 +526,18 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf)
else if (peer->sort == BGP_PEER_EBGP &&
!CHECK_FLAG(vec->flags,
BPKT_ATTRVEC_FLAGS_RMAP_NH_UNCHANGED) &&
- !peer_af_flag_check (peer, paf->afi, paf->safi,
+ !peer_af_flag_check (peer, nhafi, paf->safi,
PEER_FLAG_NEXTHOP_UNCHANGED))
{
+ /* NOTE: not handling case where NH has new AFI */
mod_v6nhg = &peer->nexthop.v6_global;
gnh_modified = 1;
}
- if (nhlen == 32)
+ if (nhlen == 32 || nhlen == 48) /* 48 == VPN */
{
- stream_get_from (&v6nhlocal, s, vec->offset + 1 + 16, 16);
+ stream_get_from (&v6nhlocal, s, vec->offset + 1 + (nhlen-IPV6_MAX_BYTELEN), IPV6_MAX_BYTELEN);
if (IN6_IS_ADDR_UNSPECIFIED (&v6nhlocal))
{
mod_v6nhl = &peer->nexthop.v6_local;
@@ -534,25 +546,27 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf)
}
if (gnh_modified)
- stream_put_in6_addr_at (s, vec->offset + 1, mod_v6nhg);
+ stream_put_in6_addr_at (s, vec->offset + 1 + (nhlen-IPV6_MAX_BYTELEN), mod_v6nhg);
if (lnh_modified)
- stream_put_in6_addr_at (s, vec->offset + 1 + 16, mod_v6nhl);
+ stream_put_in6_addr_at (s, vec->offset + 1 + (nhlen-IPV6_MAX_BYTELEN), mod_v6nhl);
if (bgp_debug_update(peer, NULL, NULL, 0))
{
- if (nhlen == 32)
- zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthops %s, %s",
+ if (nhlen == 32 || nhlen == 48)
+ zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthops %s, %s%s",
PAF_SUBGRP(paf)->update_group->id,
PAF_SUBGRP(paf)->id,
peer->host,
inet_ntop (AF_INET6, mod_v6nhg, buf, BUFSIZ),
- inet_ntop (AF_INET6, mod_v6nhl, buf2, BUFSIZ));
+ inet_ntop (AF_INET6, mod_v6nhl, buf2, BUFSIZ),
+ (nhlen == 48 ? " and RD" : ""));
else
- zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthop %s",
+ zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthop %s%s",
PAF_SUBGRP(paf)->update_group->id,
PAF_SUBGRP(paf)->id,
peer->host,
- inet_ntop (AF_INET6, mod_v6nhg, buf, BUFSIZ));
+ inet_ntop (AF_INET6, mod_v6nhg, buf, BUFSIZ),
+ (nhlen == 24 ? " and RD" : ""));
}
}
}
@@ -747,7 +761,8 @@ subgroup_update_packet (struct update_subgroup *subgrp)
if (stream_empty (snlri))
mpattrlen_pos = bgp_packet_mpattr_start (snlri, afi, safi,
- (peer_cap_enhe(peer) ? AFI_IP6 : afi),
+ (peer_cap_enhe(peer) ? AFI_IP6 :
+ AFI_MAX), /* get from NH */
&vecarr, adv->baa->attr);
bgp_packet_mpattr_prefix (snlri, afi, safi, &rn->p, prd, tag,
addpath_encode, addpath_tx_id);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 2e07ba98ad..244b1930b3 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -7142,9 +7142,9 @@ bgp_config_write_family_header (struct vty *vty, afi_t afi, safi_t safi,
else if (safi == SAFI_MULTICAST)
vty_out (vty, "ipv4 multicast");
else if (safi == SAFI_MPLS_VPN)
- vty_out (vty, "vpnv4");
+ vty_out (vty, "ipv4 vpn");
else if (safi == SAFI_ENCAP)
- vty_out (vty, "encap");
+ vty_out (vty, "ipv4 encap");
}
else if (afi == AFI_IP6)
{
@@ -7153,9 +7153,9 @@ bgp_config_write_family_header (struct vty *vty, afi_t afi, safi_t safi,
else if (safi == SAFI_MULTICAST)
vty_out (vty, "ipv6 multicast");
else if (safi == SAFI_MPLS_VPN)
- vty_out (vty, "vpnv6");
+ vty_out (vty, "ipv6 vpn");
else if (safi == SAFI_ENCAP)
- vty_out (vty, "encapv6");
+ vty_out (vty, "ipv6 encap");
}
vty_out (vty, "%s", VTY_NEWLINE);
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index 5945eb09e6..599d6e88bf 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -768,7 +768,6 @@ add_vnc_route (
bgp_attr_extra_free (&attr);
return;
}
- nexthop = un_addr; /* UN used as MPLS NLRI nexthop */
}
if (local_pref)
@@ -2778,7 +2777,7 @@ rfapi_register (
NULL,
action == RFAPI_REGISTER_KILL);
- if (0 == rfapiApDelete (bgp, rfd, &p, pfx_mac, &adv_tunnel))
+ if (0 == rfapiApDelete (bgp, rfd, &p, pfx_mac, &prd, &adv_tunnel))
{
if (adv_tunnel)
rfapiTunnelRouteAnnounce (bgp, rfd, &rfd->max_prefix_lifetime);
diff --git a/bgpd/rfapi/rfapi_ap.c b/bgpd/rfapi/rfapi_ap.c
index 4b8eb9511b..4c415504fa 100644
--- a/bgpd/rfapi/rfapi_ap.c
+++ b/bgpd/rfapi/rfapi_ap.c
@@ -103,12 +103,11 @@ sl_adb_lifetime_cmp (void *adb1, void *adb2)
return 0;
}
-
void
rfapiApInit (struct rfapi_advertised_prefixes *ap)
{
- ap->ipN_by_prefix = skiplist_new (0, vnc_prefix_cmp, NULL);
- ap->ip0_by_ether = skiplist_new (0, vnc_prefix_cmp, NULL);
+ ap->ipN_by_prefix = skiplist_new (0, rfapi_rib_key_cmp, NULL);
+ ap->ip0_by_ether = skiplist_new (0, rfapi_rib_key_cmp, NULL);
ap->by_lifetime = skiplist_new (0, sl_adb_lifetime_cmp, NULL);
}
@@ -192,7 +191,7 @@ rfapiApReadvertiseAll (struct bgp *bgp, struct rfapi_descriptor *rfd)
* TBD this is not quite right. When pfx_ip is 0/32 or 0/128,
* we need to substitute the VN address as the prefix
*/
- add_vnc_route (rfd, bgp, SAFI_MPLS_VPN, &adb->prefix_ip, &prd, /* RD to use (0 for ENCAP) */
+ add_vnc_route (rfd, bgp, SAFI_MPLS_VPN, &adb->u.s.prefix_ip, &prd, /* RD to use (0 for ENCAP) */
&rfd->vn_addr, /* nexthop */
&local_pref, &adb->lifetime, NULL, NULL, /* struct rfapi_un_option */
NULL, /* struct rfapi_vn_option */
@@ -221,11 +220,11 @@ rfapiApWithdrawAll (struct bgp *bgp, struct rfapi_descriptor *rfd)
struct prefix pfx_vn_buf;
struct prefix *pfx_ip;
- if (!(RFAPI_0_PREFIX (&adb->prefix_ip) &&
- RFAPI_HOST_PREFIX (&adb->prefix_ip)))
+ if (!(RFAPI_0_PREFIX (&adb->u.s.prefix_ip) &&
+ RFAPI_HOST_PREFIX (&adb->u.s.prefix_ip)))
{
- pfx_ip = &adb->prefix_ip;
+ pfx_ip = &adb->u.s.prefix_ip;
}
else
@@ -247,7 +246,7 @@ rfapiApWithdrawAll (struct bgp *bgp, struct rfapi_descriptor *rfd)
}
}
- del_vnc_route (rfd, rfd->peer, bgp, SAFI_MPLS_VPN, pfx_ip ? pfx_ip : &pfx_vn_buf, &adb->prd, /* RD to use (0 for ENCAP) */
+ del_vnc_route (rfd, rfd->peer, bgp, SAFI_MPLS_VPN, pfx_ip ? pfx_ip : &pfx_vn_buf, &adb->u.s.prd, /* RD to use (0 for ENCAP) */
ZEBRA_ROUTE_BGP, BGP_ROUTE_RFP, NULL, 0);
}
}
@@ -404,19 +403,19 @@ rfapiApAdjustLifetimeStats (
{
void *cursor;
- struct prefix *prefix;
- struct rfapi_adb *adb;
+ struct rfapi_rib_key rk;
+ struct rfapi_adb *adb;
int rc;
vnc_zlog_debug_verbose ("%s: walking to find new min/max", __func__);
cursor = NULL;
for (rc = skiplist_next (rfd->advertised.ipN_by_prefix,
- (void **) &prefix, (void **) &adb,
+ (void **) &rk, (void **) &adb,
&cursor); !rc;
rc =
skiplist_next (rfd->advertised.ipN_by_prefix,
- (void **) &prefix, (void **) &adb, &cursor))
+ (void **) &rk, (void **) &adb, &cursor))
{
uint32_t lt = adb->lifetime;
@@ -428,10 +427,10 @@ rfapiApAdjustLifetimeStats (
}
cursor = NULL;
for (rc = skiplist_next (rfd->advertised.ip0_by_ether,
- (void **) &prefix, (void **) &adb,
+ (void **) &rk, (void **) &adb,
&cursor); !rc;
rc =
- skiplist_next (rfd->advertised.ip0_by_ether, (void **) &prefix,
+ skiplist_next (rfd->advertised.ip0_by_ether, (void **) &rk,
(void **) &adb, &cursor))
{
@@ -483,14 +482,15 @@ rfapiApAdd (
struct rfapi_adb *adb;
uint32_t old_lifetime = 0;
int use_ip0 = 0;
+ struct rfapi_rib_key rk;
+ rfapi_rib_key_init(pfx_ip, prd, pfx_eth, &rk);
if (RFAPI_0_PREFIX (pfx_ip) && RFAPI_HOST_PREFIX (pfx_ip))
{
use_ip0 = 1;
assert (pfx_eth);
-
rc =
- skiplist_search (rfd->advertised.ip0_by_ether, pfx_eth,
+ skiplist_search (rfd->advertised.ip0_by_ether, &rk,
(void **) &adb);
}
@@ -499,7 +499,7 @@ rfapiApAdd (
/* find prefix in advertised prefixes list */
rc =
- skiplist_search (rfd->advertised.ipN_by_prefix, pfx_ip,
+ skiplist_search (rfd->advertised.ipN_by_prefix, &rk,
(void **) &adb);
}
@@ -510,19 +510,17 @@ rfapiApAdd (
adb = XCALLOC (MTYPE_RFAPI_ADB, sizeof (struct rfapi_adb));
assert (adb);
adb->lifetime = lifetime;
- adb->prefix_ip = *pfx_ip;
- if (pfx_eth)
- adb->prefix_eth = *pfx_eth;
+ adb->u.key = rk;
if (use_ip0)
{
assert (pfx_eth);
- skiplist_insert (rfd->advertised.ip0_by_ether, &adb->prefix_eth,
+ skiplist_insert (rfd->advertised.ip0_by_ether, &adb->u.key,
adb);
}
else
{
- skiplist_insert (rfd->advertised.ipN_by_prefix, &adb->prefix_ip,
+ skiplist_insert (rfd->advertised.ipN_by_prefix, &adb->u.key,
adb);
}
@@ -537,19 +535,12 @@ rfapiApAdd (
adb->lifetime = lifetime;
assert (!skiplist_insert (rfd->advertised.by_lifetime, adb, adb));
}
-
- if (!use_ip0 && pfx_eth && prefix_cmp (&adb->prefix_eth, pfx_eth))
- {
- /* mac address changed */
- adb->prefix_eth = *pfx_eth;
- }
}
adb->cost = cost;
if (l2o)
adb->l2o = *l2o;
else
memset (&adb->l2o, 0, sizeof (struct rfapi_l2address_option));
- adb->prd = *prd;
if (rfapiApAdjustLifetimeStats
(rfd, (rc ? NULL : &old_lifetime), &lifetime))
@@ -568,16 +559,19 @@ rfapiApDelete (
struct rfapi_descriptor *rfd,
struct prefix *pfx_ip,
struct prefix *pfx_eth,
+ struct prefix_rd *prd,
int *advertise_tunnel) /* out */
{
int rc;
struct rfapi_adb *adb;
uint32_t old_lifetime;
int use_ip0 = 0;
+ struct rfapi_rib_key rk;
if (advertise_tunnel)
*advertise_tunnel = 0;
+ rfapi_rib_key_init(pfx_ip, prd, pfx_eth, &rk);
/* find prefix in advertised prefixes list */
if (RFAPI_0_PREFIX (pfx_ip) && RFAPI_HOST_PREFIX (pfx_ip))
{
@@ -585,7 +579,7 @@ rfapiApDelete (
assert (pfx_eth);
rc =
- skiplist_search (rfd->advertised.ip0_by_ether, pfx_eth,
+ skiplist_search (rfd->advertised.ip0_by_ether, &rk,
(void **) &adb);
}
@@ -594,7 +588,7 @@ rfapiApDelete (
/* find prefix in advertised prefixes list */
rc =
- skiplist_search (rfd->advertised.ipN_by_prefix, pfx_ip,
+ skiplist_search (rfd->advertised.ipN_by_prefix, &rk,
(void **) &adb);
}
@@ -607,11 +601,11 @@ rfapiApDelete (
if (use_ip0)
{
- rc = skiplist_delete (rfd->advertised.ip0_by_ether, pfx_eth, NULL);
+ rc = skiplist_delete (rfd->advertised.ip0_by_ether, &rk, NULL);
}
else
{
- rc = skiplist_delete (rfd->advertised.ipN_by_prefix, pfx_ip, NULL);
+ rc = skiplist_delete (rfd->advertised.ipN_by_prefix, &rk, NULL);
}
assert (!rc);
diff --git a/bgpd/rfapi/rfapi_ap.h b/bgpd/rfapi/rfapi_ap.h
index f2805f49cb..8a59f05274 100644
--- a/bgpd/rfapi/rfapi_ap.h
+++ b/bgpd/rfapi/rfapi_ap.h
@@ -93,6 +93,7 @@ rfapiApDelete (
struct rfapi_descriptor *rfd,
struct prefix *pfx_ip,
struct prefix *pfx_eth,
+ struct prefix_rd *prd,
int *advertise_tunnel); /* out */
diff --git a/bgpd/rfapi/rfapi_encap_tlv.c b/bgpd/rfapi/rfapi_encap_tlv.c
index d8713a26b2..171ea8f24d 100644
--- a/bgpd/rfapi/rfapi_encap_tlv.c
+++ b/bgpd/rfapi/rfapi_encap_tlv.c
@@ -131,8 +131,7 @@ rfapi_tunneltype_option_to_tlv (
break;
case BGP_ENCAP_TYPE_MPLS:
- _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS (mpls);
- bgp_encap_type_mpls_to_tlv (&tto->bgpinfo.mpls, attr);
+ /* nothing to do for MPLS */
break;
case BGP_ENCAP_TYPE_MPLS_IN_GRE:
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index 25c05e65f8..ba26497207 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -423,10 +423,7 @@ rfapiGetVncTunnelUnAddr (struct attr *attr, struct prefix *p)
rfapiGetTunnelType (attr, &tun_type);
if (p && tun_type == BGP_ENCAP_TYPE_MPLS)
{
- /* MPLS carries UN address in next hop */
- rfapiNexthop2Prefix (attr, p);
- if (p->family != 0)
- return 0;
+ return ENOENT; /* no UN for MPLS */
}
if (attr && attr->extra)
{
diff --git a/bgpd/rfapi/rfapi_private.h b/bgpd/rfapi/rfapi_private.h
index 33390c4f55..00f90e35fc 100644
--- a/bgpd/rfapi/rfapi_private.h
+++ b/bgpd/rfapi/rfapi_private.h
@@ -35,21 +35,6 @@
#include "rfapi.h"
/*
- * RFAPI Advertisement Data Block
- *
- * Holds NVE prefix advertisement information
- */
-struct rfapi_adb
-{
- struct prefix prefix_ip;
- struct prefix prefix_eth; /* now redundant with l2o */
- struct prefix_rd prd;
- uint32_t lifetime;
- uint8_t cost;
- struct rfapi_l2address_option l2o;
-};
-
-/*
* Lists of rfapi_adb. Each rfapi_adb is referenced twice:
*
* 1. each is referenced in by_lifetime
@@ -62,7 +47,6 @@ struct rfapi_advertised_prefixes
struct skiplist *by_lifetime; /* all */
};
-
struct rfapi_descriptor
{
struct route_node *un_node; /* backref to un table */
@@ -378,9 +362,6 @@ rfp_cost_to_localpref (uint8_t cost);
extern int
rfapi_set_autord_from_vn (struct prefix_rd *rd, struct rfapi_ip_addr *vn);
-extern void
-rfapiAdbFree (struct rfapi_adb *adb);
-
extern struct rfapi_nexthop *
rfapi_nexthop_new (struct rfapi_nexthop *copyme);
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index 6aae35e635..3a4a159215 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -405,10 +405,26 @@ rfapiRibStartTimer (
assert (ri->timer);
}
+extern void
+rfapi_rib_key_init (struct prefix *prefix, /* may be NULL */
+ struct prefix_rd *rd, /* may be NULL */
+ struct prefix *aux, /* may be NULL */
+ struct rfapi_rib_key *rk)
+
+{
+ memset((void *)rk, 0, sizeof(struct rfapi_rib_key));
+ if (prefix)
+ rk->vn = *prefix;
+ if (rd)
+ rk->rd = *rd;
+ if (aux)
+ rk->aux_prefix = *aux;
+}
+
/*
* Compares two <struct rfapi_rib_key>s
*/
-static int
+int
rfapi_rib_key_cmp (void *k1, void *k2)
{
struct rfapi_rib_key *a = (struct rfapi_rib_key *) k1;
diff --git a/bgpd/rfapi/rfapi_rib.h b/bgpd/rfapi/rfapi_rib.h
index 2a111946f7..74331a28d0 100644
--- a/bgpd/rfapi/rfapi_rib.h
+++ b/bgpd/rfapi/rfapi_rib.h
@@ -45,6 +45,27 @@ struct rfapi_rib_key
*/
struct prefix aux_prefix;
};
+#include "rfapi.h"
+
+/*
+ * RFAPI Advertisement Data Block
+ *
+ * Holds NVE prefix advertisement information
+ */
+struct rfapi_adb
+{
+ union {
+ struct {
+ struct prefix prefix_ip;
+ struct prefix_rd prd;
+ struct prefix prefix_eth;
+ } s; /* mainly for legacy use */
+ struct rfapi_rib_key key;
+ } u;
+ uint32_t lifetime;
+ uint8_t cost;
+ struct rfapi_l2address_option l2o;
+};
struct rfapi_info
{
@@ -151,4 +172,16 @@ rfapiRibCheckCounts (
#define RFAPI_RIB_CHECK_COUNTS(checkstats, offset)
#endif
+extern void
+rfapi_rib_key_init (struct prefix *prefix, /* may be NULL */
+ struct prefix_rd *rd, /* may be NULL */
+ struct prefix *aux, /* may be NULL */
+ struct rfapi_rib_key *rk);
+
+extern int
+rfapi_rib_key_cmp (void *k1, void *k2);
+
+extern void
+rfapiAdbFree (struct rfapi_adb *adb);
+
#endif /* QUAGGA_HGP_RFAPI_RIB_H */
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index fe9b8a3f50..1118cfd76f 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -490,14 +490,7 @@ rfapi_vty_out_vncinfo (
if (bi->extra != NULL)
vty_out (vty, " label=%u", decode_label (bi->extra->tag));
- if (rfapiGetVncLifetime (bi->attr, &lifetime))
- {
- if (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP)
- {
- vty_out (vty, " life=none");
- }
- }
- else
+ if (!rfapiGetVncLifetime (bi->attr, &lifetime))
{
vty_out (vty, " life=%d", lifetime);
}
@@ -1853,14 +1846,14 @@ rfapiPrintDescriptor (struct vty *vty, struct rfapi_descriptor *rfd)
{
/* group like family prefixes together in output */
- if (family != adb->prefix_ip.family)
+ if (family != adb->u.s.prefix_ip.family)
continue;
- prefix2str (&adb->prefix_ip, buf, BUFSIZ);
+ prefix2str (&adb->u.s.prefix_ip, buf, BUFSIZ);
buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */
vty_out (vty, " Adv Pfx: %s%s", buf, HVTY_NEWLINE);
- rfapiPrintAdvertisedInfo (vty, rfd, SAFI_MPLS_VPN, &adb->prefix_ip);
+ rfapiPrintAdvertisedInfo (vty, rfd, SAFI_MPLS_VPN, &adb->u.s.prefix_ip);
}
}
for (rc =
@@ -1871,14 +1864,14 @@ rfapiPrintDescriptor (struct vty *vty, struct rfapi_descriptor *rfd)
&cursor))
{
- prefix2str (&adb->prefix_eth, buf, BUFSIZ);
+ prefix2str (&adb->u.s.prefix_eth, buf, BUFSIZ);
buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */
vty_out (vty, " Adv Pfx: %s%s", buf, HVTY_NEWLINE);
/* TBD update the following function to print ethernet info */
/* Also need to pass/use rd */
- rfapiPrintAdvertisedInfo (vty, rfd, SAFI_MPLS_VPN, &adb->prefix_ip);
+ rfapiPrintAdvertisedInfo (vty, rfd, SAFI_MPLS_VPN, &adb->u.s.prefix_ip);
}
vty_out (vty, "%s", HVTY_NEWLINE);
}
@@ -3370,7 +3363,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda)
if (pPrefix)
{
- if (!prefix_same (pPrefix, &adb->prefix_ip))
+ if (!prefix_same (pPrefix, &adb->u.s.prefix_ip))
{
#if DEBUG_L2_EXTRA
vnc_zlog_debug_verbose ("%s: adb=%p, prefix doesn't match, skipping",
@@ -3383,7 +3376,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda)
{
if (memcmp
(cda->l2o.o.macaddr.octet,
- adb->prefix_eth.u.prefix_eth.octet, ETHER_ADDR_LEN))
+ adb->u.s.prefix_eth.u.prefix_eth.octet, ETHER_ADDR_LEN))
{
#if DEBUG_L2_EXTRA
vnc_zlog_debug_verbose ("%s: adb=%p, macaddr doesn't match, skipping",
@@ -3425,24 +3418,23 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda)
this_advertisement_prefix_count = 1;
- rfapiQprefix2Rprefix (&adb->prefix_ip, &rp);
+ rfapiQprefix2Rprefix (&adb->u.s.prefix_ip, &rp);
/* if mac addr present in advert, make l2o vn option */
- if (adb->prefix_eth.family == AF_ETHERNET)
+ if (adb->u.s.prefix_eth.family == AF_ETHERNET)
{
-
memset (&vn1, 0, sizeof (vn1));
memset (&vn2, 0, sizeof (vn2));
vn1.type = RFAPI_VN_OPTION_TYPE_L2ADDR;
- vn1.v.l2addr.macaddr = adb->prefix_eth.u.prefix_eth;
+ vn1.v.l2addr.macaddr = adb->u.s.prefix_eth.u.prefix_eth;
/*
* use saved RD value instead of trying to invert
* complex L2-style RD computation in rfapi_register()
*/
vn2.type = RFAPI_VN_OPTION_TYPE_INTERNAL_RD;
- vn2.v.internal_rd = adb->prd;
+ vn2.v.internal_rd = adb->u.s.prd;
vn1.next = &vn2;
@@ -3494,7 +3486,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda)
if (CHECK_FLAG (cda->l2o.flags, RFAPI_L2O_MACADDR))
{
if (memcmp (cda->l2o.o.macaddr.octet,
- adb->prefix_eth.u.prefix_eth.octet,
+ adb->u.s.prefix_eth.u.prefix_eth.octet,
ETHER_ADDR_LEN))
{
@@ -3521,7 +3513,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda)
struct rfapi_vn_option vn;
- rfapiQprefix2Rprefix (&adb->prefix_ip, &rp);
+ rfapiQprefix2Rprefix (&adb->u.s.prefix_ip, &rp);
memset (&vn, 0, sizeof (vn));
vn.type = RFAPI_VN_OPTION_TYPE_L2ADDR;
diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in
index 3e85936069..9813b19ced 100755
--- a/vtysh/extract.pl.in
+++ b/vtysh/extract.pl.in
@@ -56,12 +56,16 @@ $ignore{'"address-family ipv4"'} = "ignore";
$ignore{'"address-family ipv4 (unicast|multicast)"'} = "ignore";
$ignore{'"address-family ipv6"'} = "ignore";
$ignore{'"address-family ipv6 (unicast|multicast)"'} = "ignore";
+$ignore{'"address-family ipv4 vpn"'} = "ignore";
$ignore{'"address-family vpnv4"'} = "ignore";
$ignore{'"address-family vpnv4 unicast"'} = "ignore";
$ignore{'"address-family ipv4 vrf NAME"'} = "ignore";
$ignore{'"address-family encap"'} = "ignore";
$ignore{'"address-family encapv4"'} = "ignore";
$ignore{'"address-family encapv6"'} = "ignore";
+$ignore{'"address-family ipv4 encap"'} = "ignore";
+$ignore{'"address-family ipv6 encap"'} = "ignore";
+$ignore{'"address-family ipv6 vpn"'} = "ignore";
$ignore{'"address-family vpnv6"'} = "ignore";
$ignore{'"address-family vpnv6 unicast"'} = "ignore";
$ignore{'"exit-address-family"'} = "ignore";