diff options
| -rw-r--r-- | bgpd/bgp_attr.c | 46 | ||||
| -rw-r--r-- | bgpd/bgp_fsm.c | 5 | ||||
| -rw-r--r-- | bgpd/bgpd.c | 11 | ||||
| -rw-r--r-- | bgpd/bgpd.h | 4 | ||||
| -rw-r--r-- | bgpd/rfapi/bgp_rfapi_cfg.c | 4 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi.c | 2 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi_import.c | 62 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi_rib.c | 16 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi_vty.c | 4 | ||||
| -rwxr-xr-x | configure.ac | 24 | ||||
| -rw-r--r-- | doc/manpages/conf.py | 2 | ||||
| -rw-r--r-- | lib/getopt.h | 2 | ||||
| -rw-r--r-- | lib/seqlock.c | 4 | ||||
| -rw-r--r-- | lib/skiplist.c | 12 | ||||
| -rw-r--r-- | lib/stream.h | 2 | ||||
| -rw-r--r-- | ospfd/ospf_vty.c | 2 | ||||
| -rw-r--r-- | pimd/pim_vxlan.c | 43 | ||||
| -rw-r--r-- | pimd/pim_vxlan.h | 2 | ||||
| -rw-r--r-- | pimd/pimd.c | 2 | ||||
| -rw-r--r-- | ripngd/ripngd.c | 2 | ||||
| -rw-r--r-- | tools/coccinelle/__func__.cocci (renamed from scripts/coccinelle/__func__.cocci) | 0 | ||||
| -rw-r--r-- | tools/coccinelle/bool_assignment.cocci (renamed from scripts/coccinelle/bool_assignment.cocci) | 0 | ||||
| -rw-r--r-- | tools/coccinelle/bool_expression.cocci (renamed from scripts/coccinelle/bool_expression.cocci) | 0 | ||||
| -rw-r--r-- | tools/coccinelle/bool_function.cocci (renamed from scripts/coccinelle/bool_function.cocci) | 0 | ||||
| -rw-r--r-- | tools/coccinelle/bool_function_type.cocci (renamed from scripts/coccinelle/bool_function_type.cocci) | 0 | ||||
| -rw-r--r-- | tools/coccinelle/replace_bgp_flag_functions.cocci (renamed from scripts/coccinelle/replace_bgp_flag_functions.cocci) | 0 | ||||
| -rw-r--r-- | tools/coccinelle/return_without_parenthesis.cocci (renamed from scripts/coccinelle/return_without_parenthesis.cocci) | 0 | ||||
| -rw-r--r-- | tools/coccinelle/s_addr_0_to_INADDR_ANY.cocci (renamed from scripts/coccinelle/s_addr_0_to_INADDR_ANY.cocci) | 0 | ||||
| -rw-r--r-- | tools/coccinelle/shorthand_operator.cocci (renamed from scripts/coccinelle/shorthand_operator.cocci) | 0 | ||||
| -rw-r--r-- | tools/coccinelle/test_after_assert.cocci (renamed from scripts/coccinelle/test_after_assert.cocci) | 0 | ||||
| -rw-r--r-- | tools/coccinelle/void_no_return.cocci (renamed from scripts/coccinelle/void_no_return.cocci) | 0 | ||||
| -rw-r--r-- | zebra/redistribute.c | 4 | ||||
| -rw-r--r-- | zebra/rtadv.c | 17 | ||||
| -rw-r--r-- | zebra/zebra_dplane.c | 4 | ||||
| -rw-r--r-- | zebra/zebra_nhg.c | 4 |
35 files changed, 163 insertions, 117 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 33466957b0..a1278874c4 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -47,7 +47,7 @@ #include "bgpd/bgp_lcommunity.h" #include "bgpd/bgp_updgrp.h" #include "bgpd/bgp_encap_types.h" -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC #include "bgpd/rfapi/bgp_rfapi_cfg.h" #include "bgp_encap_types.h" #include "bgp_vnc_types.h" @@ -79,7 +79,7 @@ static const struct message attr_str[] = { {BGP_ATTR_AS_PATHLIMIT, "AS_PATHLIMIT"}, {BGP_ATTR_PMSI_TUNNEL, "PMSI_TUNNEL_ATTRIBUTE"}, {BGP_ATTR_ENCAP, "ENCAP"}, -#if ENABLE_BGP_VNC_ATTR +#ifdef ENABLE_BGP_VNC_ATTR {BGP_ATTR_VNC, "VNC"}, #endif {BGP_ATTR_LARGE_COMMUNITIES, "LARGE_COMMUNITY"}, @@ -199,7 +199,7 @@ static void cluster_finish(void) } static struct hash *encap_hash = NULL; -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC static struct hash *vnc_hash = NULL; #endif static struct hash *srv6_l3vpn_hash; @@ -247,7 +247,7 @@ void bgp_attr_flush_encap(struct attr *attr) encap_free(attr->encap_subtlvs); attr->encap_subtlvs = NULL; } -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC if (attr->vnc_subtlvs) { encap_free(attr->vnc_subtlvs); attr->vnc_subtlvs = NULL; @@ -309,7 +309,7 @@ static void *encap_hash_alloc(void *p) typedef enum { ENCAP_SUBTLV_TYPE, -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC VNC_SUBTLV_TYPE #endif } encap_subtlv_type; @@ -319,7 +319,7 @@ encap_intern(struct bgp_attr_encap_subtlv *encap, encap_subtlv_type type) { struct bgp_attr_encap_subtlv *find; struct hash *hash = encap_hash; -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC if (type == VNC_SUBTLV_TYPE) hash = vnc_hash; #endif @@ -341,7 +341,7 @@ static void encap_unintern(struct bgp_attr_encap_subtlv **encapp, if (encap->refcnt == 0) { struct hash *hash = encap_hash; -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC if (type == VNC_SUBTLV_TYPE) hash = vnc_hash; #endif @@ -368,7 +368,7 @@ static void encap_init(void) { encap_hash = hash_create(encap_hash_key_make, encap_hash_cmp, "BGP Encap Hash"); -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC vnc_hash = hash_create(encap_hash_key_make, encap_hash_cmp, "BGP VNC Hash"); #endif @@ -379,7 +379,7 @@ static void encap_finish(void) hash_clean(encap_hash, (void (*)(void *))encap_free); hash_free(encap_hash); encap_hash = NULL; -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC hash_clean(vnc_hash, (void (*)(void *))encap_free); hash_free(vnc_hash); vnc_hash = NULL; @@ -660,7 +660,7 @@ unsigned int attrhash_key_make(const void *p) MIX(transit_hash_key_make(attr->transit)); if (attr->encap_subtlvs) MIX(encap_hash_key_make(attr->encap_subtlvs)); -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC if (attr->vnc_subtlvs) MIX(encap_hash_key_make(attr->vnc_subtlvs)); #endif @@ -698,7 +698,7 @@ bool attrhash_cmp(const void *p1, const void *p2) && attr1->rmap_table_id == attr2->rmap_table_id && (attr1->encap_tunneltype == attr2->encap_tunneltype) && encap_same(attr1->encap_subtlvs, attr2->encap_subtlvs) -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC && encap_same(attr1->vnc_subtlvs, attr2->vnc_subtlvs) #endif && IPV6_ADDR_SAME(&attr1->mp_nexthop_global, @@ -780,7 +780,7 @@ static void *bgp_attr_hash_alloc(void *p) if (val->encap_subtlvs) { val->encap_subtlvs = NULL; } -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC if (val->vnc_subtlvs) { val->vnc_subtlvs = NULL; } @@ -856,7 +856,7 @@ struct attr *bgp_attr_intern(struct attr *attr) else attr->srv6_vpn->refcnt++; } -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC if (attr->vnc_subtlvs) { if (!attr->vnc_subtlvs->refcnt) attr->vnc_subtlvs = encap_intern(attr->vnc_subtlvs, @@ -1041,7 +1041,7 @@ void bgp_attr_unintern_sub(struct attr *attr) if (attr->encap_subtlvs) encap_unintern(&attr->encap_subtlvs, ENCAP_SUBTLV_TYPE); -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC if (attr->vnc_subtlvs) encap_unintern(&attr->vnc_subtlvs, VNC_SUBTLV_TYPE); #endif @@ -1125,7 +1125,7 @@ void bgp_attr_flush(struct attr *attr) encap_free(attr->encap_subtlvs); attr->encap_subtlvs = NULL; } -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC if (attr->vnc_subtlvs && !attr->vnc_subtlvs->refcnt) { encap_free(attr->vnc_subtlvs); attr->vnc_subtlvs = NULL; @@ -2265,7 +2265,7 @@ static int bgp_attr_encap(uint8_t type, struct peer *peer, /* IN */ subtype = stream_getc(BGP_INPUT(peer)); sublength = stream_getc(BGP_INPUT(peer)); length -= 2; -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC } else { subtype = stream_getw(BGP_INPUT(peer)); sublength = stream_getw(BGP_INPUT(peer)); @@ -2304,7 +2304,7 @@ static int bgp_attr_encap(uint8_t type, struct peer *peer, /* IN */ } else { attr->encap_subtlvs = tlv; } -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC } else { struct bgp_attr_encap_subtlv *stlv_last; for (stlv_last = attr->vnc_subtlvs; @@ -3019,7 +3019,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, case BGP_ATTR_EXT_COMMUNITIES: ret = bgp_attr_ext_communities(&attr_args); break; -#if ENABLE_BGP_VNC_ATTR +#ifdef ENABLE_BGP_VNC_ATTR case BGP_ATTR_VNC: #endif case BGP_ATTR_ENCAP: @@ -3171,7 +3171,7 @@ done: if (attr->encap_subtlvs) attr->encap_subtlvs = encap_intern(attr->encap_subtlvs, ENCAP_SUBTLV_TYPE); -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC if (attr->vnc_subtlvs) attr->vnc_subtlvs = encap_intern(attr->vnc_subtlvs, VNC_SUBTLV_TYPE); @@ -3190,7 +3190,7 @@ done: assert(attr->transit->refcnt > 0); if (attr->encap_subtlvs) assert(attr->encap_subtlvs->refcnt > 0); -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC if (attr->vnc_subtlvs) assert(attr->vnc_subtlvs->refcnt > 0); #endif @@ -3440,7 +3440,7 @@ static void bgp_packet_mpattr_tea(struct bgp *bgp, struct peer *peer, attrhdrlen = 1 + 1; /* subTLV T + L */ break; -#if ENABLE_BGP_VNC_ATTR +#ifdef ENABLE_BGP_VNC_ATTR case BGP_ATTR_VNC: attrname = "VNC"; subtlvs = attr->vnc_subtlvs; @@ -3491,7 +3491,7 @@ static void bgp_packet_mpattr_tea(struct bgp *bgp, struct peer *peer, if (attrtype == BGP_ATTR_ENCAP) { stream_putc(s, st->type); stream_putc(s, st->length); -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC } else { stream_putw(s, st->type); stream_putw(s, st->length); @@ -3976,7 +3976,7 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer, /* Tunnel Encap attribute */ bgp_packet_mpattr_tea(bgp, peer, s, attr, BGP_ATTR_ENCAP); -#if ENABLE_BGP_VNC_ATTR +#ifdef ENABLE_BGP_VNC_ATTR /* VNC attribute */ bgp_packet_mpattr_tea(bgp, peer, s, attr, BGP_ATTR_VNC); #endif diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index a44effaac5..86e1c8dacc 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1128,6 +1128,10 @@ int bgp_stop(struct peer *peer) peer->nsf_af_count = 0; + /* deregister peer */ + if (peer->last_reset != PEER_DOWN_BFD_DOWN) + bgp_bfd_deregister_peer(peer); + if (peer_dynamic_neighbor(peer) && !(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) { if (bgp_debug_neighbor_events(peer)) @@ -1931,6 +1935,7 @@ static int bgp_establish(struct peer *peer) hash_release(peer->bgp->peerhash, peer); hash_get(peer->bgp->peerhash, peer, hash_alloc_intern); + bgp_bfd_deregister_peer(peer); bgp_bfd_register_peer(peer); return ret; } diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 8cc4096076..1a75888d68 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -2102,8 +2102,8 @@ static int non_peergroup_deactivate_af(struct peer *peer, afi_t afi, if (peer_af_delete(peer, afi, safi) != 0) { flog_err(EC_BGP_PEER_DELETE, - "couldn't delete af structure for peer %s", - peer->host); + "couldn't delete af structure for peer %s(%s, %s)", + peer->host, afi2str(afi), safi2str(safi)); return 1; } @@ -2152,9 +2152,10 @@ int peer_deactivate(struct peer *peer, afi_t afi, safi_t safi) group = peer->group; if (peer_af_delete(peer, afi, safi) != 0) { - flog_err(EC_BGP_PEER_DELETE, - "couldn't delete af structure for peer %s", - peer->host); + flog_err( + EC_BGP_PEER_DELETE, + "couldn't delete af structure for peer %s(%s, %s)", + peer->host, afi2str(afi), safi2str(safi)); } for (ALL_LIST_ELEMENTS(group->peer, node, nnode, tmp_peer)) { diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index e307e77ed8..1ada056a92 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -555,7 +555,7 @@ struct bgp { struct bgp_addpath_bgp_data tx_addpath; -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC struct rfapi_cfg *rfapi_cfg; struct rfapi *rfapi; #endif @@ -1480,7 +1480,7 @@ struct bgp_nlri { #define BGP_ATTR_ENCAP 23 #define BGP_ATTR_LARGE_COMMUNITIES 32 #define BGP_ATTR_PREFIX_SID 40 -#if ENABLE_BGP_VNC_ATTR +#ifdef ENABLE_BGP_VNC_ATTR #define BGP_ATTR_VNC 255 #endif diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index cad33404fa..acfab53d2b 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -47,7 +47,7 @@ #include "bgpd/rfapi/vnc_import_bgp.h" #include "bgpd/rfapi/vnc_debug.h" -#if ENABLE_BGP_VNC +#ifdef ENABLE_BGP_VNC #undef BGP_VNC_DEBUG_MATCH_GROUP @@ -168,7 +168,7 @@ struct rfapi_nve_group_cfg *bgp_rfapi_cfg_match_group(struct rfapi_cfg *hc, agg_unlock_node(rn_un); } -#if BGP_VNC_DEBUG_MATCH_GROUP +#ifdef BGP_VNC_DEBUG_MATCH_GROUP { char buf[PREFIX_STRLEN]; diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 4701d2e1fa..d87292f652 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -2150,7 +2150,7 @@ int rfapi_close(void *handle) vnc_zlog_debug_verbose("%s: rfd=%p", __func__, rfd); -#if RFAPI_WHO_IS_CALLING_ME +#ifdef RFAPI_WHO_IS_CALLING_ME #ifdef HAVE_GLIBC_BACKTRACE #define RFAPI_DEBUG_BACKTRACE_NENTRIES 5 { diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 8fbc4d9d15..2f274015fc 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -200,7 +200,7 @@ void rfapiCheckRouteCount(void) } } -#if DEBUG_ROUTE_COUNTERS +#ifdef DEBUG_ROUTE_COUNTERS #define VNC_ITRCCK do {rfapiCheckRouteCount();} while (0) #else #define VNC_ITRCCK @@ -458,7 +458,7 @@ int rfapiGetUnAddrOfVpnBi(struct bgp_path_info *bpi, struct prefix *p) default: if (p) p->family = 0; -#if DEBUG_ENCAP_MONITOR +#ifdef DEBUG_ENCAP_MONITOR vnc_zlog_debug_verbose( "%s: bpi->extra->vnc.import.un_family is 0, no UN addr", __func__); @@ -609,7 +609,7 @@ rfapiMonitorMoveShorter(struct agg_node *original_vpn_node, int lockoffset) RFAPI_CHECK_REFCOUNT(original_vpn_node, SAFI_MPLS_VPN, lockoffset); -#if DEBUG_MONITOR_MOVE_SHORTER +#ifdef DEBUG_MONITOR_MOVE_SHORTER { char buf[PREFIX_STRLEN]; @@ -628,7 +628,7 @@ rfapiMonitorMoveShorter(struct agg_node *original_vpn_node, int lockoffset) struct prefix pfx; if (!rfapiGetUnAddrOfVpnBi(bpi, &pfx)) { -#if DEBUG_MONITOR_MOVE_SHORTER +#ifdef DEBUG_MONITOR_MOVE_SHORTER vnc_zlog_debug_verbose( "%s: have valid UN at original node, no change", __func__); @@ -744,7 +744,7 @@ rfapiMonitorMoveShorter(struct agg_node *original_vpn_node, int lockoffset) agg_unlock_node(original_vpn_node); } -#if DEBUG_MONITOR_MOVE_SHORTER +#ifdef DEBUG_MONITOR_MOVE_SHORTER { char buf[PREFIX_STRLEN]; @@ -953,7 +953,7 @@ void rfapiImportTableRefDelByIt(struct bgp *bgp, } } -#if RFAPI_REQUIRE_ENCAP_BEEC +#ifdef RFAPI_REQUIRE_ENCAP_BEEC /* * Look for magic BGP Encapsulation Extended Community value * Format in RFC 5512 Sect. 4.5 @@ -1267,7 +1267,7 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix, struct rfapi_next_hop_entry *new; int have_vnc_tunnel_un = 0; -#if DEBUG_ENCAP_MONITOR +#ifdef DEBUG_ENCAP_MONITOR vnc_zlog_debug_verbose("%s: entry, bpi %p, rn %p", __func__, bpi, rn); #endif @@ -1401,7 +1401,7 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix, new->un_options = rfapi_encap_tlv_to_un_option(bpi->attr); -#if DEBUG_ENCAP_MONITOR +#ifdef DEBUG_ENCAP_MONITOR vnc_zlog_debug_verbose("%s: line %d: have_vnc_tunnel_un=%d", __func__, __LINE__, have_vnc_tunnel_un); #endif @@ -1448,7 +1448,7 @@ int rfapiHasNonRemovedRoutes(struct agg_node *rn) return 0; } -#if DEBUG_IT_NODES +#ifdef DEBUG_IT_NODES /* * DEBUG FUNCTION */ @@ -1517,7 +1517,7 @@ static int rfapiNhlAddNodeRoutes( struct prefix *newpfx; if (removed && !CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) { -#if DEBUG_RETURNED_NHL +#ifdef DEBUG_RETURNED_NHL vnc_zlog_debug_verbose( "%s: want holddown, this route not holddown, skip", __func__); @@ -1549,7 +1549,7 @@ static int rfapiNhlAddNodeRoutes( rfapiNexthop2Prefix(bpi->attr, &pfx_vn); } if (!skiplist_search(seen_nexthops, &pfx_vn, NULL)) { -#if DEBUG_RETURNED_NHL +#ifdef DEBUG_RETURNED_NHL char buf[PREFIX_STRLEN]; prefix2str(&pfx_vn, buf, sizeof(buf)); @@ -1561,7 +1561,7 @@ static int rfapiNhlAddNodeRoutes( } if (rfapiGetUnAddrOfVpnBi(bpi, &pfx_un)) { -#if DEBUG_ENCAP_MONITOR +#ifdef DEBUG_ENCAP_MONITOR vnc_zlog_debug_verbose( "%s: failed to get UN address of this VPN bpi", __func__); @@ -1715,7 +1715,7 @@ struct rfapi_next_hop_entry *rfapiRouteNode2NextHopList( int count = 0; struct agg_node *rib_rn; -#if DEBUG_RETURNED_NHL +#ifdef DEBUG_RETURNED_NHL { char buf[PREFIX_STRLEN]; @@ -1746,7 +1746,7 @@ struct rfapi_next_hop_entry *rfapiRouteNode2NextHopList( pfx_target_original); vnc_zlog_debug_verbose("%s: %d nexthops, answer=%p", __func__, count, answer); -#if DEBUG_RETURNED_NHL +#ifdef DEBUG_RETURNED_NHL rfapiPrintNhl(NULL, answer); #endif if (rib_rn) @@ -1806,7 +1806,7 @@ struct rfapi_next_hop_entry *rfapiRouteNode2NextHopList( vnc_zlog_debug_verbose("%s: %d nexthops, answer=%p", __func__, count, answer); -#if DEBUG_RETURNED_NHL +#ifdef DEBUG_RETURNED_NHL rfapiPrintNhl(NULL, answer); #endif return answer; @@ -1868,7 +1868,7 @@ struct rfapi_next_hop_entry *rfapiEthRouteNode2NextHopList( count = rfapiNhlAddNodeRoutes(rn, rprefix, lifetime, 0, &answer, &last, NULL, rib_rn, pfx_target_original); -#if DEBUG_ENCAP_MONITOR +#ifdef DEBUG_ENCAP_MONITOR vnc_zlog_debug_verbose("%s: node %p: %d non-holddown routes", __func__, rn, count); #endif @@ -1884,7 +1884,7 @@ struct rfapi_next_hop_entry *rfapiEthRouteNode2NextHopList( if (rib_rn) agg_unlock_node(rib_rn); -#if DEBUG_RETURNED_NHL +#ifdef DEBUG_RETURNED_NHL rfapiPrintNhl(NULL, answer); #endif @@ -2164,7 +2164,7 @@ static struct bgp_path_info *rfapiItBiIndexSearch( if (!sl) return NULL; -#if DEBUG_BI_SEARCH +#ifdef DEBUG_BI_SEARCH { char buf[RD_ADDRSTRLEN]; char buf_aux_pfx[PREFIX_STRLEN]; @@ -2185,13 +2185,13 @@ static struct bgp_path_info *rfapiItBiIndexSearch( /* threshold is a WAG */ if (sl->count < 3) { -#if DEBUG_BI_SEARCH +#ifdef DEBUG_BI_SEARCH vnc_zlog_debug_verbose("%s: short list algorithm", __func__); #endif /* if short list, linear search might be faster */ for (bpi_result = rn->info; bpi_result; bpi_result = bpi_result->next) { -#if DEBUG_BI_SEARCH +#ifdef DEBUG_BI_SEARCH { char buf[RD_ADDRSTRLEN]; @@ -2208,7 +2208,7 @@ static struct bgp_path_info *rfapiItBiIndexSearch( ->vnc.import.rd, (struct prefix *)prd)) { -#if DEBUG_BI_SEARCH +#ifdef DEBUG_BI_SEARCH vnc_zlog_debug_verbose( "%s: peer and RD same, doing aux_prefix check", __func__); @@ -2219,7 +2219,7 @@ static struct bgp_path_info *rfapiItBiIndexSearch( &bpi_result->extra->vnc.import .aux_prefix)) { -#if DEBUG_BI_SEARCH +#ifdef DEBUG_BI_SEARCH vnc_zlog_debug_verbose("%s: match", __func__); #endif @@ -2244,13 +2244,13 @@ static struct bgp_path_info *rfapiItBiIndexSearch( rc = skiplist_search(sl, (void *)&bpi_fake, (void *)&bpi_result); if (rc) { -#if DEBUG_BI_SEARCH +#ifdef DEBUG_BI_SEARCH vnc_zlog_debug_verbose("%s: no match", __func__); #endif return NULL; } -#if DEBUG_BI_SEARCH +#ifdef DEBUG_BI_SEARCH vnc_zlog_debug_verbose("%s: matched bpi=%p", __func__, bpi_result); #endif @@ -2958,7 +2958,7 @@ static void rfapiBgpInfoFilteredImportEncap( __func__); return; } -#if RFAPI_REQUIRE_ENCAP_BEEC +#ifdef RFAPI_REQUIRE_ENCAP_BEEC if (!rfapiEcommunitiesMatchBeec(attr->ecommunity)) { vnc_zlog_debug_verbose( "%s: it=%p: no match for BGP Encapsulation ecommunity", @@ -3007,7 +3007,7 @@ static void rfapiBgpInfoFilteredImportEncap( */ rn = agg_node_lookup(rt, p); -#if DEBUG_ENCAP_MONITOR +#ifdef DEBUG_ENCAP_MONITOR vnc_zlog_debug_verbose("%s: initial encap lookup(it=%p) rn=%p", __func__, import_table, rn); #endif @@ -3241,7 +3241,7 @@ static void rfapiBgpInfoFilteredImportEncap( /* * iterate over the set of monitors at this ENCAP node. */ -#if DEBUG_ENCAP_MONITOR +#ifdef DEBUG_ENCAP_MONITOR vnc_zlog_debug_verbose("%s: examining monitors at rn=%p", __func__, rn); #endif @@ -3997,7 +3997,7 @@ void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p, rc == 0; rc = skiplist_next(h->import_mac, NULL, (void **)&it, &cursor)) { -#if DEBUG_L2_EXTRA +#ifdef DEBUG_L2_EXTRA vnc_zlog_debug_verbose( "%s: calling rfapiBgpInfoFilteredImportVPN(it=%p, afi=AFI_L2VPN)", __func__, it); @@ -4408,7 +4408,7 @@ static void rfapiDeleteRemotePrefixesIt( { afi_t afi; -#if DEBUG_L2_EXTRA +#ifdef DEBUG_L2_EXTRA { char buf_pfx[PREFIX_STRLEN]; @@ -4487,7 +4487,7 @@ static void rfapiDeleteRemotePrefixesIt( if (vn) { if (!qpt_valid || !prefix_match(vn, &qpt)) { -#if DEBUG_L2_EXTRA +#ifdef DEBUG_L2_EXTRA vnc_zlog_debug_verbose( "%s: continue at vn && !qpt_valid || !prefix_match(vn, &qpt)", __func__); @@ -4502,7 +4502,7 @@ static void rfapiDeleteRemotePrefixesIt( if (un) { if (!qct_valid || !prefix_match(un, &qct)) { -#if DEBUG_L2_EXTRA +#ifdef DEBUG_L2_EXTRA vnc_zlog_debug_verbose( "%s: continue at un && !qct_valid || !prefix_match(un, &qct)", __func__); diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c index b7ec35c661..3d4bdef75a 100644 --- a/bgpd/rfapi/rfapi_rib.c +++ b/bgpd/rfapi/rfapi_rib.c @@ -479,7 +479,7 @@ void rfapiRibClear(struct rfapi_descriptor *rfd) bgp = rfd->bgp; else bgp = bgp_get_default(); -#if DEBUG_L2_EXTRA +#ifdef DEBUG_L2_EXTRA vnc_zlog_debug_verbose("%s: rfd=%p", __func__, rfd); #endif @@ -1487,7 +1487,7 @@ static void rib_do_callback_onepass(struct rfapi_descriptor *rfd, afi_t afi) struct rfapi_next_hop_entry *tail = NULL; struct agg_node *rn; -#if DEBUG_L2_EXTRA +#ifdef DEBUG_L2_EXTRA vnc_zlog_debug_verbose("%s: rfd=%p, afi=%d", __func__, rfd, afi); #endif @@ -1812,7 +1812,7 @@ int rfapiRibFTDFilterRecentPrefix( if (it_rn->p.family == AF_ETHERNET) return 0; -#if DEBUG_FTD_FILTER_RECENT +#ifdef DEBUG_FTD_FILTER_RECENT { char buf_pfx[PREFIX_STRLEN]; @@ -1825,7 +1825,7 @@ int rfapiRibFTDFilterRecentPrefix( * prefix covers target address, so allow prefix */ if (prefix_match(&it_rn->p, pfx_target_original)) { -#if DEBUG_FTD_FILTER_RECENT +#ifdef DEBUG_FTD_FILTER_RECENT vnc_zlog_debug_verbose("%s: prefix covers target, allowed", __func__); #endif @@ -1840,7 +1840,7 @@ int rfapiRibFTDFilterRecentPrefix( if (trn->lock > 1) agg_unlock_node(trn); -#if DEBUG_FTD_FILTER_RECENT +#ifdef DEBUG_FTD_FILTER_RECENT vnc_zlog_debug_verbose("%s: last sent time %lu, last allowed time %lu", __func__, prefix_time, rfd->ftd_last_allowed_time); @@ -2311,7 +2311,7 @@ static int print_rib_sl(int (*fp)(void *, const char *, ...), struct vty *vty, *p = 0; rfapiFormatSeconds(ri->lifetime, str_lifetime, BUFSIZ); -#if RFAPI_REGISTRATIONS_REPORT_AGE +#ifdef RFAPI_REGISTRATIONS_REPORT_AGE rfapiFormatAge(ri->last_sent_time, str_age, BUFSIZ); #else { @@ -2451,12 +2451,12 @@ void rfapiRibShowResponses(void *stream, struct prefix *pfx_match, " %-20s %-15s %-15s %4s %-8s %-8s\n", "Prefix", "Registered VN", "Registered UN", "Cost", "Lifetime", -#if RFAPI_REGISTRATIONS_REPORT_AGE +#ifdef RFAPI_REGISTRATIONS_REPORT_AGE "Age" #else "Remaining" #endif - ); + ); } if (!printednve) { char str_vn[BUFSIZ]; diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 77fcf909c8..58fdc7c130 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -1123,7 +1123,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream, (struct thread *)bpi->extra->vnc.import.timer; remaining = thread_timer_remain_second(t); -#if RFAPI_REGISTRATIONS_REPORT_AGE +#ifdef RFAPI_REGISTRATIONS_REPORT_AGE /* * Calculate when the timer started. Doing so here saves * us a timestamp field in "struct bgp_path_info". @@ -1311,7 +1311,7 @@ static int rfapiShowRemoteRegistrationsIt(struct bgp *bgp, void *stream, } fp(out, "%s", HVTYNL); if (show_expiring) { -#if RFAPI_REGISTRATIONS_REPORT_AGE +#ifdef RFAPI_REGISTRATIONS_REPORT_AGE agetype = "Age"; #else agetype = "Remaining"; diff --git a/configure.ac b/configure.ac index 901cac2318..fa332b7dab 100755 --- a/configure.ac +++ b/configure.ac @@ -1026,7 +1026,7 @@ AC_CHECK_HEADERS([net/if_var.h], [], [], [FRR_INCLUDES]) m4_define([FRR_INCLUDES], FRR_INCLUDES -[#if HAVE_NET_IF_VAR_H +[#ifdef HAVE_NET_IF_VAR_H # include <net/if_var.h> #endif ])dnl @@ -1061,22 +1061,22 @@ FRR_INCLUDES [ #include <sys/un.h> #include <netinet/in_systm.h> -#if HAVE_NETINET_IN_VAR_H +#ifdef HAVE_NETINET_IN_VAR_H # include <netinet/in_var.h> #endif -#if HAVE_NET_IF_DL_H +#ifdef HAVE_NET_IF_DL_H # include <net/if_dl.h> #endif -#if HAVE_NET_NETOPT_H +#ifdef HAVE_NET_NETOPT_H # include <net/netopt.h> #endif #include <net/route.h> -#if HAVE_INET_ND_H +#ifdef HAVE_INET_ND_H # include <inet/nd.h> #endif #include <arpa/inet.h> /* Required for IDRP */ -#if HAVE_NETINET_IP_ICMP_H +#ifdef HAVE_NETINET_IP_ICMP_H # include <netinet/ip_icmp.h> #endif ])dnl @@ -1401,7 +1401,7 @@ AC_CHECK_HEADERS([linux/mroute.h], [], [],[ m4_define([FRR_INCLUDES], FRR_INCLUDES -[#if HAVE_LINUX_MROUTE_H +[#ifdef HAVE_LINUX_MROUTE_H # include <linux/mroute.h> #endif ])dnl @@ -1415,7 +1415,7 @@ AC_CHECK_HEADERS([netinet/ip_mroute.h], [], [],[ m4_define([FRR_INCLUDES], FRR_INCLUDES -[#if HAVE_NETINET_IP_MROUTE_H +[#ifdef HAVE_NETINET_IP_MROUTE_H # include <netinet/ip_mroute.h> #endif ])dnl @@ -1528,17 +1528,17 @@ AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h \ m4_define([FRR_INCLUDES],dnl FRR_INCLUDES -[#if HAVE_NETINET6_IN6_H +[#ifdef HAVE_NETINET6_IN6_H #include <netinet6/in6.h> #endif -#if HAVE_NETINET_IN6_VAR_H +#ifdef HAVE_NETINET_IN6_VAR_H #include <netinet/in6_var.h> #endif #include <netinet/icmp6.h> -#if HAVE_NETINET6_IN6_VAR_H +#ifdef HAVE_NETINET6_IN6_VAR_H # include <netinet6/in6_var.h> #endif -#if HAVE_NETINET6_ND6_H +#ifdef HAVE_NETINET6_ND6_H # include <netinet6/nd6.h> #endif ])dnl diff --git a/doc/manpages/conf.py b/doc/manpages/conf.py index 9121d38fe0..8b9bb021a3 100644 --- a/doc/manpages/conf.py +++ b/doc/manpages/conf.py @@ -192,7 +192,7 @@ html_theme = 'default' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = [] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied diff --git a/lib/getopt.h b/lib/getopt.h index 138870d199..63e12e947e 100644 --- a/lib/getopt.h +++ b/lib/getopt.h @@ -111,7 +111,7 @@ struct option { #if defined(__STDC__) && __STDC__ -#if REALLY_NEED_PLAIN_GETOPT +#ifdef REALLY_NEED_PLAIN_GETOPT /* * getopt is defined in POSIX.2. Assume that if the system defines diff --git a/lib/seqlock.c b/lib/seqlock.c index 588a1175bc..77673146ea 100644 --- a/lib/seqlock.c +++ b/lib/seqlock.c @@ -165,7 +165,7 @@ bool seqlock_timedwait(struct seqlock *sqlo, seqlock_val_t val, /* * ABS_REALTIME - used on NetBSD, Solaris and OSX */ -#if TIME_ABS_REALTIME +#ifdef TIME_ABS_REALTIME #define time_arg1 &abs_rt #define time_arg2 NULL #define time_prep @@ -187,7 +187,7 @@ bool seqlock_timedwait(struct seqlock *sqlo, seqlock_val_t val, /* * RELATIVE - used on OpenBSD (might get a patch to get absolute monotime) */ -#elif TIME_RELATIVE +#elif defined(TIME_RELATIVE) struct timespec reltime; #define time_arg1 abs_monotime_limit diff --git a/lib/skiplist.c b/lib/skiplist.c index 67cc1ab378..d955c6eb9e 100644 --- a/lib/skiplist.c +++ b/lib/skiplist.c @@ -211,12 +211,12 @@ int skiplist_insert(register struct skiplist *l, register void *key, q = newNodeOfLevel(k); q->key = key; q->value = value; -#if SKIPLIST_0TIMER_DEBUG +#ifdef SKIPLIST_0TIMER_DEBUG q->flags = SKIPLIST_NODE_FLAG_INSERTED; /* debug */ #endif ++(l->stats->forward[k]); -#if SKIPLIST_DEBUG +#ifdef SKIPLIST_DEBUG zlog_debug("%s: incremented stats @%p:%d, now %ld", __func__, l, k, l->stats->forward[k] - (struct skiplistnode *)NULL); #endif @@ -281,7 +281,7 @@ int skiplist_delete(register struct skiplist *l, register void *key, /* * found node to delete */ -#if SKIPLIST_0TIMER_DEBUG +#ifdef SKIPLIST_0TIMER_DEBUG q->flags &= ~SKIPLIST_NODE_FLAG_INSERTED; #endif /* @@ -300,7 +300,7 @@ int skiplist_delete(register struct skiplist *l, register void *key, p->forward[k] = q->forward[k]; } --(l->stats->forward[k - 1]); -#if SKIPLIST_DEBUG +#ifdef SKIPLIST_DEBUG zlog_debug("%s: decremented stats @%p:%d, now %ld", __func__, l, k - 1, l->stats->forward[k - 1] @@ -549,7 +549,7 @@ int skiplist_delete_first(register struct skiplist *l) } } -#if SKIPLIST_0TIMER_DEBUG +#ifdef SKIPLIST_0TIMER_DEBUG q->flags &= ~SKIPLIST_NODE_FLAG_INSERTED; #endif /* @@ -561,7 +561,7 @@ int skiplist_delete_first(register struct skiplist *l) } --(l->stats->forward[nodelevel]); -#if SKIPLIST_DEBUG +#ifdef SKIPLIST_DEBUG zlog_debug("%s: decremented stats @%p:%d, now %ld", __func__, l, nodelevel, l->stats->forward[nodelevel] - (struct skiplistnode *)NULL); diff --git a/lib/stream.h b/lib/stream.h index c0d25e0579..36c65afa3c 100644 --- a/lib/stream.h +++ b/lib/stream.h @@ -110,7 +110,7 @@ struct stream { size_t getp; /* next get position */ size_t endp; /* last valid data position */ size_t size; /* size of data segment */ - unsigned char data[0]; /* data pointer */ + unsigned char data[]; /* data pointer */ }; /* First in first out queue structure. */ diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index fd2ab07261..75f556e39f 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -93,7 +93,7 @@ static int str2metric(const char *str, int *metric) return 0; *metric = strtol(str, NULL, 10); - if (*metric < 0 && *metric > 16777214) { + if (*metric < 0 || *metric > 16777214) { /* vty_out (vty, "OSPF metric value is invalid\n"); */ return 0; } diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c index bff8017b43..569b04d278 100644 --- a/pimd/pim_vxlan.c +++ b/pimd/pim_vxlan.c @@ -85,8 +85,16 @@ static void pim_vxlan_do_reg_work(void) if (PIM_DEBUG_VXLAN) zlog_debug("vxlan SG %s periodic NULL register", vxlan_sg->sg_str); - pim_null_register_send(vxlan_sg->up); - ++work_cnt; + + /* + * If we are on the work queue *and* the rpf + * has been lost on the vxlan_sg->up let's + * make sure that we don't send it. + */ + if (vxlan_sg->up->rpf.source_nexthop.interface) { + pim_null_register_send(vxlan_sg->up); + ++work_cnt; + } } if (work_cnt > vxlan_info.max_work_cnt) { @@ -217,6 +225,7 @@ static void pim_vxlan_orig_mr_up_del(struct pim_vxlan_sg *vxlan_sg) vxlan_sg->sg_str); vxlan_sg->up = NULL; + if (up->flags & PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_ORIG) { /* clear out all the vxlan properties */ up->flags &= ~(PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_ORIG | @@ -754,14 +763,8 @@ struct pim_vxlan_sg *pim_vxlan_sg_add(struct pim_instance *pim, return vxlan_sg; } -void pim_vxlan_sg_del(struct pim_instance *pim, struct prefix_sg *sg) +static void pim_vxlan_sg_del_item(struct pim_vxlan_sg *vxlan_sg) { - struct pim_vxlan_sg *vxlan_sg; - - vxlan_sg = pim_vxlan_sg_find(pim, sg); - if (!vxlan_sg) - return; - vxlan_sg->flags |= PIM_VXLAN_SGF_DEL_IN_PROG; pim_vxlan_del_work(vxlan_sg); @@ -771,14 +774,24 @@ void pim_vxlan_sg_del(struct pim_instance *pim, struct prefix_sg *sg) else pim_vxlan_term_mr_del(vxlan_sg); - hash_release(vxlan_sg->pim->vxlan.sg_hash, vxlan_sg); - if (PIM_DEBUG_VXLAN) zlog_debug("vxlan SG %s free", vxlan_sg->sg_str); XFREE(MTYPE_PIM_VXLAN_SG, vxlan_sg); } +void pim_vxlan_sg_del(struct pim_instance *pim, struct prefix_sg *sg) +{ + struct pim_vxlan_sg *vxlan_sg; + + vxlan_sg = pim_vxlan_sg_find(pim, sg); + if (!vxlan_sg) + return; + + pim_vxlan_sg_del_item(vxlan_sg); + hash_release(pim->vxlan.sg_hash, vxlan_sg); +} + /******************************* MLAG handling *******************************/ bool pim_vxlan_do_mlag_reg(void) { @@ -1153,8 +1166,14 @@ void pim_vxlan_init(struct pim_instance *pim) void pim_vxlan_exit(struct pim_instance *pim) { if (pim->vxlan.sg_hash) { - hash_clean(pim->vxlan.sg_hash, NULL); + hash_clean(pim->vxlan.sg_hash, + (void (*)(void *))pim_vxlan_sg_del_item); hash_free(pim->vxlan.sg_hash); pim->vxlan.sg_hash = NULL; } } + +void pim_vxlan_terminate(void) +{ + pim_vxlan_work_timer_setup(false); +} diff --git a/pimd/pim_vxlan.h b/pimd/pim_vxlan.h index 198d1c3281..18f1b74175 100644 --- a/pimd/pim_vxlan.h +++ b/pimd/pim_vxlan.h @@ -148,4 +148,6 @@ extern bool pim_vxlan_do_mlag_reg(void); extern void pim_vxlan_inherit_mlag_flags(struct pim_instance *pim, struct pim_upstream *up, bool inherit); +/* Shutdown of PIM stop the thread */ +extern void pim_vxlan_terminate(void); #endif /* PIM_VXLAN_H */ diff --git a/pimd/pimd.c b/pimd/pimd.c index 889d63c518..5ccbac32f2 100644 --- a/pimd/pimd.c +++ b/pimd/pimd.c @@ -39,6 +39,7 @@ #include "pim_static.h" #include "pim_rp.h" #include "pim_ssm.h" +#include "pim_vxlan.h" #include "pim_zlookup.h" #include "pim_zebra.h" @@ -135,6 +136,7 @@ void pim_terminate(void) prefix_list_delete_hook(NULL); prefix_list_reset(); + pim_vxlan_terminate(); pim_vrf_terminate(); zclient = pim_zebra_zclient_get(); diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 7fbe64e8e3..bb33abdb2c 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -1455,7 +1455,7 @@ static int ripng_update(struct thread *t) if (ri->passive) continue; -#if RIPNG_ADVANCED +#ifdef RIPNG_ADVANCED if (ri->ri_send == RIPNG_SEND_OFF) { if (IS_RIPNG_DEBUG_EVENT) zlog_debug( diff --git a/scripts/coccinelle/__func__.cocci b/tools/coccinelle/__func__.cocci index fb68494d43..fb68494d43 100644 --- a/scripts/coccinelle/__func__.cocci +++ b/tools/coccinelle/__func__.cocci diff --git a/scripts/coccinelle/bool_assignment.cocci b/tools/coccinelle/bool_assignment.cocci index e6146ea310..e6146ea310 100644 --- a/scripts/coccinelle/bool_assignment.cocci +++ b/tools/coccinelle/bool_assignment.cocci diff --git a/scripts/coccinelle/bool_expression.cocci b/tools/coccinelle/bool_expression.cocci index c0c329cb59..c0c329cb59 100644 --- a/scripts/coccinelle/bool_expression.cocci +++ b/tools/coccinelle/bool_expression.cocci diff --git a/scripts/coccinelle/bool_function.cocci b/tools/coccinelle/bool_function.cocci index 0328ecfbbe..0328ecfbbe 100644 --- a/scripts/coccinelle/bool_function.cocci +++ b/tools/coccinelle/bool_function.cocci diff --git a/scripts/coccinelle/bool_function_type.cocci b/tools/coccinelle/bool_function_type.cocci index 71bf4f53b8..71bf4f53b8 100644 --- a/scripts/coccinelle/bool_function_type.cocci +++ b/tools/coccinelle/bool_function_type.cocci diff --git a/scripts/coccinelle/replace_bgp_flag_functions.cocci b/tools/coccinelle/replace_bgp_flag_functions.cocci index 3064fc0267..3064fc0267 100644 --- a/scripts/coccinelle/replace_bgp_flag_functions.cocci +++ b/tools/coccinelle/replace_bgp_flag_functions.cocci diff --git a/scripts/coccinelle/return_without_parenthesis.cocci b/tools/coccinelle/return_without_parenthesis.cocci index 7097e87ddc..7097e87ddc 100644 --- a/scripts/coccinelle/return_without_parenthesis.cocci +++ b/tools/coccinelle/return_without_parenthesis.cocci diff --git a/scripts/coccinelle/s_addr_0_to_INADDR_ANY.cocci b/tools/coccinelle/s_addr_0_to_INADDR_ANY.cocci index bd7f4af4f2..bd7f4af4f2 100644 --- a/scripts/coccinelle/s_addr_0_to_INADDR_ANY.cocci +++ b/tools/coccinelle/s_addr_0_to_INADDR_ANY.cocci diff --git a/scripts/coccinelle/shorthand_operator.cocci b/tools/coccinelle/shorthand_operator.cocci index f7019d4040..f7019d4040 100644 --- a/scripts/coccinelle/shorthand_operator.cocci +++ b/tools/coccinelle/shorthand_operator.cocci diff --git a/scripts/coccinelle/test_after_assert.cocci b/tools/coccinelle/test_after_assert.cocci index 30596a89c2..30596a89c2 100644 --- a/scripts/coccinelle/test_after_assert.cocci +++ b/tools/coccinelle/test_after_assert.cocci diff --git a/scripts/coccinelle/void_no_return.cocci b/tools/coccinelle/void_no_return.cocci index 7da9e73933..7da9e73933 100644 --- a/scripts/coccinelle/void_no_return.cocci +++ b/tools/coccinelle/void_no_return.cocci diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 32051a62b7..d1148061b9 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -75,6 +75,10 @@ static void zebra_redistribute_default(struct zserv *client, vrf_id_t vrf_id) struct route_entry *newre; for (afi = AFI_IP; afi <= AFI_IP6; afi++) { + + if (!vrf_bitmap_check(client->redist_default[afi], vrf_id)) + continue; + /* Lookup table. */ table = zebra_vrf_table(afi, SAFI_UNICAST, vrf_id); if (!table) diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 4b7fd5060a..60ac471b5a 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -1118,18 +1118,31 @@ void rtadv_stop_ra(struct interface *ifp) } /* - * send router lifetime value of zero in RAs on all interfaces since we're + * Send router lifetime value of zero in RAs on all interfaces since we're * ceasing to advertise globally and want to let all of our neighbors know * RFC 4861 secion 6.2.5 + * + * Delete all ipv6 global prefixes added to the router advertisement prefix + * lists prior to ceasing. */ void rtadv_stop_ra_all(void) { struct vrf *vrf; struct interface *ifp; + struct listnode *node, *nnode; + struct zebra_if *zif; + struct rtadv_prefix *rprefix; RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) - FOR_ALL_INTERFACES (vrf, ifp) + FOR_ALL_INTERFACES (vrf, ifp) { + zif = ifp->info; + + for (ALL_LIST_ELEMENTS(zif->rtadv.AdvPrefixList, + node, nnode, rprefix)) + rtadv_prefix_reset(zif, rprefix); + rtadv_stop_ra(ifp); + } } void zebra_interface_radv_disable(ZAPI_HANDLER_ARGS) diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 5d0d0a48c3..459d2bc620 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -3331,7 +3331,7 @@ skip_one: return 0; } -#if DPLANE_TEST_PROVIDER +#ifdef DPLANE_TEST_PROVIDER /* * Test dataplane provider plugin @@ -3415,7 +3415,7 @@ static void dplane_provider_init(void) zlog_err("Unable to register kernel dplane provider: %d", ret); -#if DPLANE_TEST_PROVIDER +#ifdef DPLANE_TEST_PROVIDER /* Optional test provider ... */ ret = dplane_provider_register("Test", DPLANE_PRIO_PRE_KERNEL, diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index fcd90c23e8..f0d43756b5 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -687,9 +687,9 @@ static struct nh_grp *nhg_ctx_get_grp(struct nhg_ctx *ctx) return ctx->u.grp; } -static struct nhg_ctx *nhg_ctx_new() +static struct nhg_ctx *nhg_ctx_new(void) { - struct nhg_ctx *new = NULL; + struct nhg_ctx *new; new = XCALLOC(MTYPE_NHG_CTX, sizeof(struct nhg_ctx)); |
