From patchwork Sun Mar 30 22:22:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 335169 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 17A761400B1 for ; Mon, 31 Mar 2014 09:31:21 +1100 (EST) Received: from localhost ([::1]:46082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUOG7-0001oO-3f for incoming@patchwork.ozlabs.org; Sun, 30 Mar 2014 18:31:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUO8n-0006Sj-13 for qemu-devel@nongnu.org; Sun, 30 Mar 2014 18:23:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUO8c-0002a7-Vn for qemu-devel@nongnu.org; Sun, 30 Mar 2014 18:23:44 -0400 Received: from toccata.ens-lyon.org ([140.77.166.68]:40670) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUO8c-0002Zw-P4 for qemu-devel@nongnu.org; Sun, 30 Mar 2014 18:23:34 -0400 Received: from localhost (localhost [127.0.0.1]) by toccata.ens-lyon.org (Postfix) with ESMTP id 2EDCA840AC; Mon, 31 Mar 2014 00:23:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at toccata.ens-lyon.org Received: from toccata.ens-lyon.org ([127.0.0.1]) by localhost (toccata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4XqMZbciOygd; Mon, 31 Mar 2014 00:23:33 +0200 (CEST) Received: from type.wlan.youpi.perso.aquilenet.fr (unknown [80.67.176.89]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by toccata.ens-lyon.org (Postfix) with ESMTPSA id 793FD840B3; Mon, 31 Mar 2014 00:23:25 +0200 (CEST) Received: from samy by type.wlan.youpi.perso.aquilenet.fr with local (Exim 4.82) (envelope-from ) id 1WUO8L-0003ly-D8; Mon, 31 Mar 2014 00:23:17 +0200 From: Samuel Thibault To: qemu-devel@nongnu.org Date: Mon, 31 Mar 2014 00:22:59 +0200 Message-Id: <1396218189-14422-9-git-send-email-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1396218189-14422-1-git-send-email-samuel.thibault@ens-lyon.org> References: <1396218189-14422-1-git-send-email-samuel.thibault@ens-lyon.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 140.77.166.68 Cc: Stefan Hajnoczi , Jan Kiszka , Samuel Thibault , Guillaume Subiron Subject: [Qemu-devel] [PATCH 08/18] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 cd9f2d0..4b66739 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -334,7 +334,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 1b9a0b1..4c72430 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;