aboutsummaryrefslogtreecommitdiffstats
path: root/src/vat
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2020-04-14 09:52:26 -0400
committerFlorin Coras <florin.coras@gmail.com>2020-04-14 21:40:46 +0000
commit69eeadc03f30c9fb3fe1bb7e2eeb6b04d1bcc596 (patch)
tree69b5310a89ee9e556b6edc5b1a7f4c6ecda3add4 /src/vat
parent1bd461615f31022a7b721990b09b1dcdd543b339 (diff)
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
Diffstat (limited to 'src/vat')
-rw-r--r--src/vat/api_format.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index a84a67e75ba..e7d0b026312 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -103,13 +103,16 @@ int
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... */