On shutdown pbr was leaking the ifp->info ( struct pbr_interface *)
pointer.
Add some code to notice we are being shutdown and cleanup the memory
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
{
zlog_notice("Terminating on signal");
+ pbr_vrf_terminate();
+
frr_fini();
exit(0);
#include "pbr_map.h"
#include "pbr_debug.h"
#include "pbr_nht.h"
+#include "pbr_zebra.h"
DEFINE_MTYPE_STATIC(PBRD, PBR_MAP_VRF, "PBR Map VRF")
vrf_init(pbr_vrf_new, pbr_vrf_enable, pbr_vrf_disable, pbr_vrf_delete,
NULL);
}
+
+void pbr_vrf_terminate(void)
+{
+ struct vrf *vrf;
+ struct interface *ifp;
+
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ FOR_ALL_INTERFACES (vrf, ifp)
+ pbr_if_del(ifp);
+ }
+}
extern bool pbr_vrf_is_enabled(const struct pbr_vrf *pbr_vrf);
extern void pbr_vrf_init(void);
+extern void pbr_vrf_terminate(void);
#endif
return pbr_ifp;
}
+void pbr_if_del(struct interface *ifp)
+{
+ XFREE(MTYPE_PBR_INTERFACE, ifp->info);
+}
+
/* Inteface addition message from zebra. */
int pbr_ifp_create(struct interface *ifp)
{
extern int pbr_ifp_down(struct interface *ifp);
extern int pbr_ifp_destroy(struct interface *ifp);
+/* Free the ifp->info pointer */
+extern void pbr_if_del(struct interface *ifp);
+
#endif