diff options
| -rw-r--r-- | bgpd/bgp_mplsvpn.c | 40 | ||||
| -rw-r--r-- | bgpd/bgp_nht.c | 4 | ||||
| -rw-r--r-- | isisd/isis_adjacency.c | 10 | ||||
| -rw-r--r-- | ospf6d/ospf6_flood.c | 43 | ||||
| -rw-r--r-- | zebra/zebra_nhg.c | 10 |
5 files changed, 71 insertions, 36 deletions
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, diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index 2729dce382..11f17ec7bf 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -31,6 +31,7 @@ #include "thread.h" #include "if.h" #include "stream.h" +#include "bfd.h" #include "isisd/isis_constants.h" #include "isisd/isis_common.h" @@ -814,6 +815,15 @@ void isis_adj_print_vty(struct isis_adjacency *adj, struct vty *vty, vty_out(vty, " %s\n", buf); } } + if (adj->circuit && adj->circuit->bfd_config.enabled) { + vty_out(vty, " BFD is %s%s\n", + adj->bfd_session ? "active, status " + : "configured", + !adj->bfd_session + ? "" + : bfd_get_status_str(bfd_sess_status( + adj->bfd_session))); + } for (ALL_LIST_ELEMENTS_RO(adj->adj_sids, anode, sra)) { const char *adj_type; const char *backup; diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index cc82084e5e..bc9e2c3405 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -878,6 +878,28 @@ static int ospf6_is_maxage_lsa_drop(struct ospf6_lsa *lsa, return 0; } +static bool ospf6_lsa_check_min_arrival(struct ospf6_lsa *lsa, + struct ospf6_neighbor *from) +{ + struct timeval now, res; + unsigned int time_delta_ms; + + monotime(&now); + timersub(&now, &lsa->installed, &res); + time_delta_ms = (res.tv_sec * 1000) + (int)(res.tv_usec / 1000); + + if (time_delta_ms < from->ospf6_if->area->ospf6->lsa_minarrival) { + if (IS_OSPF6_DEBUG_FLOODING || + IS_OSPF6_DEBUG_FLOOD_TYPE(lsa->header->type)) + zlog_debug( + "LSA can't be updated within MinLSArrival, %dms < %dms, discard", + time_delta_ms, + from->ospf6_if->area->ospf6->lsa_minarrival); + return true; + } + return false; +} + /* RFC2328 section 13 The Flooding Procedure */ void ospf6_receive_lsa(struct ospf6_neighbor *from, struct ospf6_lsa_header *lsa_header) @@ -885,7 +907,6 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from, struct ospf6_lsa *new = NULL, *old = NULL, *rem = NULL; int ismore_recent; int is_debug = 0; - unsigned int time_delta_ms; ismore_recent = 1; assert(from); @@ -993,19 +1014,7 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from, /* (a) MinLSArrival check */ if (old) { - struct timeval now, res; - monotime(&now); - timersub(&now, &old->installed, &res); - time_delta_ms = - (res.tv_sec * 1000) + (int)(res.tv_usec / 1000); - if (time_delta_ms - < from->ospf6_if->area->ospf6->lsa_minarrival) { - if (is_debug) - zlog_debug( - "LSA can't be updated within MinLSArrival, %dms < %dms, discard", - time_delta_ms, - from->ospf6_if->area->ospf6 - ->lsa_minarrival); + if (ospf6_lsa_check_min_arrival(old, from)) { ospf6_lsa_delete(new); return; /* examin next lsa */ } @@ -1222,7 +1231,11 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from, __PRETTY_FUNCTION__, old->name); } - /* XXX, MinLSArrival check !? RFC 2328 13 (8) */ + /* MinLSArrival check as per RFC 2328 13 (8) */ + if (ospf6_lsa_check_min_arrival(old, from)) { + ospf6_lsa_delete(new); + return; /* examin next lsa */ + } ospf6_lsdb_add(ospf6_lsa_copy(old), from->lsupdate_list); diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index d1a34d0962..069d35c6a3 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -3002,10 +3002,12 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx) nhe->zapi_session, nhe->id, ZAPI_NHG_FAIL_INSTALL); - flog_err( - EC_ZEBRA_DP_INSTALL_FAIL, - "Failed to install Nexthop ID (%u) into the kernel", - nhe->id); + if (!(zebra_nhg_proto_nexthops_only() && + !PROTO_OWNED(nhe))) + flog_err( + EC_ZEBRA_DP_INSTALL_FAIL, + "Failed to install Nexthop ID (%u) into the kernel", + nhe->id); } break; |
