My mistake, sorry to bother, thanks. Regards, Ewan
yug...@telincn.com 发件人: yug...@telincn.com 发送时间: 2017-01-19 16:06 收件人: 余刚; vpp-dev 主题: 回复: [vpp-dev] send packet in vpp Here is my node func. VLIB_REGISTER_NODE( ip4_timer_test_node) = { .function = ip4_timer_test_process, .type = VLIB_NODE_TYPE_PROCESS, .name = "ip4-timer-test-process", .state = VLIB_NODE_STATE_POLLING, }; Regards, Ewan yug...@telincn.com 发件人: yug...@telincn.com 发送时间: 2017-01-19 13:51 收件人: vpp-dev 主题: [vpp-dev] send packet in vpp Hi, all I would like to send packet in timer func, and i followed func "send_dhcp_pkt" to build a frame. But the packet did not come out through nic. Bellow is my func, ping works between those two ip addresses, is there anything missed, any tools could help me? thanks. void ip4_time_out(void) { u32 radlen; u32 * to_output; u32 bi0; vlib_buffer_t *b0; vlib_frame_t *f; unsigned char *rad0 = NULL; ip4_header_t *ip40; udp_header_t *udp0; vlib_main_t * vm = vlib_get_main(); /* speculatively enqueue b0 to the current next frame */ if (vlib_buffer_alloc (vm, &bi0, 1) == 1) { b0 = vlib_get_buffer (vm, bi0); vnet_buffer(b0)->sw_if_index[VLIB_RX] = 1; vnet_buffer(b0)->sw_if_index[VLIB_TX] = ~0; f = vlib_get_frame_to_node (vm, ip4_lookup_node.index); to_output = vlib_frame_vector_args (f); to_output[0] = bi0; f->n_vectors = 1; vlib_put_frame_to_node(vm, ip4_lookup_node.index, f); vlib_buffer_advance(b0, sizeof(ethernet_header_t)); ip40 = vlib_buffer_get_current (b0); vlib_buffer_advance (b0, sizeof (*ip40)); udp0 = vlib_buffer_get_current (b0); vlib_buffer_advance (b0, sizeof (*udp0)); rad0= vlib_buffer_get_current (b0); ip40->dst_address.as_u32 = inet_addr("192.168.118.1"); ip40->src_address.as_u32 = inet_addr("192.168.118.131"); udp0->src_port = clib_host_to_net_u16(2000); udp0->dst_port = clib_host_to_net_u16(1812); strcpy((char*)rad0, "test-username-test-password~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); radlen = 200; udp0->checksum = ip4_tcp_udp_com_checksum (vm, b0); ip40->length = clib_host_to_net_u16 (radlen + sizeof (ip4_header_t) + sizeof (udp0)); ip40->checksum = ip4_header_checksum (ip40); b0->current_length = radlen + sizeof (ip4_header_t) + sizeof (udp0); //vlib_put_frame_to_node(vm, ip4_lookup_node.index, f); } } yug...@telincn.com
_______________________________________________ vpp-dev mailing list vpp-dev@lists.fd.io https://lists.fd.io/mailman/listinfo/vpp-dev