From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id B4B415A0082 for ; Wed, 8 Feb 2023 18:48:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675878522; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sZfdGU/G06P54rCZP6LUU2Yz7YzS8Rfms1+UNl/34GU=; b=JLOGNJNeFXnbdrSDKoWPIiacq1HMup+im6puxY7TJNLMet9zqJ3QDD/5XvxkEh4wDFuV3C ZozrdQl/8cVWt4FTop3w/TXJ1jaD+TvR39HflQU58wu7obkVI+X1u0yGfrLQ4jr58ZYWYF f7V/YWoUMN1Ykh+XgyL450MhkxapQF8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-83-VGMlJI0-Oa-NIj1DoWRDug-1; Wed, 08 Feb 2023 12:48:39 -0500 X-MC-Unique: VGMlJI0-Oa-NIj1DoWRDug-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 26A5785A588; Wed, 8 Feb 2023 17:48:39 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.2.17.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 064022166B2B; Wed, 8 Feb 2023 17:48:38 +0000 (UTC) From: Laine Stump To: passt-dev@passt.top, laine@laine.org Subject: [PATCH v2 0/9] error logging fixes Date: Wed, 8 Feb 2023 12:48:29 -0500 Message-Id: <20230208174838.1680517-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-ID-Hash: 6RSSMXLLGSFY5FKFVEECCBJ5QX46W26I X-Message-ID-Hash: 6RSSMXLLGSFY5FKFVEECCBJ5QX46W26I X-MailFrom: laine@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: There are two topics covered here: 1) If a logFile is set, passt's behavior has been to send all error messages there, and *not* to stderr. This makes it difficult for another program that is exec'ing passt (and setting it to log to a file) to report useful error messages when passt fails. The first patch makes a simple change to the logging functions that checks a global bool that is set true after all initialization is completed. 2) All the rest of the patches eliminate use of the blanket usage() function when a commandline error is encountered (and add in specific/details error messages when previously usage() was all that was logged). Laine Stump (9): log to stderr until process is daemonized, even if a logfile is set add errexit() to log an error message and exit with a single call eliminate most calls to usage() in conf() make conf_ports() exit immediately after logging error make conf_pasta_ns() exit immediately after logging error make conf_ugid() exit immediately after logging error make conf_netns_opt() exit immediately after logging error log a detailed error (not usage()) when there are extra non-option arguments convert all remaining err() followed by exit() to errexit() conf.c | 471 ++++++++++++++++++++-------------------------------- isolation.c | 78 ++++----- log.c | 33 ++-- log.h | 2 + netlink.c | 3 +- passt.c | 18 +- pasta.c | 21 +-- tap.c | 30 ++-- 8 files changed, 258 insertions(+), 398 deletions(-) -- 2.39.1