mirror of https://gitee.com/openkylin/qemu.git
Fix slirp on windows
Marc-André Lureau (2): slirp: remove slirp_ prefix for socket wrappers slirp: wrap the remaining socket functions -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE5h27FdQXK97JfpLZ21UOifD6VPMFAlxkYnkACgkQ21UOifD6 VPMhWxAAtHTBKZbATAu6exugvT2zrGDne607tZ7WAHfVMm8FiRlJeD77X1ow1XE3 EDQ7qv80ExTIRBjBKDHzuPVd7apRTkSdT/Ipkv+vCE9E0jmcNa9HDU17k6jVWp1+ sXCEoCHO0Psg8LB/5NIMcXKkeoepCNQgtHTqnU0XSBrpFfyeAUgDaM6xjorpzK5b h3xM3bUtUs4mqEu+05Uqnb9BGU647mP+FSd2xq9b1L7Kc4/xS2Ms99mn7FKCLGQe NA8boS21VuCNEcJmy7WsiKxRZA1Jf979zbeo35PklOARqk6WiiQmDZSwCm5y2jd6 J6xNrcrFW05lzkDO4IWZ9Gv0gEY1mkCTcV8Xq8hA16rEPahKiuxuqFv9qPkzWjxs mrj7Ngdrkz12mYslEBkXieFexjNiXVhcHZrTnj49k4etYosPcokGFJf8LMdx1/C5 csxVHrZ+TtRHJCNlCtLS8LDbc36B/9NZS45l6hkH6bKTok65iD65skRV4UwYKfci MubO11Fx/lk7JtwPTR12SsROguxN4dXnKt4lbaGVh8t0lDraKeGsvg9SVu/wx/Ex TFtQ5XFPy/+eqbsnfqpi18rzWMnPhiiQvj3DijIgNhFbudC9x+GmnWCwiqEcPp7l +r40j2B3UrYzfmcmYnq2XWbnXiRnDn0c34dacjgnNBu8UhKeYvs= =XTPb -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging Fix slirp on windows Marc-André Lureau (2): slirp: remove slirp_ prefix for socket wrappers slirp: wrap the remaining socket functions # gpg: Signature made Wed 13 Feb 2019 18:31:21 GMT # gpg: using RSA key E61DBB15D4172BDEC97E92D9DB550E89F0FA54F3 # gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>" [unknown] # gpg: aka "Samuel Thibault <sthibault@debian.org>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@gnu.org>" [unknown] # gpg: aka "Samuel Thibault <samuel.thibault@inria.fr>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@labri.fr>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@ens-lyon.org>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>" [unknown] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 900C B024 B679 31D4 0F82 304B D017 8C76 7D06 9EE6 # Subkey fingerprint: E61D BB15 D417 2BDE C97E 92D9 DB55 0E89 F0FA 54F3 * remotes/thibault/tags/samuel-thibault: slirp: wrap the remaining socket functions slirp: remove slirp_ prefix for socket wrappers Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
7e407466b1
|
@ -114,7 +114,7 @@ static int icmp_send(struct socket *so, struct mbuf *m, int hlen)
|
|||
void icmp_detach(struct socket *so)
|
||||
{
|
||||
so->slirp->cb->unregister_poll_fd(so->s, so->slirp->opaque);
|
||||
slirp_closesocket(so->s);
|
||||
closesocket(so->s);
|
||||
sofree(so);
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ void icmp_receive(struct socket *so)
|
|||
icp = mtod(m, struct icmp *);
|
||||
|
||||
id = icp->icmp_id;
|
||||
len = slirp_recv(so->s, icp, M_ROOM(m), 0);
|
||||
len = recv(so->s, icp, M_ROOM(m), 0);
|
||||
/*
|
||||
* The behavior of reading SOCK_DGRAM+IPPROTO_ICMP sockets is inconsistent
|
||||
* between host OSes. On Linux, only the ICMP header and payload is
|
||||
|
|
14
slirp/misc.c
14
slirp/misc.c
|
@ -98,16 +98,16 @@ slirp_socketpair_with_oob(int sv[2])
|
|||
goto err;
|
||||
}
|
||||
|
||||
slirp_closesocket(s);
|
||||
closesocket(s);
|
||||
return 0;
|
||||
|
||||
err:
|
||||
g_critical("slirp_socketpair(): %s", strerror(errno));
|
||||
if (s >= 0) {
|
||||
slirp_closesocket(s);
|
||||
closesocket(s);
|
||||
}
|
||||
if (sv[1] >= 0) {
|
||||
slirp_closesocket(sv[1]);
|
||||
closesocket(sv[1]);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -211,16 +211,16 @@ fork_exec(struct socket *so, const char *ex)
|
|||
if (err) {
|
||||
g_critical("fork_exec: %s", err->message);
|
||||
g_error_free(err);
|
||||
slirp_closesocket(sp[0]);
|
||||
slirp_closesocket(sp[1]);
|
||||
closesocket(sp[0]);
|
||||
closesocket(sp[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
so->s = sp[0];
|
||||
slirp_closesocket(sp[1]);
|
||||
closesocket(sp[1]);
|
||||
slirp_socket_set_fast_reuse(so->s);
|
||||
opt = 1;
|
||||
slirp_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int));
|
||||
setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int));
|
||||
slirp_set_nonblock(so->s);
|
||||
so->slirp->cb->register_poll_fd(so->s, so->slirp->opaque);
|
||||
return 1;
|
||||
|
|
|
@ -961,7 +961,7 @@ int slirp_remove_hostfwd(Slirp *slirp, int is_udp, struct in_addr host_addr,
|
|||
addr.sin_addr.s_addr == host_addr.s_addr &&
|
||||
addr.sin_port == port) {
|
||||
so->slirp->cb->unregister_poll_fd(so->s, so->slirp->opaque);
|
||||
slirp_closesocket(so->s);
|
||||
closesocket(so->s);
|
||||
sofree(so);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ soread(struct socket *so)
|
|||
*/
|
||||
sopreprbuf(so, iov, &n);
|
||||
|
||||
nn = slirp_recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
|
||||
nn = recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
|
||||
if (nn <= 0) {
|
||||
if (nn < 0 && (errno == EINTR || errno == EAGAIN))
|
||||
return 0;
|
||||
|
@ -201,7 +201,7 @@ soread(struct socket *so)
|
|||
if (getpeername(so->s, paddr, &alen) < 0) {
|
||||
err = errno;
|
||||
} else {
|
||||
slirp_getsockopt(so->s, SOL_SOCKET, SO_ERROR,
|
||||
getsockopt(so->s, SOL_SOCKET, SO_ERROR,
|
||||
&err, &elen);
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ soread(struct socket *so)
|
|||
*/
|
||||
if (n == 2 && nn == iov[0].iov_len) {
|
||||
int ret;
|
||||
ret = slirp_recv(so->s, iov[1].iov_base, iov[1].iov_len,0);
|
||||
ret = recv(so->s, iov[1].iov_base, iov[1].iov_len,0);
|
||||
if (ret > 0)
|
||||
nn += ret;
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ sorecvfrom(struct socket *so)
|
|||
*/
|
||||
len = M_FREEROOM(m);
|
||||
/* if (so->so_fport != htons(53)) { */
|
||||
slirp_ioctlsocket(so->s, FIONREAD, &n);
|
||||
ioctlsocket(so->s, FIONREAD, &n);
|
||||
|
||||
if (n > len) {
|
||||
n = (m->m_data - m->m_dat) + m->m_len + n + 1;
|
||||
|
@ -724,7 +724,7 @@ tcp_listen(Slirp *slirp, uint32_t haddr, unsigned hport, uint32_t laddr,
|
|||
int tmperrno = errno; /* Don't clobber the real reason we failed */
|
||||
|
||||
if (s >= 0) {
|
||||
slirp_closesocket(s);
|
||||
closesocket(s);
|
||||
}
|
||||
sofree(so);
|
||||
/* Restore the real errno */
|
||||
|
@ -735,9 +735,9 @@ tcp_listen(Slirp *slirp, uint32_t haddr, unsigned hport, uint32_t laddr,
|
|||
#endif
|
||||
return NULL;
|
||||
}
|
||||
slirp_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int));
|
||||
setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int));
|
||||
opt = 1;
|
||||
slirp_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(int));
|
||||
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(int));
|
||||
|
||||
getsockname(s,(struct sockaddr *)&addr,&addrlen);
|
||||
so->so_ffamily = AF_INET;
|
||||
|
|
|
@ -337,7 +337,7 @@ tcp_close(struct tcpcb *tp)
|
|||
if (so == slirp->tcp_last_so)
|
||||
slirp->tcp_last_so = &slirp->tcb;
|
||||
so->slirp->cb->unregister_poll_fd(so->s, so->slirp->opaque);
|
||||
slirp_closesocket(so->s);
|
||||
closesocket(so->s);
|
||||
sbfree(&so->so_rcv);
|
||||
sbfree(&so->so_snd);
|
||||
sofree(so);
|
||||
|
@ -416,9 +416,9 @@ int tcp_fconnect(struct socket *so, unsigned short af)
|
|||
so->slirp->cb->register_poll_fd(so->s, so->slirp->opaque);
|
||||
slirp_socket_set_fast_reuse(s);
|
||||
opt = 1;
|
||||
slirp_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(opt));
|
||||
setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(opt));
|
||||
opt = 1;
|
||||
slirp_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
|
||||
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
|
||||
|
||||
addr = so->fhost.ss;
|
||||
DEBUG_CALL(" connect()ing");
|
||||
|
@ -489,7 +489,7 @@ void tcp_connect(struct socket *inso)
|
|||
so->slirp->cb->register_poll_fd(so->s, so->slirp->opaque);
|
||||
slirp_socket_set_fast_reuse(s);
|
||||
opt = 1;
|
||||
slirp_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int));
|
||||
setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int));
|
||||
slirp_socket_set_nodelay(s);
|
||||
|
||||
so->fhost.ss = addr;
|
||||
|
@ -499,7 +499,7 @@ void tcp_connect(struct socket *inso)
|
|||
if (inso->so_state & SS_FACCEPTONCE) {
|
||||
/* If we only accept once, close the accept() socket */
|
||||
so->slirp->cb->unregister_poll_fd(so->s, so->slirp->opaque);
|
||||
slirp_closesocket(so->s);
|
||||
closesocket(so->s);
|
||||
|
||||
/* Don't select it yet, even though we have an FD */
|
||||
/* if it's not FACCEPTONCE, it's already NOFDREF */
|
||||
|
|
|
@ -292,7 +292,7 @@ void
|
|||
udp_detach(struct socket *so)
|
||||
{
|
||||
so->slirp->cb->unregister_poll_fd(so->s, so->slirp->opaque);
|
||||
slirp_closesocket(so->s);
|
||||
closesocket(so->s);
|
||||
sofree(so);
|
||||
}
|
||||
|
||||
|
|
164
slirp/util.c
164
slirp/util.c
|
@ -167,7 +167,7 @@ static int socket_error(void)
|
|||
}
|
||||
|
||||
#undef ioctlsocket
|
||||
int slirp_ioctlsocket(int fd, int req, void *val)
|
||||
int slirp_ioctlsocket_wrap(int fd, int req, void *val)
|
||||
{
|
||||
int ret;
|
||||
ret = ioctlsocket(fd, req, val);
|
||||
|
@ -178,7 +178,7 @@ int slirp_ioctlsocket(int fd, int req, void *val)
|
|||
}
|
||||
|
||||
#undef closesocket
|
||||
int slirp_closesocket(int fd)
|
||||
int slirp_closesocket_wrap(int fd)
|
||||
{
|
||||
int ret;
|
||||
ret = closesocket(fd);
|
||||
|
@ -187,6 +187,166 @@ int slirp_closesocket(int fd)
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef connect
|
||||
int slirp_connect_wrap(int sockfd, const struct sockaddr *addr, int addrlen)
|
||||
{
|
||||
int ret;
|
||||
ret = connect(sockfd, addr, addrlen);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef listen
|
||||
int slirp_listen_wrap(int sockfd, int backlog)
|
||||
{
|
||||
int ret;
|
||||
ret = listen(sockfd, backlog);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef bind
|
||||
int slirp_bind_wrap(int sockfd, const struct sockaddr *addr, int addrlen)
|
||||
{
|
||||
int ret;
|
||||
ret = bind(sockfd, addr, addrlen);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef socket
|
||||
int slirp_socket_wrap(int domain, int type, int protocol)
|
||||
{
|
||||
int ret;
|
||||
ret = socket(domain, type, protocol);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef accept
|
||||
int slirp_accept_wrap(int sockfd, struct sockaddr *addr, int *addrlen)
|
||||
{
|
||||
int ret;
|
||||
ret = accept(sockfd, addr, addrlen);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef shutdown
|
||||
int slirp_shutdown_wrap(int sockfd, int how)
|
||||
{
|
||||
int ret;
|
||||
ret = shutdown(sockfd, how);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef getsockopt
|
||||
int slirp_getsockopt_wrap(int sockfd, int level, int optname,
|
||||
void *optval, int *optlen)
|
||||
{
|
||||
int ret;
|
||||
ret = getsockopt(sockfd, level, optname, optval, optlen);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef setsockopt
|
||||
int slirp_setsockopt_wrap(int sockfd, int level, int optname,
|
||||
const void *optval, int optlen)
|
||||
{
|
||||
int ret;
|
||||
ret = setsockopt(sockfd, level, optname, optval, optlen);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef getpeername
|
||||
int slirp_getpeername_wrap(int sockfd, struct sockaddr *addr,
|
||||
int *addrlen)
|
||||
{
|
||||
int ret;
|
||||
ret = getpeername(sockfd, addr, addrlen);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef getsockname
|
||||
int slirp_getsockname_wrap(int sockfd, struct sockaddr *addr,
|
||||
int *addrlen)
|
||||
{
|
||||
int ret;
|
||||
ret = getsockname(sockfd, addr, addrlen);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef send
|
||||
ssize_t slirp_send_wrap(int sockfd, const void *buf, size_t len, int flags)
|
||||
{
|
||||
int ret;
|
||||
ret = send(sockfd, buf, len, flags);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef sendto
|
||||
ssize_t slirp_sendto_wrap(int sockfd, const void *buf, size_t len, int flags,
|
||||
const struct sockaddr *addr, int addrlen)
|
||||
{
|
||||
int ret;
|
||||
ret = sendto(sockfd, buf, len, flags, addr, addrlen);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef recv
|
||||
ssize_t slirp_recv_wrap(int sockfd, void *buf, size_t len, int flags)
|
||||
{
|
||||
int ret;
|
||||
ret = recv(sockfd, buf, len, flags);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#undef recvfrom
|
||||
ssize_t slirp_recvfrom_wrap(int sockfd, void *buf, size_t len, int flags,
|
||||
struct sockaddr *addr, int *addrlen)
|
||||
{
|
||||
int ret;
|
||||
ret = recvfrom(sockfd, buf, len, flags, addr, addrlen);
|
||||
if (ret < 0) {
|
||||
errno = socket_error();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
||||
void slirp_pstrcpy(char *buf, int buf_size, const char *str)
|
||||
|
|
75
slirp/util.h
75
slirp/util.h
|
@ -81,21 +81,68 @@ struct iovec {
|
|||
#define ETH_P_NCSI (0x88f8)
|
||||
#define ETH_P_UNKNOWN (0xffff)
|
||||
|
||||
/* FIXME: remove me when made standalone */
|
||||
#ifdef _WIN32
|
||||
int slirp_closesocket(int fd);
|
||||
int slirp_ioctlsocket(int fd, int req, void *val);
|
||||
#undef accept
|
||||
#undef bind
|
||||
#undef closesocket
|
||||
#undef connect
|
||||
#undef getpeername
|
||||
#undef getsockname
|
||||
#undef getsockopt
|
||||
#undef ioctlsocket
|
||||
#undef listen
|
||||
#undef recv
|
||||
#undef recvfrom
|
||||
#undef send
|
||||
#undef sendto
|
||||
#undef setsockopt
|
||||
#undef shutdown
|
||||
#undef socket
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define connect slirp_connect_wrap
|
||||
int slirp_connect_wrap(int fd, const struct sockaddr *addr, int addrlen);
|
||||
#define listen slirp_listen_wrap
|
||||
int slirp_listen_wrap(int fd, int backlog);
|
||||
#define bind slirp_bind_wrap
|
||||
int slirp_bind_wrap(int fd, const struct sockaddr *addr, int addrlen);
|
||||
#define socket slirp_socket_wrap
|
||||
int slirp_socket_wrap(int domain, int type, int protocol);
|
||||
#define accept slirp_accept_wrap
|
||||
int slirp_accept_wrap(int fd, struct sockaddr *addr, int *addrlen);
|
||||
#define shutdown slirp_shutdown_wrap
|
||||
int slirp_shutdown_wrap(int fd, int how);
|
||||
#define getpeername slirp_getpeername_wrap
|
||||
int slirp_getpeername_wrap(int fd, struct sockaddr *addr, int *addrlen);
|
||||
#define getsockname slirp_getsockname_wrap
|
||||
int slirp_getsockname_wrap(int fd, struct sockaddr *addr, int *addrlen);
|
||||
#define send slirp_send_wrap
|
||||
ssize_t slirp_send_wrap(int fd, const void *buf, size_t len, int flags);
|
||||
#define sendto slirp_sendto_wrap
|
||||
ssize_t slirp_sendto_wrap(int fd, const void *buf, size_t len, int flags,
|
||||
const struct sockaddr *dest_addr, int addrlen);
|
||||
#define recv slirp_recv_wrap
|
||||
ssize_t slirp_recv_wrap(int fd, void *buf, size_t len, int flags);
|
||||
#define recvfrom slirp_recvfrom_wrap
|
||||
ssize_t slirp_recvfrom_wrap(int fd, void *buf, size_t len, int flags,
|
||||
struct sockaddr *src_addr, int *addrlen);
|
||||
#define closesocket slirp_closesocket_wrap
|
||||
int slirp_closesocket_wrap(int fd);
|
||||
#define ioctlsocket slirp_ioctlsocket_wrap
|
||||
int slirp_ioctlsocket_wrap(int fd, int req, void *val);
|
||||
#define getsockopt slirp_getsockopt_wrap
|
||||
int slirp_getsockopt_wrap(int sockfd, int level, int optname,
|
||||
void *optval, int *optlen);
|
||||
#define setsockopt slirp_setsockopt_wrap
|
||||
int slirp_setsockopt_wrap(int sockfd, int level, int optname,
|
||||
const void *optval, int optlen);
|
||||
|
||||
int inet_aton(const char *cp, struct in_addr *ia);
|
||||
#define slirp_getsockopt(sockfd, level, optname, optval, optlen) \
|
||||
getsockopt(sockfd, level, optname, (void *)optval, optlen)
|
||||
#define slirp_setsockopt(sockfd, level, optname, optval, optlen) \
|
||||
setsockopt(sockfd, level, optname, (const void *)optval, optlen)
|
||||
#define slirp_recv(sockfd, buf, len, flags) recv(sockfd, (void *)buf, len, flags)
|
||||
#else
|
||||
#define slirp_setsockopt setsockopt
|
||||
#define slirp_getsockopt getsockopt
|
||||
#define slirp_recv recv
|
||||
#define slirp_closesocket close
|
||||
#define slirp_ioctlsocket ioctl
|
||||
#define closesocket(s) close(s)
|
||||
#define ioctlsocket(s, r, v) ioctl(s, r, v)
|
||||
#endif
|
||||
|
||||
int slirp_socket(int domain, int type, int protocol);
|
||||
|
@ -104,14 +151,14 @@ void slirp_set_nonblock(int fd);
|
|||
static inline int slirp_socket_set_nodelay(int fd)
|
||||
{
|
||||
int v = 1;
|
||||
return slirp_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v));
|
||||
return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v));
|
||||
}
|
||||
|
||||
static inline int slirp_socket_set_fast_reuse(int fd)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
int v = 1;
|
||||
return slirp_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(v));
|
||||
return setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(v));
|
||||
#else
|
||||
/* Enabling the reuse of an endpoint that was used by a socket still in
|
||||
* TIME_WAIT state is usually performed by setting SO_REUSEADDR. On Windows
|
||||
|
|
Loading…
Reference in New Issue