Fix api trace replay of handler to pass vm parameter 14/13214/2
authorJohn Lo <loj@cisco.com>
Tue, 26 Jun 2018 00:38:35 +0000 (20:38 -0400)
committerDamjan Marion <dmarion@me.com>
Tue, 26 Jun 2018 12:53:36 +0000 (12:53 +0000)
I suppose most API handlers do not use vm parameter so it has not
been a problem so far. Now vl_api_vnet_set_ip6_ethernet_neighbor()
was crashing when called from api trace replay because either of
ip_neighbor_add_del_t_handler() vnet_arp_set_ip4_over_ethernet()
need vm to be correct when it calls vlin_time_now() to update the
neighbor timestamp.

Change-Id: Iffb2084a7c90f92c4b86b339ea11800dd41117eb
Signed-off-by: John Lo <loj@cisco.com>
src/vlibmemory/vlib_api_cli.c

index ccdf3fb..d6eca59 100644 (file)
@@ -621,13 +621,13 @@ vl_msg_api_process_file (vlib_main_t * vm, u8 * filename,
          if (msg_id < vec_len (am->msg_print_handlers) &&
              am->msg_print_handlers[msg_id] && cfgp->replay_enable)
            {
-             void (*handler) (void *);
+             void (*handler) (void *, vlib_main_t *);
 
              handler = (void *) am->msg_handlers[msg_id];
 
              if (!am->is_mp_safe[msg_id])
                vl_msg_api_barrier_sync ();
-             (*handler) (tmpbuf + sizeof (uword));
+             (*handler) (tmpbuf + sizeof (uword), vm);
              if (!am->is_mp_safe[msg_id])
                vl_msg_api_barrier_release ();
            }