From 130c31c8356d5d4efc451187646be018defaf500 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sat, 28 Jan 2017 18:57:28 -0500 Subject: [PATCH 1/6] bgpd rfapi: only auto add default tunnel type for local registrations Signed-off-by: Lou Berger --- bgpd/rfapi/rfapi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 3a6c313888..75f92c8218 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) From 1858c1d1c43d7cb3408a57719112307602565f66 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sat, 28 Jan 2017 19:21:03 -0500 Subject: [PATCH 2/6] bgpd rfapi: pass received label on resolved NVE imports Signed-off-by: Lou Berger --- bgpd/rfapi/vnc_import_bgp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 */ From def3f4e94250a4c9db1f6242a8cc1b7b8d4ac67b Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sun, 29 Jan 2017 08:15:23 -0500 Subject: [PATCH 3/6] bgpd rfapi: fix UN address in show with MPLS TT Signed-off-by: Lou Berger --- bgpd/rfapi/rfapi_vty.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index f7c3773fd4..f6aa353df3 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -1175,16 +1175,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); @@ -1197,13 +1199,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 From f00f9420f9b4e78604feb0c6520183ff2ae319af Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sat, 28 Jan 2017 18:56:43 -0500 Subject: [PATCH 4/6] bgpd: fix add vrf optional parameter parsing Signed-off-by: Lou Berger --- bgpd/rfapi/rfapi_vty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index f6aa353df3..dacf338e13 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -5185,7 +5185,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 [rd ASN:nn_or_IP-address] [label (0-1048575)] [preference (0-4294967295)]", + "add vrf NAME prefix [{rd ASN:nn_or_IP-address|label (0-1048575)|preference (0-4294967295)}]", "Add\n" "To a VRF\n" "VRF name\n" From 3d05643ecd9f3f42ccd13bcde200d89fdea94c64 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sun, 29 Jan 2017 10:10:23 -0500 Subject: [PATCH 5/6] bgpd: reenable nexthop vrf-policy to suppory VRF controller use case Signed-off-by: Lou Berger --- bgpd/rfapi/bgp_rfapi_cfg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 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); From 90dc8d1ba5861e91bc99f2bda8319091ba0dbd23 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Tue, 31 Jan 2017 16:42:47 -0500 Subject: [PATCH 6/6] bgp rfapi: fix resolution / lookup failure when using MPLS TT Signed-off-by: Lou Berger --- bgpd/rfapi/rfapi_import.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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) {