diff options
| -rw-r--r-- | bgpd/bgpd.c | 15 | ||||
| -rw-r--r-- | nhrpd/nhrp_peer.c | 5 | ||||
| -rw-r--r-- | pimd/pim_iface.c | 15 |
3 files changed, 24 insertions, 11 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 342c3c6be6..c5d902521e 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -3538,7 +3538,8 @@ peer_init: bgp->vpn_policy[afi].tovpn_zebra_vrf_label_last_sent = MPLS_LABEL_NONE; - bgp->vpn_policy[afi].import_vrf = list_new(); + if (!bgp->vpn_policy[afi].import_vrf) + bgp->vpn_policy[afi].import_vrf = list_new(); bgp->vpn_policy[afi].import_vrf->del = bgp_vrf_string_name_delete; if (!hidden) { @@ -3556,7 +3557,7 @@ peer_init: bgp_mplsvpn_nh_label_bind_cache_init(&bgp->mplsvpn_nh_label_bind); - if (name) + if (name && !bgp->name) bgp->name = XSTRDUP(MTYPE_BGP_NAME, name); event_add_timer(bm->master, bgp_startup_timer_expire, bgp, @@ -4177,7 +4178,7 @@ int bgp_delete(struct bgp *bgp) peer_delete(peer); } - if (bgp->peer_self && !IS_BGP_INSTANCE_HIDDEN(bgp)) { + if (bgp->peer_self && (!IS_BGP_INSTANCE_HIDDEN(bgp) || bm->terminating)) { peer_delete(bgp->peer_self); bgp->peer_self = NULL; } @@ -4187,7 +4188,7 @@ int bgp_delete(struct bgp *bgp) /* TODO - Other memory may need to be freed - e.g., NHT */ #ifdef ENABLE_BGP_VNC - if (!IS_BGP_INSTANCE_HIDDEN(bgp)) + if (!IS_BGP_INSTANCE_HIDDEN(bgp) || bm->terminating) rfapi_delete(bgp); #endif @@ -4238,7 +4239,7 @@ int bgp_delete(struct bgp *bgp) bgp_zebra_instance_deregister(bgp); } - if (!IS_BGP_INSTANCE_HIDDEN(bgp)) { + if (!IS_BGP_INSTANCE_HIDDEN(bgp) || bm->terminating) { /* Remove visibility via the master list - * there may however still be routes to be processed * still referencing the struct bgp. @@ -4250,7 +4251,7 @@ int bgp_delete(struct bgp *bgp) vrf = bgp_vrf_lookup_by_instance_type(bgp); bgp_handle_socket(bgp, vrf, VRF_UNKNOWN, false); - if (vrf && !IS_BGP_INSTANCE_HIDDEN(bgp)) + if (vrf && (!IS_BGP_INSTANCE_HIDDEN(bgp) || bm->terminating)) bgp_vrf_unlink(bgp, vrf); /* Update EVPN VRF pointer */ @@ -4261,7 +4262,7 @@ int bgp_delete(struct bgp *bgp) bgp_set_evpn(bgp_get_default()); } - if (!IS_BGP_INSTANCE_HIDDEN(bgp)) { + if (!IS_BGP_INSTANCE_HIDDEN(bgp) || bm->terminating) { if (bgp->process_queue) work_queue_free_and_null(&bgp->process_queue); bgp_unlock(bgp); /* initial reference */ diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c index fa11980c18..97932795a3 100644 --- a/nhrpd/nhrp_peer.c +++ b/nhrpd/nhrp_peer.c @@ -1355,6 +1355,11 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb) } break; case NHRP_ROUTE_NBMA_NEXTHOP: + if (hdr->hop_count == 0) { + nhrp_packet_send_error(&pp, NHRP_ERROR_HOP_COUNT_EXCEEDED, 0); + info = "hop count exceeded"; + goto drop; + } nhrp_peer_forward(peer, &pp); break; case NHRP_ROUTE_BLACKHOLE: diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 6c97ba5237..f1138dfa3e 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -193,8 +193,17 @@ void pim_if_delete(struct interface *ifp) assert(pim_ifp); pim_ifp->pim->mcast_if_count--; - if (pim_ifp->gm_join_list) + if (pim_ifp->gm_join_list) { pim_if_gm_join_del_all(ifp); + /* + * Sometimes gm_join_del_all does not delete them all + * and as such it's not actually freed. Let's + * just clean this up if it wasn't to prevent + * the problem. + */ + if (pim_ifp->gm_join_list) + list_delete(&pim_ifp->gm_join_list); + } if (pim_ifp->static_group_list) pim_if_static_group_del_all(ifp); @@ -1434,10 +1443,8 @@ int pim_if_gm_join_del(struct interface *ifp, pim_addr group_addr, } listnode_delete(pim_ifp->gm_join_list, ij); gm_join_free(ij); - if (listcount(pim_ifp->gm_join_list) < 1) { + if (listcount(pim_ifp->gm_join_list) < 1) list_delete(&pim_ifp->gm_join_list); - pim_ifp->gm_join_list = 0; - } return 0; } |
