FDio / govpp

Go toolset for the VPP.
Apache License 2.0
192 stars 81 forks source link

Invalidate msgTable map during reconnect #127

Closed themiron closed 1 year ago

themiron commented 1 year ago

It seems possible that control_ping msg id gets reused too early after reconnection to vpp, and once vpp api gets changed stored msg id is no longer valid and can crash vpp. Fix that with dropping msgTable on disconnect and protect map access with mutex.

Example:

  $ gdb ...
  #19 0x00007f63fd53d6d4 in msg_handler_internal (am=0x7f63fd76eb20 <api_global_main>, the_msg=0x7f62cb8f68b0, trace_it=0, do_it=1, free_it=0)
  (gdb) p id
  $1 = 590
  (gdb) p am->msg_names[id]
  $2 = 0x703900 "get_node_index"

  $ sudo vppctl sh api message-table | grep 590
  590  control_ping
themiron commented 1 year ago

@ondrej-fabry hi, kindly please take a look

ondrej-fabry commented 1 year ago

@themiron LGTM. Thanks for the PR.

themiron commented 1 year ago

thank you