diff options
Diffstat (limited to 'bgpd')
| -rw-r--r-- | bgpd/bgp_evpn.c | 11 | ||||
| -rw-r--r-- | bgpd/bgp_evpn_mh.c | 8 | ||||
| -rw-r--r-- | bgpd/bgp_evpn_mh.h | 10 | ||||
| -rw-r--r-- | bgpd/bgp_mplsvpn.c | 40 | ||||
| -rw-r--r-- | bgpd/bgp_nht.c | 4 |
5 files changed, 44 insertions, 29 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 3224c1a2b0..fbb0d2272a 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -3366,7 +3366,9 @@ static int bgp_evpn_install_uninstall_table(struct bgp *bgp, afi_t afi, assert(attr); - /* Only type-2, type-3, type-4 and type-5 are supported currently */ + /* Only type-1, type-2, type-3, type-4 and type-5 + * are supported currently + */ if (!(evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE || evp->prefix.route_type == BGP_EVPN_IMET_ROUTE || evp->prefix.route_type == BGP_EVPN_ES_ROUTE @@ -3471,7 +3473,7 @@ static int bgp_evpn_install_uninstall_table(struct bgp *bgp, afi_t afi, if (evp->prefix.route_type == BGP_EVPN_ES_ROUTE) { /* we will match based on the entire esi to avoid - * imoort of an es route for esi2 into esi1 + * import of an es route for esi2 into esi1 */ es = bgp_evpn_es_find(&evp->prefix.es_addr.esi); if (es && bgp_evpn_is_es_local(es)) @@ -6097,8 +6099,9 @@ bool bgp_evpn_is_prefix_nht_supported(const struct prefix *pfx) * EVPN routes should be marked as valid only if the nexthop is * reachable. Only if this happens, the route should be imported * (into VNI or VRF routing tables) and/or advertised. - * Note: This is currently applied for EVPN type-2, type-3 and - * type-5 routes. It may be tweaked later on for other routes, or + * Note: This is currently applied for EVPN type-1, type-2, + * type-3, type-4 and type-5 routes. + * It may be tweaked later on for other routes, or * even removed completely when all routes are handled. */ if (pfx && pfx->family == AF_EVPN diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index b9e3577f5c..6db4cba44d 100644 --- a/bgpd/bgp_evpn_mh.c +++ b/bgpd/bgp_evpn_mh.c @@ -287,7 +287,7 @@ static int bgp_evpn_es_route_uninstall(struct bgp *bgp, struct bgp_evpn_es *es, return ret; } -/* Install or unistall a Tyoe-4 route in the per-ES routing table */ +/* Install or unistall a Type-4 route in the per-ES routing table */ int bgp_evpn_es_route_install_uninstall(struct bgp *bgp, struct bgp_evpn_es *es, afi_t afi, safi_t safi, struct prefix_evpn *evp, struct bgp_path_info *pi, int install) @@ -378,16 +378,16 @@ int bgp_evpn_mh_route_update(struct bgp *bgp, struct bgp_evpn_es *es, remote_pi = tmp_pi; } - /* we don't expect to see a remote_ri at this point as + /* we don't expect to see a remote_pi at this point as * an ES route has {esi, vtep_ip} as the key in the ES-rt-table * in the VNI-rt-table. */ if (remote_pi) { flog_err( EC_BGP_ES_INVALID, - "%u ERROR: local es route for ESI: %s Vtep %pI4 also learnt from remote", + "%u ERROR: local es route for ESI: %s vtep %pI4 also learnt from remote", bgp->vrf_id, es ? es->esi_str : "Null", - &es->originator_ip); + es ? &es->originator_ip : NULL); return -1; } diff --git a/bgpd/bgp_evpn_mh.h b/bgpd/bgp_evpn_mh.h index 2e2e4231e6..dc3fe44776 100644 --- a/bgpd/bgp_evpn_mh.h +++ b/bgpd/bgp_evpn_mh.h @@ -50,7 +50,9 @@ struct bgp_evpn_es_frag { /* RD for this ES fragment */ struct prefix_rd prd; - /* Memory used for linking bgp_evpn_es_rd to bgp_evpn_es->rd_list */ + /* Memory used for linking bgp_evpn_es_frag to + * bgp_evpn_es->es_frag_list + */ struct listnode es_listnode; /* List of ES-EVIs associated with this fragment */ @@ -59,11 +61,11 @@ struct bgp_evpn_es_frag { /* Ethernet Segment entry - * - Local and remote ESs are maintained in a global RB tree, - * bgp_mh_info->es_rb_tree using ESI as key + * bgp_mh_info->es_rb_tree using ESI as key * - Local ESs are received from zebra (BGP_EVPNES_LOCAL) * - Remotes ESs are implicitly created (by reference) by a remote ES-EVI * (BGP_EVPNES_REMOTE) - * - An ES can be simulatenously LOCAL and REMOTE; infact all LOCAL ESs are + * - An ES can be simultaneously LOCAL and REMOTE; infact all LOCAL ESs are * expected to have REMOTE ES peers. */ struct bgp_evpn_es { @@ -101,7 +103,7 @@ struct bgp_evpn_es { */ struct listnode pend_es_listnode; - /* [EVPNES_LOCAL] List of RDs for this ES (bgp_evpn_es_rd) */ + /* [EVPNES_LOCAL] List of RDs for this ES (bgp_evpn_es_frag) */ struct list *es_frag_list; struct bgp_evpn_es_frag *es_base_frag; diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 0074d5daac..b3d8d1b82d 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -516,28 +516,35 @@ static bool sid_exist(struct bgp *bgp, const struct in6_addr *sid) } /* + * This function generates a new SID based on bgp->srv6_locator_chunks and + * index. The locator and generated SID are stored in arguments sid_locator + * and sid, respectively. + * * if index != 0: try to allocate as index-mode * else: try to allocate as auto-mode */ static uint32_t alloc_new_sid(struct bgp *bgp, uint32_t index, - struct in6_addr *sid_locator) + struct in6_addr *sid_locator, + struct in6_addr *sid) { struct listnode *node; struct srv6_locator_chunk *chunk; - struct in6_addr sid_buf; bool alloced = false; int label = 0; + uint8_t offset = 0; - if (!bgp || !sid_locator) + if (!bgp || !sid_locator || !sid) return false; for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, chunk)) { *sid_locator = chunk->prefix.prefix; - sid_buf = chunk->prefix.prefix; + *sid = chunk->prefix.prefix; + offset = chunk->block_bits_length + chunk->node_bits_length; + if (index != 0) { label = index << 12; - transpose_sid(&sid_buf, label, 64, 16); - if (sid_exist(bgp, &sid_buf)) + transpose_sid(sid, label, offset, 16); + if (sid_exist(bgp, sid)) return false; alloced = true; break; @@ -545,8 +552,8 @@ static uint32_t alloc_new_sid(struct bgp *bgp, uint32_t index, for (size_t i = 1; i < 255; i++) { label = i << 12; - transpose_sid(&sid_buf, label, 64, 16); - if (sid_exist(bgp, &sid_buf)) + transpose_sid(sid, label, offset, 16); + if (sid_exist(bgp, sid)) continue; alloced = true; break; @@ -556,7 +563,7 @@ static uint32_t alloc_new_sid(struct bgp *bgp, uint32_t index, if (!alloced) return 0; - sid_register(bgp, &sid_buf, bgp->srv6_locator_name); + sid_register(bgp, sid, bgp->srv6_locator_name); return label; } @@ -600,20 +607,19 @@ void ensure_vrf_tovpn_sid(struct bgp *bgp_vpn, struct bgp *bgp_vrf, afi_t afi) tovpn_sid_locator = XCALLOC(MTYPE_BGP_SRV6_SID, sizeof(struct in6_addr)); - tovpn_sid_transpose_label = - alloc_new_sid(bgp_vpn, tovpn_sid_index, tovpn_sid_locator); + tovpn_sid = XCALLOC(MTYPE_BGP_SRV6_SID, sizeof(struct in6_addr)); + + tovpn_sid_transpose_label = alloc_new_sid(bgp_vpn, tovpn_sid_index, + tovpn_sid_locator, tovpn_sid); + if (tovpn_sid_transpose_label == 0) { zlog_debug("%s: not allocated new sid for vrf %s: afi %s", __func__, bgp_vrf->name_pretty, afi2str(afi)); + XFREE(MTYPE_BGP_SRV6_SID, tovpn_sid_locator); + XFREE(MTYPE_BGP_SRV6_SID, tovpn_sid); return; } - tovpn_sid = XCALLOC(MTYPE_BGP_SRV6_SID, sizeof(struct in6_addr)); - *tovpn_sid = *tovpn_sid_locator; - transpose_sid(tovpn_sid, tovpn_sid_transpose_label, - BGP_PREFIX_SID_SRV6_TRANSPOSITION_OFFSET, - BGP_PREFIX_SID_SRV6_TRANSPOSITION_LENGTH); - if (debug) { inet_ntop(AF_INET6, tovpn_sid, buf, sizeof(buf)); zlog_debug("%s: new sid %s allocated for vrf %s: afi %s", diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index d3ebc0e6a2..f5b3556731 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -589,6 +589,10 @@ static void bgp_nht_ifp_handle(struct interface *ifp, bool up) if (!bgp) return; + bgp_nht_ifp_table_handle(bgp, &bgp->nexthop_cache_table[AFI_IP], ifp, + up); + bgp_nht_ifp_table_handle(bgp, &bgp->import_check_table[AFI_IP], ifp, + up); bgp_nht_ifp_table_handle(bgp, &bgp->nexthop_cache_table[AFI_IP6], ifp, up); bgp_nht_ifp_table_handle(bgp, &bgp->import_check_table[AFI_IP6], ifp, |
