aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip6-nd
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2020-11-09 17:11:57 -0500
committerNeale Ranns <nranns@cisco.com>2020-11-10 08:49:23 +0000
commit5f09efe70cc872a97c9db4c3a53455712548cad7 (patch)
treeb20356cc4c8c1eb5a0dff3d450ed2f918d187c0b /src/vnet/ip6-nd
parent9ed4866440f4a20c04c86ecfc7f8b2cc380b2b09 (diff)
ip6-nd: fix memory leaks
Quite a noticeable amount of memory. Recoded ra event tx and rx fns in the usual manner, which terminated the leaks. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I486d348456b465ad3940a280d4cf489e8dd655a5
Diffstat (limited to 'src/vnet/ip6-nd')
-rw-r--r--src/vnet/ip6-nd/ip6_ra.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/vnet/ip6-nd/ip6_ra.c b/src/vnet/ip6-nd/ip6_ra.c
index af82a06eb2b..5605939c092 100644
--- a/src/vnet/ip6-nd/ip6_ra.c
+++ b/src/vnet/ip6-nd/ip6_ra.c
@@ -1601,19 +1601,23 @@ ip6_ra_process_timer_event (vlib_main_t * vm,
}
static void
-ip6_ra_handle_report (const ip6_ra_report_t * rap)
+ip6_ra_handle_report (ip6_ra_report_t * rap)
{
u32 ii;
vec_foreach_index (ii, ip6_ra_listeners) ip6_ra_listeners[ii] (rap);
+ vec_free (rap->prefixes);
+ clib_mem_free (rap);
}
static uword
ip6_ra_event_process (vlib_main_t * vm,
vlib_node_runtime_t * node, vlib_frame_t * frame)
{
- ip6_ra_report_t *r, *rs;
+ ip6_ra_report_t *r;
uword event_type;
+ uword *event_data = 0;
+ int i;
/* init code here */
@@ -1621,9 +1625,9 @@ ip6_ra_event_process (vlib_main_t * vm,
{
vlib_process_wait_for_event_or_clock (vm, 1. /* seconds */ );
- rs = vlib_process_get_event_data (vm, &event_type);
+ event_type = vlib_process_get_events (vm, &event_data);
- if (NULL == rs)
+ if (event_type == ~0)
{
/* No events found: timer expired. */
/* process interface list and send RAs as appropriate, update timer info */
@@ -1631,17 +1635,25 @@ ip6_ra_event_process (vlib_main_t * vm,
}
else
{
- vec_foreach (r, rs) ip6_ra_handle_report (r);
- vec_reset_length (rs);
+ for (i = 0; i < vec_len (event_data); i++)
+ {
+ r = (void *) (event_data[i]);
+ ip6_ra_handle_report (r);
+ }
+ vec_reset_length (event_data);
}
}
return frame->n_vectors;
}
+/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip6_ra_process_node) =
{
-.function = ip6_ra_event_process,.name = "ip6-ra-process",.type =
- VLIB_NODE_TYPE_PROCESS,};
+ .function = ip6_ra_event_process,
+ .name = "ip6-ra-process",
+ .type = VLIB_NODE_TYPE_PROCESS,
+};
+/* *INDENT-ON* */
static void
ip6_ra_signal_report (ip6_ra_report_t * r)
@@ -1652,10 +1664,10 @@ ip6_ra_signal_report (ip6_ra_report_t * r)
if (!vec_len (ip6_ra_listeners))
return;
- q = vlib_process_signal_event_data (vm,
- ip6_ra_process_node.index,
- 0, 1, sizeof *q);
+ q = clib_mem_alloc (sizeof (*q));
*q = *r;
+
+ vlib_process_signal_event (vm, ip6_ra_process_node.index, 0, (uword) q);
}
static int