When starting nginx with mutil-processes, secondary worker may be spawned before primary worker completing initialization of fstack(dpdk), so errors occurred, for one, in kni.
1. `#define SOCK_FSTACK 0x1000`
2. when we want to create socket by fstack, we code like this :
`s = ngx_socket(domain, type | SOCK_FSTACK , protocol);`
1. Add a new directive proxy_kernel_network_stack :
Syntax: proxy_kernel_network_stack on | off;
Default: proxy_kernel_network_stack off;
Context: http, stream, mail, server
This directive is available only when NGX_HAVE_FF_STACK is defined.
Determines whether proxy should go throught kernel network stack or fstack.
2.Update F-Stack_Nginx_APP_Guide.md
freebsd and linux have a different "struct sockaddr".
In ff_recvmsg and ff_recvmsg, ```msg->msg_name```,which can refer to address, can be expected to be converted .
1. Nginx based on fstack delays setting up server on fstack until ngx_worker_process_init. ngx_configure_listening_sockets should as well.
2. FStack does not support IP_PKTINFO
When nginx is configured like this:
```
server {
listen 8000;
kernel_network_stack on;
location / {
proxy_pass http://127.0.0.1:8080/;
}
}
```
nginx will crash, becasue kernel network stack is handled in a single thread, but we have hijacked all the socket apis, it causes that all apis enter to f-stack's path which is in main thread.
Note that this only fix the error, `divert` is still not usable, refer to #136.
If you want to use NAT, you can just use the built-in `ipfw nat`
instead.
According to the FreeBSD Manual Page:
- When kevent() returns and if `flags` is EVFILT_READ, sockets which have previously been passed to listen() return when there is an incoming connection pending. `data` contains the size of the listen backlog.
So if an EVFILT_READ event reaches and it is the listen socket, we must accept `event->data` times. And for `ff_epoll` interface, we should continue to accept until it fails.
In the previous version, we only accept once when event reaches, it will cause listen queue overflow.
e.g. unix socket, ipc (with APP on kernel network stack), packet from kernel network stack.
1. Add a new directive kernel_network_stack :
Syntax: kernel_network_stack on | off;
Default: kernel_network_stack off;
Context: http, server
This directive is available only when NGX_HAVE_FF_STACK is defined.
Determines whether server should run on kernel network stack or fstack.
2. Use a simpler and more effective solution to discriminate fstack fd(file descriptor, only socket for now) from kernel fd.