F-Stack / f-stack

F-Stack is an user space network development kit with high performance based on DPDK, FreeBSD TCP/IP stack and coroutine API.
http://www.f-stack.org
Other
3.82k stars 891 forks source link

kni mode: some ports can success to connect, some cannot ( on aws ec2) #808

Open Chithesus opened 6 months ago

Chithesus commented 6 months ago

When I deployed the F-Stack client on AWS EC2, I had to bind certain ports to connect to the remote server; but some ports simply could not connect to the server at all (some port can success to connect). I am sure that the KNI options in the F-Stack configuration file is OK, and the response ports are set to be acceptable;

Chithesus commented 6 months ago

@jfb8856606 老铁, how does fstack judge which port to support? I found it set a bitmap for the port. is it a problem of aws?

Chithesus commented 6 months ago

config.ini:

[kni] type=0 enable=1 method=accept ;The format is same as port_list tcp_port=20 udp_port=53


ff_bind :

struct sockaddr_in my_addr; bzero(&my_addr, sizeof(my_addr)); my_addr.sin_family = AF_INET; my_addr.sin_port = htons(10000); // top:20000 my_addr.sin_addr.s_addr = htonl(INADDR_ANY); int ret = ff_bind(client_socket, (struct linux_sockaddr *)&my_addr, sizeof(my_addr)); if (ret < 0) { printf("ff_bind failed, sockfd:%d, errno:%d, %s\n", client_socket, errno, strerror(errno)); exit(1); }

// loop3(NULL);

if (ff_connect(client_socket, (struct linux_sockaddr *)&server_addr, sizeof(server_addr)) < 0)
{
    printf("connect failed: %s\n", strerror(errno));
}
else {
    printf("connect success\n");
}
Chithesus commented 4 months ago

I run "tcpdump -i any -XSs0 " to catch all the message between client and server; I found client response to SYN_ACK message from server sometimes(client binding to certain ports can success to connect to server, but other ports fail to connect); i am sure server is ok