Hey,
The reason why your name doesn't match the request is related to your
code mixing vl_msg_id_t with vapi_msg_id_t. VPP internally assignes
message IDs at startup based on it's runtime configuration - plugins. If
a plugin is not loaded, it's API messages aren't loaded either. On the
other hand, VAPI IDs are constructed when the libvapiclient binary is
loaded and depend on included *.api.vapi.h files which your application
is using.
TLDR:
change:
printf("recv msg[%d] %s\n", resp->header._vl_msg_id,
vapi_get_msg_name(resp->header._vl_msg_id));
to:
printf("recv msg[%d] %s\n", resp->header._vl_msg_id,
vapi_get_msg_name(vapi_lookup_vapi_msg_id_t(ctx, resp->header._vl_msg_id)));
Regards,
Klement
Quoting [email protected] (2018-10-14 11:43:35)
> My connect:
> vapi_connect (ctx, "test123", NULL, 64, 32, VAPI_MODE_BLOCKING);
> Even if there is no vapi_send, I can get 0 from vapi_recv after sometime.
> My branch is stable 18.04.
> Who can help?
> Thanks very much!
>
> --------------------------------------------------------------------------
>
> [email protected]
>
>
> From: [1][email protected]
> Date: 2018-10-14 17:06
> To: [2]vpp-dev
> Subject: vapi recv error msg_id&msg_name
> Hi all,
> I got a serious mistake when using vapi that 'recv msg->name' has
> nothing to do with 'send msg-id'.
> The currently installed RPMS were compiled yesterday,and i do some
> change to src/*.
> Should I compile my example after making pkg-rpm && installing all rpms
> again?
> The code like :
> vapi_msg_sw_interface_set_l2_bridge *msg =
> vapi_alloc_sw_interface_set_l2_bridge(ctx);
> msg->payload.rx_sw_if_index = rx_sw_if_index;
> msg->payload.bd_id = bd_id;
> msg->payload.shg = shg;
> msg->payload.shg = shg;
> msg->payload.bvi = bvi;
> msg->payload.enable = enable;
> vapi_msg_sw_interface_set_l2_bridge_hton (msg);
> vapi_error_e rv = vapi_send (ctx, msg);
> vapi_msg_sw_interface_set_l2_bridge_reply *resp;
> size_t size;
> rv = vapi_recv (ctx, (void *) &resp, &size, 0, 0);
> vapi_msg_sw_interface_set_l2_bridge_reply_hton(resp);
> printf("recv msg[%d] %s\n", resp->header._vl_msg_id,
> vapi_get_msg_name(resp->header._vl_msg_id) );
> ----------------------------------------------------
> recv msg[166] ip6nd_proxy_details
> recv msg[23] sw_interface_tag_add_del
>
> --------------------------------------------------------------------------
>
> [email protected]
>
> References
>
> Visible links
> 1. mailto:[email protected]
> 2. mailto:[email protected]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#10818): https://lists.fd.io/g/vpp-dev/message/10818
Mute This Topic: https://lists.fd.io/mt/27309659/21656
Group Owner: [email protected]
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-