Merge pull request #6974 from liron-ze/high-cpu-usage

zebra: Solve the problem of high CPU and memory usage when creating t…
This commit is contained in:
Renato Westphal 2020-09-11 15:59:27 -03:00 committed by GitHub
commit 2525fc315a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1349,6 +1349,20 @@ static void zread_interface_add(ZAPI_HANDLER_ARGS)
struct vrf *vrf; struct vrf *vrf;
struct interface *ifp; struct interface *ifp;
vrf_id_t vrf_id = zvrf_id(zvrf);
if (vrf_id != VRF_DEFAULT && vrf_id != VRF_UNKNOWN) {
FOR_ALL_INTERFACES (zvrf->vrf, ifp) {
/* Skip pseudo interface. */
if (!CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE))
continue;
zsend_interface_add(client, ifp);
zsend_interface_link_params(client, ifp);
zsend_interface_addresses(client, ifp);
}
return;
}
RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) { RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
FOR_ALL_INTERFACES (vrf, ifp) { FOR_ALL_INTERFACES (vrf, ifp) {
/* Skip pseudo interface. */ /* Skip pseudo interface. */