From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CF19C4360C for ; Sun, 6 Oct 2019 23:57:07 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4056B2077B for ; Sun, 6 Oct 2019 23:57:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4056B2077B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHGOg-0001hC-53 for qemu-devel@archiver.kernel.org; Sun, 06 Oct 2019 19:57:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52408) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHGNN-0000s2-8D for qemu-devel@nongnu.org; Sun, 06 Oct 2019 19:55:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHGNL-0008BE-OA for qemu-devel@nongnu.org; Sun, 06 Oct 2019 19:55:44 -0400 Received: from hera.aquilenet.fr ([185.233.100.1]:54130) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iHGNL-0008As-Hv for qemu-devel@nongnu.org; Sun, 06 Oct 2019 19:55:43 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 507C91E8A; Mon, 7 Oct 2019 01:55:40 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vUduyMCM6u41; Mon, 7 Oct 2019 01:55:39 +0200 (CEST) Received: from function.home (lfbn-bor-1-306-163.w109-215.abo.wanadoo.fr [109.215.28.163]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 3F4831FC5; Mon, 7 Oct 2019 01:55:39 +0200 (CEST) Received: from samy by function.home with local (Exim 4.92.2) (envelope-from ) id 1iHGNG-0008LA-8T; Mon, 07 Oct 2019 01:55:38 +0200 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Subject: [PULL 1/1] slirp: Allow non-local DNS address when restrict is off Date: Mon, 7 Oct 2019 01:55:37 +0200 Message-Id: <20191006235537.32016-2-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006235537.32016-1-samuel.thibault@ens-lyon.org> References: <20191006235537.32016-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Thibault , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This can be used to set a DNS server to be used by the guest which is different from the one configured on the host. Buglink: https://bugs.launchpad.net/qemu/+bug/1010484 Signed-off-by: Samuel Thibault Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- net/slirp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index f42f496641..c4334ee876 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -456,7 +456,7 @@ static int net_slirp_init(NetClientState *peer, const= char *model, error_setg(errp, "Failed to parse DNS"); return -1; } - if ((dns.s_addr & mask.s_addr) !=3D net.s_addr) { + if (restricted && (dns.s_addr & mask.s_addr) !=3D net.s_addr) { error_setg(errp, "DNS doesn't belong to network"); return -1; } @@ -522,7 +522,7 @@ static int net_slirp_init(NetClientState *peer, const= char *model, error_setg(errp, "Failed to parse IPv6 DNS"); return -1; } - if (!in6_equal_net(&ip6_prefix, &ip6_dns, vprefix6_len)) { + if (restricted && !in6_equal_net(&ip6_prefix, &ip6_dns, vprefix6= _len)) { error_setg(errp, "IPv6 DNS doesn't belong to network"); return -1; } --=20 2.23.0