From nobody Thu May 9 00:02:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1664472398; cv=none; d=zohomail.com; s=zohoarc; b=kzRdWKO/ebahQHJTeXQdXRFlu3lpsZ3FubYiZVH8igKo260Cwon/tlBljc9DCkN3pWiGltcxfnR3MgvwfkDUETTKb7WodyPUnZvzQt4Ds5zhB0vq/MG07+I4fS+GCis6qwjKZX+eirEPdEpvUzmQs7OYhkrNgF4MwDZyqsKm5ck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664472398; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=pexMPmz3ERSDHT4uSVabYUPGRBus7DhQh4pqhnYYf8E=; b=IzssevhhO5654cBe+4OjU/3PSUD1P0YjNt0jPuBi1KsrtjoAGQYrK3bXHCnuNpc6+xoxHBOVIQV5W0K97GOqLH6uAmbC1WCFbUPOplhLw9WRkwprPLLk1Mj32qM58hH6aujTeT3I9M5L8rhsPo2i0sF2mD10cGbfpuvI0UJf6Fs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664472398915894.0197468776521; Thu, 29 Sep 2022 10:26:38 -0700 (PDT) Received: from localhost ([::1]:35180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odxIz-0003Tc-RA for importer@patchew.org; Thu, 29 Sep 2022 13:26:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odwSs-0006SW-Di for qemu-devel@nongnu.org; Thu, 29 Sep 2022 12:32:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38864) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odwSp-0003Mi-93 for qemu-devel@nongnu.org; Thu, 29 Sep 2022 12:32:44 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-626-CNRfL-XhM32Zme2IkKqScg-1; Thu, 29 Sep 2022 12:32:41 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B6FED299E779; Thu, 29 Sep 2022 16:32:40 +0000 (UTC) Received: from localhost (unknown [10.39.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F1821731B; Thu, 29 Sep 2022 16:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664469162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pexMPmz3ERSDHT4uSVabYUPGRBus7DhQh4pqhnYYf8E=; b=S097JSPh0ikjo+eUxTYC7YfcRlSckhTYlxrB9c3lI5VioAFRiUNX8uf2G+JcubSYCRnimy /lsyBQsdGJqqT6uX2tyFgVJ9cW7AAJ7V8442AWFgXfrOiQa/YgKE4FG5DJ6w9HJu3e+tP4 qG7KO6+dbFfuMmFoGYnT01oe7ag791c= X-MC-Unique: CNRfL-XhM32Zme2IkKqScg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: jb-gnumlists@wisemo.com, thuth@redhat.com, jasowang@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH] net: print a more actionable error when slirp is not found Date: Thu, 29 Sep 2022 20:32:37 +0400 Message-Id: <20220929163237.1417215-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.08, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1664472401031100001 From: Marc-Andr=C3=A9 Lureau If slirp is not found during compile-time, and not manually disabled, print a friendly error message, as suggested in the "If your networking is failing after updating to the latest git version of QEMU..." thread by various people. Signed-off-by: Marc-Andr=C3=A9 Lureau --- meson.build | 4 ++++ net/net.c | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 8dc661363f..4f69d7d0b4 100644 --- a/meson.build +++ b/meson.build @@ -657,6 +657,10 @@ if not get_option('slirp').auto() or have_system endif endif =20 +if get_option('slirp').disabled() + config_host_data.set('CONFIG_SLIRP_DISABLED', true) +endif + vde =3D not_found if not get_option('vde').auto() or have_system or have_tools vde =3D cc.find_library('vdeplug', has_headers: ['libvdeplug.h'], diff --git a/net/net.c b/net/net.c index 2db160e063..e6072a5ddd 100644 --- a/net/net.c +++ b/net/net.c @@ -990,14 +990,29 @@ static int net_init_nic(const Netdev *netdev, const c= har *name, return idx; } =20 +#if (defined(CONFIG_SLIRP) || !defined(CONFIG_SLIRP_DISABLED)) +static int net_init_user(const Netdev *netdev, const char *name, + NetClientState *peer, Error **errp) +{ +#ifdef CONFIG_SLIRP + return net_init_slirp(netdev, name, peer, errp); +#else + error_setg(errp, + "Type 'user' is not a supported netdev backend by this QEMU= build " + "because the libslirp development files were not found duri= ng build " + "of QEMU."); +#endif + return -1; +} +#endif =20 static int (* const net_client_init_fun[NET_CLIENT_DRIVER__MAX])( const Netdev *netdev, const char *name, NetClientState *peer, Error **errp) =3D { [NET_CLIENT_DRIVER_NIC] =3D net_init_nic, -#ifdef CONFIG_SLIRP - [NET_CLIENT_DRIVER_USER] =3D net_init_slirp, +#if (defined(CONFIG_SLIRP) || !defined(CONFIG_SLIRP_DISABLED)) + [NET_CLIENT_DRIVER_USER] =3D net_init_user, #endif [NET_CLIENT_DRIVER_TAP] =3D net_init_tap, [NET_CLIENT_DRIVER_SOCKET] =3D net_init_socket, --=20 2.37.3