aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--misc.c4
-rw-r--r--slirp.h4
-rw-r--r--socket.c2
-rw-r--r--tcp_subr.c2
-rw-r--r--udp.c4
5 files changed, 10 insertions, 6 deletions
diff --git a/misc.c b/misc.c
index 8f2c48d..48abe9d 100644
--- a/misc.c
+++ b/misc.c
@@ -125,7 +125,7 @@ int fork_exec(struct socket *so, const char *ex, int do_pty)
addr.sin_port = 0;
addr.sin_addr.s_addr = INADDR_ANY;
- if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0 ||
+ if ((s = qemu_socket(AF_INET, SOCK_STREAM, 0)) < 0 ||
bind(s, (struct sockaddr *)&addr, addrlen) < 0 ||
listen(s, 1) < 0) {
lprint("Error: inet socket: %s\n", strerror(errno));
@@ -158,7 +158,7 @@ int fork_exec(struct socket *so, const char *ex, int do_pty)
* Connect to the socket
* XXX If any of these fail, we're in trouble!
*/
- s = socket(AF_INET, SOCK_STREAM, 0);
+ s = qemu_socket(AF_INET, SOCK_STREAM, 0);
addr.sin_addr = loopback_addr;
do {
ret = connect(s, (struct sockaddr *)&addr, addrlen);
diff --git a/slirp.h b/slirp.h
index 759d06e..1c93b8a 100644
--- a/slirp.h
+++ b/slirp.h
@@ -197,6 +197,10 @@ int inet_aton(const char *cp, struct in_addr *ia);
#include "bootp.h"
#include "tftp.h"
+/* osdep.c */
+int qemu_socket(int domain, int type, int protocol);
+
+
struct Slirp {
QTAILQ_ENTRY(Slirp) entry;
diff --git a/socket.c b/socket.c
index b974267..ce51126 100644
--- a/socket.c
+++ b/socket.c
@@ -632,7 +632,7 @@ struct socket *tcp_listen(Slirp *slirp, u_int32_t haddr, u_int hport,
addr.sin_addr.s_addr = haddr;
addr.sin_port = hport;
- if (((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) ||
+ if (((s = qemu_socket(AF_INET, SOCK_STREAM, 0)) < 0) ||
(setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(int)) <
0) ||
(bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) ||
diff --git a/tcp_subr.c b/tcp_subr.c
index dd044d5..a265b4c 100644
--- a/tcp_subr.c
+++ b/tcp_subr.c
@@ -323,7 +323,7 @@ int tcp_fconnect(struct socket *so)
DEBUG_CALL("tcp_fconnect");
DEBUG_ARG("so = %lx", (long)so);
- if ((ret = so->s = socket(AF_INET, SOCK_STREAM, 0)) >= 0) {
+ if ((ret = so->s = qemu_socket(AF_INET, SOCK_STREAM, 0)) >= 0) {
int opt, s = so->s;
struct sockaddr_in addr;
diff --git a/udp.c b/udp.c
index 8b5d878..7eceea0 100644
--- a/udp.c
+++ b/udp.c
@@ -297,7 +297,7 @@ int udp_output(struct socket *so, struct mbuf *m, struct sockaddr_in *addr)
int udp_attach(struct socket *so)
{
- if ((so->s = socket(AF_INET, SOCK_DGRAM, 0)) != -1) {
+ if ((so->s = qemu_socket(AF_INET, SOCK_DGRAM, 0)) != -1) {
so->so_expire = curtime + SO_EXPIRE;
insque(so, &so->slirp->udb);
}
@@ -340,7 +340,7 @@ struct socket *udp_listen(Slirp *slirp, u_int32_t haddr, u_int hport,
if (!so) {
return NULL;
}
- so->s = socket(AF_INET, SOCK_DGRAM, 0);
+ so->s = qemu_socket(AF_INET, SOCK_DGRAM, 0);
so->so_expire = curtime + SO_EXPIRE;
insque(so, &slirp->udb);