From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7Pap-00006b-3M for qemu-devel@nongnu.org; Fri, 11 Dec 2015 10:26:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a7Pal-0002px-3D for qemu-devel@nongnu.org; Fri, 11 Dec 2015 10:26:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7Pak-0002pt-UR for qemu-devel@nongnu.org; Fri, 11 Dec 2015 10:26:43 -0500 References: <20151211001505.GV2905@var.home> <1449792930-27293-1-git-send-email-samuel.thibault@ens-lyon.org> <1449792930-27293-8-git-send-email-samuel.thibault@ens-lyon.org> From: Thomas Huth Message-ID: <566AEB2C.2030906@redhat.com> Date: Fri, 11 Dec 2015 16:26:36 +0100 MIME-Version: 1.0 In-Reply-To: <1449792930-27293-8-git-send-email-samuel.thibault@ens-lyon.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 08/18] slirp: Adding family argument to tcp_fconnect() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Samuel Thibault , qemu-devel@nongnu.org Cc: zhanghailiang , Li Zhijian , Stefan Hajnoczi , Jason Wang , Dave Gilbert , Vasiliy Tolstov , Huangpeng , Gonglei , Jan Kiszka , Yang Hongyang , Guillaume Subiron On 11/12/15 01:15, Samuel Thibault wrote: > From: Guillaume Subiron > > 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 > Signed-off-by: Samuel Thibault > --- > 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 8c4fa62..079eeb9 100644 > --- a/slirp/tcp_input.c > +++ b/slirp/tcp_input.c > @@ -581,7 +581,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; > Reviewed-by: Thomas Huth