mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 12:28:21 +01:00
final fixes for building for PSP without IPv6 support
This commit is contained in:
parent
b41e0a03c2
commit
69d4916a0f
@ -371,6 +371,7 @@ const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm)
|
||||
return socket_strerror(socket_connect(ps, (SA *) &sin,
|
||||
sizeof(sin), tm));
|
||||
}
|
||||
#ifndef NOIPV6
|
||||
case AF_INET6: {
|
||||
struct sockaddr_in6 sin6;
|
||||
struct in6_addr addrany = IN6ADDR_ANY_INIT;
|
||||
@ -380,6 +381,7 @@ const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm)
|
||||
return socket_strerror(socket_connect(ps, (SA *) &sin6,
|
||||
sizeof(sin6), tm));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -438,7 +440,9 @@ const char *inet_tryaccept(p_socket server, int family, p_socket client,
|
||||
socklen_t len;
|
||||
t_sockaddr_storage addr;
|
||||
switch (family) {
|
||||
#ifndef NOIPV6
|
||||
case AF_INET6: len = sizeof(struct sockaddr_in6); break;
|
||||
#endif
|
||||
case AF_INET: len = sizeof(struct sockaddr_in); break;
|
||||
default: len = sizeof(addr); break;
|
||||
}
|
||||
@ -526,9 +530,11 @@ int inet_pton(int af, const char *src, void *dst)
|
||||
if (af == AF_INET) {
|
||||
struct sockaddr_in *in = (struct sockaddr_in *) res->ai_addr;
|
||||
memcpy(dst, &in->sin_addr, sizeof(in->sin_addr));
|
||||
#ifndef NOIPV6
|
||||
} else if (af == AF_INET6) {
|
||||
struct sockaddr_in6 *in = (struct sockaddr_in6 *) res->ai_addr;
|
||||
memcpy(dst, &in->sin6_addr, sizeof(in->sin6_addr));
|
||||
#endif
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ SOCKET=$(SOCKET_$(PLAT))
|
||||
#
|
||||
CC=$(CC_$(PLAT))
|
||||
DEF=$(DEF_$(PLAT))
|
||||
CFLAGS=$(MYCFLAGS) $(CFLAGS_$(PLAT)) -DHAVE_CONFIG_H
|
||||
CFLAGS=$(MYCFLAGS) $(CFLAGS_$(PLAT)) -DHAVE_CONFIG_H -DSOCKET_SELECT -DNOIPV6
|
||||
LDFLAGS=$(MYLDFLAGS) $(LDFLAGS_$(PLAT))
|
||||
LD=$(LD_$(PLAT))
|
||||
LUAINC= $(LUAINC_$(PLAT))
|
||||
|
@ -36,6 +36,10 @@
|
||||
#include "getaddrinfo.h"
|
||||
#endif
|
||||
|
||||
#ifndef INET6_ADDRSTRLEN
|
||||
#define INET6_ADDRSTRLEN INET_ADDRSTRLEN
|
||||
#endif
|
||||
|
||||
/* Replacement for sockaddr storage that we can use internally on platforms
|
||||
* that lack it. It is not space-efficient, but neither is sockaddr_storage.
|
||||
*/
|
||||
@ -43,7 +47,9 @@ struct sockaddr_storage {
|
||||
union {
|
||||
struct sockaddr ss_sa;
|
||||
struct sockaddr_in ss_sin;
|
||||
#ifndef NOIPV6
|
||||
struct sockaddr_in6 ss_sin6;
|
||||
#endif
|
||||
char ss_padding[128];
|
||||
} ss_union;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user