ansyun / dpdk-ans

ANS(Accelerated Network Stack) on DPDK, DPDK native TCP/IP stack.
https://ansyun.com
BSD 3-Clause "New" or "Revised" License
1.15k stars 322 forks source link

Is ARP used for UDP? #118

Closed YoannGh closed 4 years ago

YoannGh commented 4 years ago

Hi,

I am trying to send UDP packets from a posix thread using the anssock_sendto() function:

anssock_sendto(fd, buf, size, 0, (struct sockaddr *)remote_addr, sizeof(remote_addr));

But packets are dropped by ANS.

ans> ip stats show 
...
Invalid address on header            :1189669

I don't know if this error refers to IP or MAC address?

IP addr and routes are properly setup

ans> ip addr show

 veth0: mtu 1500 
   link/ether xx:xx:xx:xx:xx:xx
   inet addr: 192.168.0.11/24

ans> ip route show

ANS IP routing table
 0.0.0.0/0 via 192.168.0.1 dev veth0 
 192.168.0.0/24 via dev veth0 src 192.168.0.11

But neigh table is not updated

ans> ip neigh show

ANS IP neigh table

remote_addr is initialized this way:

memset(&remote_addr, 0, sizeof(remote_addr));
remote_addr.sin_family = AF_INET;
remote_addr.sin_port = htons(port);
inet_pton(AF_INET, "192.168.0.1", &remote_addr.sin_addr.s_addr);

Maybe ANS isn't performing ARP when using UDP?

bluenet13 commented 4 years ago

You shall bind local ip in applicaton.

YoannGh commented 4 years ago

That was it, thank you!

I have another problem where I cannot send TCP data as fast as possible without reading sockets, I can send a first packet but next calls to anssock_send() keep returning -1 and errno is set to EAGAIN. I will try to investigate this and maybe open another issue.

bluenet13 commented 4 years ago

You can refer to the example or test code. Maybe the anssock_connec() is not finished. anssock_connect is nonblocking API.