From patchwork Thu Feb 4 08:31:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 8214851 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5A723BEEED for ; Thu, 4 Feb 2016 08:39:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F7B62038A for ; Thu, 4 Feb 2016 08:39:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A0BA020389 for ; Thu, 4 Feb 2016 08:39:14 +0000 (UTC) Received: from localhost ([::1]:40289 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRFRa-0003O6-0R for patchwork-qemu-devel@patchwork.kernel.org; Thu, 04 Feb 2016 03:39:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRFLm-0000Yi-8c for qemu-devel@nongnu.org; Thu, 04 Feb 2016 03:33:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRFLj-00084f-2q for qemu-devel@nongnu.org; Thu, 04 Feb 2016 03:33:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47942) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRFLi-00084Z-SU for qemu-devel@nongnu.org; Thu, 04 Feb 2016 03:33:10 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 857BE341AD4; Thu, 4 Feb 2016 08:33:10 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (vpn1-7-60.pek2.redhat.com [10.72.7.60]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u148VnLP022765; Thu, 4 Feb 2016 03:33:05 -0500 From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Thu, 4 Feb 2016 16:31:42 +0800 Message-Id: <1454574706-5681-14-git-send-email-jasowang@redhat.com> In-Reply-To: <1454574706-5681-1-git-send-email-jasowang@redhat.com> References: <1454574706-5681-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Samuel Thibault , Jason Wang , Guillaume Subiron Subject: [Qemu-devel] [PULL V2 13/17] slirp: Adding family argument to tcp_fconnect() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Guillaume Subiron 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 Signed-off-by: Samuel Thibault Reviewed-by: Thomas Huth Signed-off-by: Jason Wang --- 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 ec0a4c2..239fe29 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -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 *); 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..36e3256 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, 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;