diff options
Diffstat (limited to 'emulators/qemu/files/patch-slirp-nat')
-rw-r--r-- | emulators/qemu/files/patch-slirp-nat | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/emulators/qemu/files/patch-slirp-nat b/emulators/qemu/files/patch-slirp-nat new file mode 100644 index 000000000000..9c1accaeaf83 --- /dev/null +++ b/emulators/qemu/files/patch-slirp-nat @@ -0,0 +1,56 @@ +# http://lists.gnu.org/archive/html/qemu-devel/2005-12/msg00277.html + +diff -wurb qemu/slirp/misc.c qemu-patched/slirp/misc.c +--- qemu/slirp/misc.c Sun Dec 12 12:45:10 2004 ++++ qemu-patched/slirp/misc.c Mon Mar 21 13:22:05 2005 +@@ -90,13 +90,12 @@ + char buff[256]; + struct hostent *he; + +- if (gethostname(buff,256) < 0) +- return; +- +- if ((he = gethostbyname(buff)) == NULL) +- return; +- ++ if (gethostname(buff,256) == 0) ++ if ((he = gethostbyname(buff)) != NULL) + our_addr = *(struct in_addr *)he->h_addr; ++ ++ if (our_addr.s_addr == 0 || our_addr.s_addr == loopback_addr.s_addr) ++ our_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS); + } + + #if SIZEOF_CHAR_P == 8 +diff -wurb qemu/slirp/slirp.c qemu-patched/slirp/slirp.c +--- qemu/slirp/slirp.c Fri Oct 8 01:27:35 2004 ++++ qemu-patched/slirp/slirp.c Mon Mar 21 13:22:05 2005 +@@ -144,7 +144,6 @@ + m_init(); + + /* set default addresses */ +- getouraddr(); + inet_aton("127.0.0.1", &loopback_addr); + + if (get_dns_addr(&dns_addr) < 0) { +@@ -153,6 +152,7 @@ + } + + inet_aton(CTL_SPECIAL, &special_addr); ++ getouraddr(); + } + + #define CONN_CANFSEND(so) (((so)->so_state & (SS_FCANTSENDMORE|SS_ISFCONNECTED)) == SS_ISFCONNECTED) +diff -wurb qemu/slirp/udp.c qemu-patched/slirp/udp.c +--- qemu/slirp/udp.c Fri Oct 8 01:27:35 2004 ++++ qemu-patched/slirp/udp.c Mon Mar 21 13:22:05 2005 +@@ -314,6 +314,8 @@ + saddr = *addr; + if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) + saddr.sin_addr.s_addr = so->so_faddr.s_addr; ++ if ((so->so_faddr.s_addr & htonl(0x000000ff)) == htonl(0xff)) ++ saddr.sin_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS); + daddr.sin_addr = so->so_laddr; + daddr.sin_port = so->so_lport; + + |