vat: fix socket connection
vat_socket_connect(...) needs to set the api main client index. The M2
helper macro needed to allocate a buffer of size sizeof(*mp) + n, not
sizeof(*mp).
Type: fix
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I7abf35d2ba045d82765bd27f88899287fd351602
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index a84a67e..e7d0b02 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -103,13 +103,16 @@
vat_socket_connect (vat_main_t * vam)
{
int rv;
+ api_main_t *am = vlibapi_get_main ();
vam->socket_client_main = &socket_client_main;
if ((rv = vl_socket_client_connect ((char *) vam->socket_name,
"vpp_api_test",
0 /* default socket rx, tx buffer */ )))
return rv;
+
/* vpp expects the client index in network order */
vam->my_client_index = htonl (socket_client_main.client_index);
+ am->my_client_index = vam->my_client_index;
return 0;
}
#else /* vpp built-in case, we don't do sockets... */