From patchwork Thu Feb 4 08:31:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 8214821 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 3647EBEEE5 for ; Thu, 4 Feb 2016 08:37:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7BC972037E for ; Thu, 4 Feb 2016 08:37:27 +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 BAB622037C for ; Thu, 4 Feb 2016 08:37:26 +0000 (UTC) Received: from localhost ([::1]:40272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRFPp-0008PA-1o for patchwork-qemu-devel@patchwork.kernel.org; Thu, 04 Feb 2016 03:37:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRFLe-0000Gq-1K for qemu-devel@nongnu.org; Thu, 04 Feb 2016 03:33:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRFLd-00080Z-0s for qemu-devel@nongnu.org; Thu, 04 Feb 2016 03:33:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRFLc-000800-RV for qemu-devel@nongnu.org; Thu, 04 Feb 2016 03:33:04 -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 7DD5AC0A526B; Thu, 4 Feb 2016 08:33:04 +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 u148VnLO022765; Thu, 4 Feb 2016 03:32:59 -0500 From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Thu, 4 Feb 2016 16:31:41 +0800 Message-Id: <1454574706-5681-13-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 12/17] slirp: Make udp_attach IPv6 compatible 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 A unsigned short is now passed in argument to udp_attach instead of using a hardcoded "AF_INET" to call 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/ip_icmp.c | 2 +- slirp/udp.c | 7 ++++--- slirp/udp.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c index 3a29847..592f33a 100644 --- a/slirp/ip_icmp.c +++ b/slirp/ip_icmp.c @@ -162,7 +162,7 @@ icmp_input(struct mbuf *m, int hlen) if (icmp_send(so, m, hlen) == 0) { return; } - if(udp_attach(so) == -1) { + if (udp_attach(so, AF_INET) == -1) { DEBUG_MISC((dfd,"icmp_input udp_attach errno = %d-%s\n", errno,strerror(errno))); sofree(so); diff --git a/slirp/udp.c b/slirp/udp.c index 63776c0..92c48c4 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -169,7 +169,7 @@ udp_input(register struct mbuf *m, int iphlen) if (!so) { goto bad; } - if(udp_attach(so) == -1) { + if (udp_attach(so, AF_INET) == -1) { DEBUG_MISC((dfd," udp_attach errno = %d-%s\n", errno,strerror(errno))); sofree(so); @@ -277,9 +277,10 @@ int udp_output(struct socket *so, struct mbuf *m, } int -udp_attach(struct socket *so) +udp_attach(struct socket *so, unsigned short af) { - if((so->s = qemu_socket(AF_INET,SOCK_DGRAM,0)) != -1) { + so->s = qemu_socket(af, SOCK_DGRAM, 0); + if (so->s != -1) { so->so_expire = curtime + SO_EXPIRE; insque(so, &so->slirp->udb); } diff --git a/slirp/udp.h b/slirp/udp.h index a04b8ce..2f9de38 100644 --- a/slirp/udp.h +++ b/slirp/udp.h @@ -76,7 +76,7 @@ struct mbuf; void udp_init(Slirp *); void udp_cleanup(Slirp *); void udp_input(register struct mbuf *, int); -int udp_attach(struct socket *); +int udp_attach(struct socket *, unsigned short af); void udp_detach(struct socket *); struct socket * udp_listen(Slirp *, uint32_t, u_int, uint32_t, u_int, int);