summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/rfapi/bgp_rfapi_cfg.c5
-rw-r--r--bgpd/rfapi/rfapi.c9
-rw-r--r--bgpd/rfapi/rfapi_import.c11
-rw-r--r--bgpd/rfapi/rfapi_vty.c9
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c6
5 files changed, 27 insertions, 13 deletions
diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c
index bc268f6086..50693659b6 100644
--- a/bgpd/rfapi/bgp_rfapi_cfg.c
+++ b/bgpd/rfapi/bgp_rfapi_cfg.c
@@ -3417,6 +3417,7 @@ DEFUN (vnc_vrf_policy_nexthop,
{
UNSET_FLAG (rfg->flags, RFAPI_RFG_VPN_NH_SELF);
rfg->vn_prefix = p;
+ rfg->un_prefix = p;
}
/* TBD handle router-id/ nexthop changes when have advertised prefixes */
@@ -4177,8 +4178,8 @@ bgp_rfapi_cfg_init (void)
install_element (BGP_VRF_POLICY_NODE, &vnc_vrf_policy_label_cmd);
install_element (BGP_VRF_POLICY_NODE, &vnc_vrf_policy_no_label_cmd);
- //Hide per Jan 17 discussion
- //install_element (BGP_VRF_POLICY_NODE, &vnc_vrf_policy_nexthop_cmd);
+ //Reenable to support VRF controller use case and testing
+ install_element (BGP_VRF_POLICY_NODE, &vnc_vrf_policy_nexthop_cmd);
install_element (BGP_VRF_POLICY_NODE, &vnc_vrf_policy_rt_import_cmd);
install_element (BGP_VRF_POLICY_NODE, &vnc_vrf_policy_rt_export_cmd);
install_element (BGP_VRF_POLICY_NODE, &vnc_vrf_policy_rt_both_cmd);
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index 6ca45496e4..3cf09e240e 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -759,10 +759,11 @@ add_vnc_route (
bgp, un_addr, &rfd->default_tunneltype_option, &attr,
l2o != NULL);
}
- else
- TunnelType = rfapi_tunneltype_option_to_tlv (
- bgp, un_addr, NULL,
- /* create one to carry un_addr */ &attr, l2o != NULL);
+ else /* create default for local addse */
+ if (type == ZEBRA_ROUTE_BGP && sub_type == BGP_ROUTE_RFP)
+ TunnelType =
+ rfapi_tunneltype_option_to_tlv (bgp, un_addr, NULL,
+ &attr, l2o != NULL);
}
if (TunnelType == BGP_ENCAP_TYPE_MPLS)
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index 8e68eec53a..9ae3311e15 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -421,9 +421,16 @@ rfapiGetVncTunnelUnAddr (struct attr *attr, struct prefix *p)
bgp_encap_types tun_type;
rfapiGetTunnelType (attr, &tun_type);
- if (p && tun_type == BGP_ENCAP_TYPE_MPLS)
+ if (tun_type == BGP_ENCAP_TYPE_MPLS)
{
- return ENOENT; /* no UN for MPLS */
+ if (!p)
+ return 0;
+ /* MPLS carries UN address in next hop */
+ rfapiNexthop2Prefix (attr, p);
+ if (p->family != 0)
+ return 0;
+
+ return ENOENT;
}
if (attr && attr->extra)
{
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index d64af8dba4..521c2319b2 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -1176,16 +1176,18 @@ rfapiPrintRemoteRegBi (
inet_ntop (pfx_un.family, &pfx_un.u.prefix, buf_ntop,
BUFSIZ));
}
- buf_un[BUFSIZ - 1] = 0;
rfapiGetTunnelType(bi->attr,&tun_type);
/*
* VN addr
*/
buf_vn[0] = 0;
+ rfapiNexthop2Prefix (bi->attr, &pfx_vn);
if (tun_type == BGP_ENCAP_TYPE_MPLS)
{
/* MPLS carries un in nrli next hop (same as vn for IP tunnels) */
+ snprintf (buf_un, BUFSIZ, "%s",
+ inet_ntop (pfx_vn.family, &pfx_vn.u.prefix, buf_ntop, BUFSIZ));
if (bi->extra)
{
u_int32_t l = decode_label (bi->extra->tag);
@@ -1198,13 +1200,12 @@ rfapiPrintRemoteRegBi (
}
else
{
- rfapiNexthop2Prefix (bi->attr, &pfx_vn);
snprintf (buf_vn, BUFSIZ, "%s",
inet_ntop (pfx_vn.family, &pfx_vn.u.prefix, buf_ntop, BUFSIZ));
}
buf_vn[BUFSIZ - 1] = 0;
+ buf_un[BUFSIZ - 1] = 0;
-
/*
* Cost is encoded in local_pref as (255-cost)
* See rfapi_import.c'rfapiRouteInfo2NextHopEntry() for conversion
@@ -5188,7 +5189,7 @@ vnc_add_vrf_prefix (struct vty *vty,
DEFUN (add_vrf_prefix_rd_label_pref,
add_vrf_prefix_rd_label_pref_cmd,
- "add vrf NAME prefix <A.B.C.D/M|X:X::X:X/M> [rd ASN:nn_or_IP-address] [label (0-1048575)] [preference (0-4294967295)]",
+ "add vrf NAME prefix <A.B.C.D/M|X:X::X:X/M> [{rd ASN:nn_or_IP-address|label (0-1048575)|preference (0-4294967295)}]",
"Add\n"
"To a VRF\n"
"VRF name\n"
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index 62c31a662a..dca6a07497 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -465,6 +465,7 @@ vnc_import_bgp_add_route_mode_resolve_nve_one_bi (
uint32_t lifetime;
uint32_t *plifetime;
struct bgp_attr_encap_subtlv *encaptlvs;
+ uint32_t label = 0;
vnc_zlog_debug_verbose ("%s: entry", __func__);
@@ -520,6 +521,9 @@ vnc_import_bgp_add_route_mode_resolve_nve_one_bi (
if (bi->attr && bi->attr->extra && bi->attr->extra->ecommunity)
ecommunity_merge (new_ecom, bi->attr->extra->ecommunity);
+ if (bi->extra)
+ label = decode_label (bi->extra->tag);
+
add_vnc_route (
&vncHDResolveNve,
bgp,
@@ -534,7 +538,7 @@ vnc_import_bgp_add_route_mode_resolve_nve_one_bi (
NULL,
new_ecom,
med, /* NULL => don't set med */
- NULL, /* label: default */
+ (label?&label:NULL), /* NULL= default */
ZEBRA_ROUTE_BGP_DIRECT,
BGP_ROUTE_REDISTRIBUTE,
RFAPI_AHR_RFPOPT_IS_VNCTLV); /* flags */