From patchwork Fri Dec 11 00:15:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 555415 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 E0B6F1402A9 for ; Fri, 11 Dec 2015 11:18:37 +1100 (AEDT) Received: from localhost ([::1]:45113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7BPv-00066A-Kk for incoming@patchwork.ozlabs.org; Thu, 10 Dec 2015 19:18:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7BNe-00025G-Pj for qemu-devel@nongnu.org; Thu, 10 Dec 2015 19:16:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a7BNa-0007hL-9t for qemu-devel@nongnu.org; Thu, 10 Dec 2015 19:16:14 -0500 Received: from domu-toccata.ens-lyon.fr ([140.77.166.138]:52739 helo=sonata.ens-lyon.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7BNa-0007hC-2E for qemu-devel@nongnu.org; Thu, 10 Dec 2015 19:16:10 -0500 Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 6A3ED200DE; Fri, 11 Dec 2015 01:16:09 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NxmEvjKrMfDm; Fri, 11 Dec 2015 01:16:09 +0100 (CET) Received: from var.ipv6 (ABordeaux-655-1-21-73.w86-222.abo.wanadoo.fr [86.222.244.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 21785200D3; Fri, 11 Dec 2015 01:16:09 +0100 (CET) Received: from samy by var.ipv6 with local (Exim 4.86) (envelope-from ) id 1a7BMy-00076s-Az; Fri, 11 Dec 2015 01:15:32 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org Date: Fri, 11 Dec 2015 01:15:13 +0100 Message-Id: <1449792930-27293-1-git-send-email-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.6.2 In-Reply-To: <20151211001505.GV2905@var.home> References: <20151211001505.GV2905@var.home> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 140.77.166.138 Cc: Thomas Huth , zhanghailiang , Li Zhijian , Stefan Hajnoczi , Jason Wang , Dave Gilbert , Vasiliy Tolstov , Huangpeng , Gonglei , Jan Kiszka , Samuel Thibault , Yang Hongyang , Guillaume Subiron Subject: [Qemu-devel] [PATCH 01/18] slirp: goto bad in udp_input if sosendto fails 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 From: Guillaume Subiron Before this patch, if sosendto fails, udp_input is executed as if the packet was sent, recording the packet for icmp errors, which does not makes sense since the packet was not actually sent, errors would be related to a previous packet. This patch adds a goto bad to cut the execution of this function. Signed-off-by: Guillaume Subiron Signed-off-by: Samuel Thibault --- slirp/debug.h | 2 +- slirp/udp.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/slirp/debug.h b/slirp/debug.h index 6cfa61e..c60f967 100644 --- a/slirp/debug.h +++ b/slirp/debug.h @@ -5,7 +5,7 @@ * terms and conditions of the copyright. */ -//#define DEBUG 1 +#define DEBUG 1 #ifdef DEBUG diff --git a/slirp/udp.c b/slirp/udp.c index fee13b4..ce63414 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -218,6 +218,7 @@ udp_input(register struct mbuf *m, int iphlen) *ip=save_ip; DEBUG_MISC((dfd,"udp tx errno = %d-%s\n",errno,strerror(errno))); icmp_error(m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno)); + goto bad; } m_free(so->so_m); /* used for ICMP if error on sorecvfrom */