qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 11/16] slirp: Adding family argument to tcp_fconnect


From: Samuel Thibault
Subject: [Qemu-devel] [PATCH 11/16] slirp: Adding family argument to tcp_fconnect()
Date: Tue, 11 Feb 2014 14:08:12 +0100

This patch simply adds a sa_family_t argument to remove the hardcoded
"AF_INET" in the call of qemu_socket().

Signed-off-by: Guillaume Subiron <address@hidden>
---
 slirp/slirp.h     | 2 +-
 slirp/tcp_input.c | 3 ++-
 slirp/tcp_subr.c  | 5 +++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/slirp/slirp.h b/slirp/slirp.h
index ec9cbed..d16400b 100644
--- a/slirp/slirp.h
+++ b/slirp/slirp.h
@@ -369,7 +369,7 @@ void tcp_respond(struct tcpcb *, register struct tcpiphdr 
*, register struct mbu
 struct tcpcb * tcp_newtcpcb(struct socket *);
 struct tcpcb * tcp_close(register struct tcpcb *);
 void tcp_sockclosed(struct tcpcb *);
-int tcp_fconnect(struct socket *);
+int tcp_fconnect(struct socket *, sa_family_t af);
 void tcp_connect(struct socket *);
 int tcp_attach(struct socket *);
 uint8_t tcp_tos(struct socket *);
diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c
index f7a8d49..25929bd 100644
--- a/slirp/tcp_input.c
+++ b/slirp/tcp_input.c
@@ -581,7 +581,8 @@ findso:
            goto cont_input;
          }
 
-         if((tcp_fconnect(so) == -1) && (errno != EINPROGRESS) && (errno != 
EWOULDBLOCK)) {
+         if ((tcp_fconnect(so, so->so_ffamily) == -1)
+            && (errno != EINPROGRESS) && (errno != EWOULDBLOCK)) {
            u_char code=ICMP_UNREACH_NET;
            DEBUG_MISC((dfd, " tcp fconnect errno = %d-%s\n",
                        errno,strerror(errno)));
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index 4791c0c..3558115 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -324,14 +324,15 @@ tcp_sockclosed(struct tcpcb *tp)
  * nonblocking.  Connect returns after the SYN is sent, and does
  * not wait for ACK+SYN.
  */
-int tcp_fconnect(struct socket *so)
+int tcp_fconnect(struct socket *so, sa_family_t af)
 {
   int ret=0;
 
   DEBUG_CALL("tcp_fconnect");
   DEBUG_ARG("so = %lx", (long )so);
 
-  if( (ret = so->s = qemu_socket(AF_INET,SOCK_STREAM,0)) >= 0) {
+  ret = so->s = qemu_socket(af, SOCK_STREAM, 0);
+  if (ret >= 0) {
     int opt, s=so->s;
     struct sockaddr_storage addr;
 
-- 
1.8.5.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]