qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: qemu-devel@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>,
	zhanghailiang <zhang.zhanghailiang@huawei.com>,
	Li Zhijian <lizhijian@cn.fujitsu.com>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	Jason Wang <jasowang@redhat.com>,
	Dave Gilbert <dgilbert@redhat.com>,
	Vasiliy Tolstov <v.tolstov@selfip.ru>,
	Huangpeng <peter.huangpeng@huawei.com>,
	Gonglei <arei.gonglei@huawei.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Yang Hongyang <yanghy@cn.fujitsu.com>,
	Guillaume Subiron <maethor@subiron.org>
Subject: [Qemu-devel] [PATCH 9/9] slirp: Adding family argument to tcp_fconnect()
Date: Sat, 19 Dec 2015 22:25:03 +0100	[thread overview]
Message-ID: <1450560303-11330-9-git-send-email-samuel.thibault@ens-lyon.org> (raw)
In-Reply-To: <1450560303-11330-1-git-send-email-samuel.thibault@ens-lyon.org>

From: Guillaume Subiron <maethor@subiron.org>

This patch simply adds a sa_family_t 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>
---
 slirp/slirp.h     | 2 +-
 slirp/tcp_input.c | 2 +-
 slirp/tcp_subr.c  | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/slirp/slirp.h b/slirp/slirp.h
index 6589d7e..5b810e5 100644
--- a/slirp/slirp.h
+++ b/slirp/slirp.h
@@ -332,7 +332,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 5e2773c..f24e706 100644
--- a/slirp/tcp_input.c
+++ b/slirp/tcp_input.c
@@ -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
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index 76c716f..8ec2729 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 = %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;
 
-- 
2.6.2

  parent reply	other threads:[~2015-12-19 21:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-19 21:24 [Qemu-devel] [PATCHv7 0/9] slirp: Adding IPv6 support to Qemu -net user mode Samuel Thibault
2015-12-19 21:24 ` [Qemu-devel] [PATCH 1/9] slirp: goto bad in udp_input if sosendto fails Samuel Thibault
2015-12-19 21:24   ` [Qemu-devel] [PATCH 2/9] slirp: Generalizing and neutralizing ARP code Samuel Thibault
2015-12-19 21:24   ` [Qemu-devel] [PATCH 3/9] slirp: Adding address family switch for produced frames Samuel Thibault
2015-12-19 21:24   ` [Qemu-devel] [PATCH 4/9] slirp: Make Socket structure IPv6 compatible Samuel Thibault
2015-12-19 21:24   ` [Qemu-devel] [PATCH 5/9] slirp: Factorizing address translation Samuel Thibault
2015-12-19 21:25   ` [Qemu-devel] [PATCH 6/9] slirp: Factorizing and cleaning solookup() Samuel Thibault
2015-12-19 21:25   ` [Qemu-devel] [PATCH 7/9] slirp: Add sockaddr_equal, make solookup family-agnostic Samuel Thibault
2015-12-19 21:25   ` [Qemu-devel] [PATCH 8/9] slirp: Make udp_attach IPv6 compatible Samuel Thibault
2015-12-19 21:25   ` Samuel Thibault [this message]
2015-12-21 15:30 ` [Qemu-devel] [PATCHv7 0/9] slirp: Adding IPv6 support to Qemu -net user mode Eric Blake
2016-01-11 15:04 ` Samuel Thibault
2016-01-12  2:22   ` Hailiang Zhang
2016-01-12  4:04     ` Jason Wang
2016-01-18  8:14       ` Jason Wang
  -- strict thread matches above, loose matches on Subject: below --
2015-12-14 13:49 [Qemu-devel] [PATCHv6 " Samuel Thibault
2015-12-14 13:51 ` [Qemu-devel] [PATCH 1/9] slirp: goto bad in udp_input if sosendto fails Samuel Thibault
2015-12-14 13:51   ` [Qemu-devel] [PATCH 9/9] slirp: Adding family argument to tcp_fconnect() Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450560303-11330-9-git-send-email-samuel.thibault@ens-lyon.org \
    --to=samuel.thibault@ens-lyon.org \
    --cc=arei.gonglei@huawei.com \
    --cc=dgilbert@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=jasowang@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=maethor@subiron.org \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=thuth@redhat.com \
    --cc=v.tolstov@selfip.ru \
    --cc=yanghy@cn.fujitsu.com \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).