Fixes in networking modules for 64-bit Cygwin.

- slirp: Increment IP packet ID outside of htons() to avoid undefined behaviour.
- socket: Workaround for a bug in the w32api code that generates a constant
  with wrong value. Setting up our own FIONBIO fixes the panic.
- TODO: The slirp module still fails when Bochs is compiled in Cygwin64.
This commit is contained in:
Volker Ruppert 2017-04-20 18:51:18 +00:00
parent 68b9d10b76
commit 068795a73f
2 changed files with 6 additions and 1 deletions

View File

@ -82,6 +82,10 @@ extern "C" {
#ifdef WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#ifdef __CYGWIN__
#undef FIONBIO
#define FIONBIO 0x8004667e
#endif
#else
#include <errno.h>
#include <fcntl.h>

View File

@ -74,7 +74,8 @@ ip_output(struct socket *so, struct mbuf *m0)
*/
ip->ip_v = IPVERSION;
ip->ip_off &= IP_DF;
ip->ip_id = htons(slirp->ip_id++);
slirp->ip_id++;
ip->ip_id = htons(slirp->ip_id);
ip->ip_hl = hlen >> 2;
/*