on FreeBSD, on a PF_INET6 socket, recvfrom and friends can actually
return a sockaddr with family PF_INET. WTF? Work around that.
This commit is contained in:
parent
63b08692d0
commit
8581b74a84
@ -47,5 +47,11 @@ not enough memory is available.
|
||||
array_allocate does \fInot\fR change \fIx\fR to have failed; if you want
|
||||
to do that, use array_fail.
|
||||
|
||||
.SH PERFORMANCE
|
||||
This function can call realloc when the array needs to be enlarged.
|
||||
Under exceptional circumstances, this can lead to blocking the current thread.
|
||||
It will also zero-fill the newly enlarged part of the array, leading to
|
||||
all pages being mapped in by the operating system. If a small array is
|
||||
enlarged to a very large array, this can lead to swapping and blocking.
|
||||
.SH "SEE ALSO"
|
||||
array_get(3), array_start(3), array_fail(3)
|
||||
|
@ -87,7 +87,7 @@ incoming:
|
||||
#endif
|
||||
|
||||
#ifdef LIBC_HAS_IP6
|
||||
if (sa.sin6_family==AF_INET) {
|
||||
if (noipv6 || sa.sin6_family==AF_INET || sa.sin6_family==PF_INET) {
|
||||
struct sockaddr_in *sa4=(struct sockaddr_in*)&sa;
|
||||
if (ip) {
|
||||
byte_copy(ip,12,V4mappedprefix);
|
||||
|
@ -24,7 +24,7 @@ int socket_local6(int s,char ip[16],uint16 *port,uint32 *scope_id)
|
||||
|
||||
if (getsockname(s,(void*) &si,&len) == -1) return winsock2errno(-1);
|
||||
#ifdef LIBC_HAS_IP6
|
||||
if (si.sin6_family==AF_INET) {
|
||||
if (noipv6 || si.sin6_family==AF_INET || si.sin6_family==PF_INET) {
|
||||
struct sockaddr_in *si4=(void*)&si;
|
||||
if (ip) {
|
||||
byte_copy(ip,12,V4mappedprefix);
|
||||
|
@ -26,7 +26,7 @@ ssize_t socket_recv6(int s,char *buf,size_t len,char ip[16],uint16 *port,uint32
|
||||
if ((r = recvfrom(s,buf,len,0,(struct sockaddr *) &si,&Len))<0) return winsock2errno(-1);
|
||||
|
||||
#ifdef LIBC_HAS_IP6
|
||||
if (noipv6) {
|
||||
if (noipv6 || si.sin6_family==AF_INET || si.sin6_family==PF_INET) {
|
||||
struct sockaddr_in *si4=(struct sockaddr_in *)&si;
|
||||
if (ip) {
|
||||
byte_copy(ip,12,V4mappedprefix);
|
||||
|
@ -24,7 +24,7 @@ int socket_remote6(int s,char ip[16],uint16 *port,uint32 *scope_id)
|
||||
|
||||
if (getpeername(s,(struct sockaddr *) &si,&len) == -1) return winsock2errno(-1);
|
||||
#ifdef LIBC_HAS_IP6
|
||||
if (si.sin6_family==AF_INET) {
|
||||
if (noipv6 || si.sin6_family==AF_INET || si.sin6_family==PF_INET) {
|
||||
struct sockaddr_in *si4=(struct sockaddr_in*)&si;
|
||||
if (ip) {
|
||||
byte_copy(ip,12,V4mappedprefix);
|
||||
|
Loading…
x
Reference in New Issue
Block a user