Slirp cleanups.

This commit is contained in:
Toni Wilen 2017-04-01 20:11:26 +03:00
parent fa8d3ce3bc
commit 6134c9bc70
5 changed files with 18 additions and 6 deletions

View File

@ -81,7 +81,7 @@ void ip_input(struct mbuf *m)
DEBUG_CALL("ip_input");
DEBUG_ARG("m = %p", m);
DEBUG_ARG("m_len = %d", m->m_len);
DEBUG_ARG("m_len = %zu", m->m_len);
ipstat.ips_total++;

View File

@ -121,13 +121,13 @@ static int get_dns_addr(struct in_addr *pdns_addr)
#endif
static int inited;
int slirp_init(void)
{
// debug_init("/tmp/slirp.log", DEBUG_DEFAULT);
#ifdef _WIN32
static int inited;
if (!inited) {
WSADATA Data;
WSAStartup(MAKEWORD(2,0), &Data);

View File

@ -50,8 +50,20 @@ typedef unsigned long ioctlsockopt_t;
# define write_udp slirp_write_udp
# define init_udp slirp_init_udp
# define final_udp slirp_final_udp
#else
#else //!_WIN32
typedef int ioctlsockopt_t;
# define WSAGetLastError() (int)(errno)
# define WSASetLastError(e) (void)(errno = (e))
# define WSAEWOULDBLOCK EWOULDBLOCK
# define WSAEINPROGRESS EINPROGRESS
# define WSAENOTCONN ENOTCONN
# define WSAEHOSTUNREACH EHOSTUNREACH
# define WSAENETUNREACH ENETUNREACH
# define WSAECONNREFUSED ECONNREFUSED
# define SLIRP_SOCKET int
# define ioctlsocket ioctl
# define closesocket(s) close(s)
# define O_BINARY 0

View File

@ -1072,7 +1072,7 @@ findso:
if (ti->ti_len == 0 && tiwin == tp->snd_wnd) {
tcpstat.tcps_rcvdupack++;
DEBUG_MISC((" dup ack m = %p so = %p \n",
(long)m, (long)so));
m, so));
/*
* If we have outstanding data (other than
* a window probe), this is a completely

View File

@ -341,7 +341,7 @@ SLIRP_SOCKET udp_attach(struct socket *so)
if(bind(so->s, (struct sockaddr *)&addr, sizeof(addr))<0) {
int error = WSAGetLastError();
closesocket(so->s);
so->s =- 1;
so->s = -1;
WSASetLastError(error);
} else {
/* success, insert in queue */