]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
slirp: Adding family argument to tcp_fconnect()
authorGuillaume Subiron <maethor@subiron.org>
Sat, 19 Dec 2015 21:25:03 +0000 (22:25 +0100)
committerJason Wang <jasowang@redhat.com>
Thu, 4 Feb 2016 06:13:11 +0000 (14:13 +0800)
This patch simply adds a unsigned short family argument to remove the hardcoded
"AF_INET" in the call of qemu_socket().

This prepares for IPv6 support.

Signed-off-by: Guillaume Subiron <maethor@subiron.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
slirp/slirp.h
slirp/tcp_input.c
slirp/tcp_subr.c

index ec0a4c24154fcdf703b76a946444203936b445f5..239fe2917aad3cb9cd818f4d08581b9e8abd20f2 100644 (file)
@@ -327,7 +327,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 *, unsigned short af);
 void tcp_connect(struct socket *);
 int tcp_attach(struct socket *);
 uint8_t tcp_tos(struct socket *);
index 5e2773c9558274d7960e0e2b3e878e1f86b07f00..f24e7060a40d63e681910f43a7853588a93e1ad1 100644 (file)
@@ -584,7 +584,7 @@ findso:
            goto cont_input;
          }
 
-          if ((tcp_fconnect(so) == -1) &&
+         if ((tcp_fconnect(so, so->so_ffamily) == -1) &&
 #if defined(_WIN32)
               socket_error() != WSAEWOULDBLOCK
 #else
index 76c716fb76d98ac6ebe1e553a1add7958e039c59..36e325618dac4734247d7210daf48b0199a0eb92 100644 (file)
@@ -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, unsigned short af)
 {
   int ret=0;
 
   DEBUG_CALL("tcp_fconnect");
   DEBUG_ARG("so = %p", 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;