getting a message without sending one is probably because of keepalive messages, which vapi doesn't handle automatically in your version. newer versions support automatic handling of keepalive messages by supplying the appropriate parameter to vapi_connect to do so.
regarding tunnel_if_index - can you verify that the reply is indeed vapi_vxlan_add_del_reply? if so, than the bug is most probably in your app or on vpp side. vapi library doesn't do any processing itself and all the code is generated. Quoting 王传国 (2018-10-17 09:47:24) > one more question. > > Even if there was no vapi_send, I can get 0 from vapi_recv after sometime. > why? > sometime,vapi_vxlan_add_del'reply,retvalue=0,but the tunnel_if_index=0 which > should be 6(got by cmd:show int) > > > > -- > 发自我的网易邮箱手机智能版 > > > 在 2018-10-15 19:03:52,"Klement Sekera" <ksek...@cisco.com> 写道: > >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 wangchuan...@163.com (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! > >> > >> > >> -------------------------------------------------------------------------- > >> > >> wangchuan...@163.com > >> > >> > >> From: [1]wangchuan...@163.com > >> 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 > >> > >> > >> -------------------------------------------------------------------------- > >> > >> wangchuan...@163.com > >> > >> References > >> > >> Visible links > >> 1. mailto:wangchuan...@163.com > >> 2. mailto:vpp-dev@lists.fd.io
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#10851): https://lists.fd.io/g/vpp-dev/message/10851 Mute This Topic: https://lists.fd.io/mt/27309659/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-