diff --git a/app/nginx-1.16.1/src/event/modules/ngx_ff_module.c b/app/nginx-1.16.1/src/event/modules/ngx_ff_module.c index 1aba3a19a..9fdb7200e 100644 --- a/app/nginx-1.16.1/src/event/modules/ngx_ff_module.c +++ b/app/nginx-1.16.1/src/event/modules/ngx_ff_module.c @@ -231,20 +231,14 @@ socket(int domain, int type, int protocol) { int sock; if (unlikely(inited == 0)) { - if (AF_INET6 == domain) - domain = AF_INET6_LINUX; return SYSCALL(socket)(domain, type, protocol); } if (unlikely(fstack_territory(domain, type, protocol) == 0)) { - if (AF_INET6 == domain) - domain = AF_INET6_LINUX; return SYSCALL(socket)(domain, type, protocol); } if (unlikely((type & SOCK_FSTACK) == 0)) { - if (AF_INET6 == domain) - domain = AF_INET6_LINUX; return SYSCALL(socket)(domain, type, protocol); } diff --git a/lib/ff_api.h b/lib/ff_api.h index 52ab85e27..74b223ee0 100644 --- a/lib/ff_api.h +++ b/lib/ff_api.h @@ -44,17 +44,6 @@ struct linux_sockaddr { char sa_data[126]; }; -/* AF_INET6/PF_INET6 is 10 in linux - * defined 28 for FreeBSD - */ -#ifdef AF_INET6 -#undef AF_INET6 -#endif -#ifdef PF_INET6 -#undef PF_INET6 -#endif -#define AF_INET6 28 -#define PF_INET6 AF_INET6 #define AF_INET6_LINUX 10 #define PF_INET6_LINUX AF_INET6_LINUX diff --git a/lib/ff_syscall_wrapper.c b/lib/ff_syscall_wrapper.c index 485199668..00220c22a 100644 --- a/lib/ff_syscall_wrapper.c +++ b/lib/ff_syscall_wrapper.c @@ -168,6 +168,11 @@ /* ioctl define end */ +/* af define start */ + +#define LINUX_AF_INET6 10 + +/* af define end */ extern int sendit(struct thread *td, int s, struct msghdr *mp, int flags); @@ -405,7 +410,7 @@ linux2freebsd_sockaddr(const struct linux_sockaddr *linux, } /* #linux and #freebsd may point to the same address */ - freebsd->sa_family = linux->sa_family; + freebsd->sa_family = linux->sa_family == LINUX_AF_INET6 ? AF_INET6 : linux->sa_family; freebsd->sa_len = addrlen; bcopy(linux->sa_data, freebsd->sa_data, addrlen - sizeof(linux->sa_family)); @@ -419,7 +424,7 @@ freebsd2linux_sockaddr(struct linux_sockaddr *linux, return; } - linux->sa_family = freebsd->sa_family; + linux->sa_family = freebsd->sa_family == AF_INET6 ? LINUX_AF_INET6 : freebsd->sa_family; bcopy(freebsd->sa_data, linux->sa_data, freebsd->sa_len - sizeof(linux->sa_family)); } @@ -429,7 +434,7 @@ ff_socket(int domain, int type, int protocol) { int rc; struct socket_args sa; - sa.domain = domain; + sa.domain = domain == LINUX_AF_INET6 ? AF_INET6 : domain; sa.type = type; sa.protocol = protocol; if ((rc = sys_socket(curthread, &sa)))