From patchwork Tue Jul 16 12:27:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Sutter X-Patchwork-Id: 1961073 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nwl.cc header.i=@nwl.cc header.a=rsa-sha256 header.s=mail2022 header.b=PmhKU1hY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=netfilter-devel+bounces-2999-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WNddd0gvqz1xrK for ; Tue, 16 Jul 2024 22:28:21 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C0BB41F233A2 for ; Tue, 16 Jul 2024 12:28:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FB10199E88; Tue, 16 Jul 2024 12:28:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=nwl.cc header.i=@nwl.cc header.b="PmhKU1hY" X-Original-To: netfilter-devel@vger.kernel.org Received: from orbyte.nwl.cc (orbyte.nwl.cc [151.80.46.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8FB87199233 for ; Tue, 16 Jul 2024 12:28:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=151.80.46.58 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721132894; cv=none; b=Y+lGflYH86VDqu/VFxllqtwven8QsYTYUR2mzh7pKZSNO+8O/XXAmDQxZufqQCC6dQ5ruP7C1nP06J5yeAT4xNSVnNprH+vgrdwrAdqajcLwXMYDJ7Agy/qvTxvSV2xoSozRjfOkGkiVpPG4c/UbE1+a3WeVwa1WVS/FfSeLBnc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721132894; c=relaxed/simple; bh=o21GVZJNW84A5GMBFIbfCSrEzTIt2TryUybmiex1pIk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N39ncnv/29JO1NGM3zNYdcXG19LexjGhw3i0L3USdvpOQkBjKHY4MtZPrDz6BNgBvrTPCplHFaL5TrR+kDhkbdcG5bzdbSrEb12aUF1wSTSwh4Tug9i23kEZnl/jac4Ram8lIbyHZY8fw50d4qI3r1egFhFBb8D7RW6O+qZX6j8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nwl.cc; spf=pass smtp.mailfrom=nwl.cc; dkim=pass (2048-bit key) header.d=nwl.cc header.i=@nwl.cc header.b=PmhKU1hY; arc=none smtp.client-ip=151.80.46.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nwl.cc Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nwl.cc DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nwl.cc; s=mail2022; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=1dLEXydO5CuNrfEL7lgghAkbu8K2fNhpgqpaiTQZXe8=; b=PmhKU1hYeyr6aeb67zlrEQ1bQX kuSN4TjGCZ5QiqhD/zbhUmaiVE5lbH1LojWyXdGYuaVeojJXvxlxKcgBrvs+PvQFTPoVvUE0V9Jcw 9lgWWpoEC0s12p0hw8QeN8Y+8QDTntG/cUq8UdnGZtxI3uCH56ChO680luBH0hyb+zsx/+SG+awfd o5iKfjBSKPURWzlpCOau7FqsjRGd/DbwW2suG9X/PPEs5Qu8fmpvo/5ApE0QMFKdSAn1Dw/cusaUC wfwXV6XRix3B8C9gyV59z4xR00rPJD//AZovAvNZ+ZJ3a8+OnUtIy4ihHg+NVdNNEoSNJwByWY1lo XOyEXyoA==; Received: from localhost ([::1] helo=xic) by orbyte.nwl.cc with esmtp (Exim 4.97.1) (envelope-from ) id 1sThHt-000000007su-0IjM; Tue, 16 Jul 2024 14:28:09 +0200 From: Phil Sutter To: netfilter-devel@vger.kernel.org Cc: Florian Westphal , Pablo Neira Ayuso Subject: [iptables PATCH 2/8] xtables-monitor: Flush stdout after all lines of output Date: Tue, 16 Jul 2024 14:27:59 +0200 Message-ID: <20240716122805.22331-3-phil@nwl.cc> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240716122805.22331-1-phil@nwl.cc> References: <20240716122805.22331-1-phil@nwl.cc> Precedence: bulk X-Mailing-List: netfilter-devel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Writing an xtables-monitor testsuite is pretty much impossible without this due to unreliable output flushing. Just move the fflush() call from trace_cb() to its caller so monitor events benefit from it as well. Fixes: 07af4da52ab30 ("xtables-monitor: fix rule printing") Signed-off-by: Phil Sutter --- iptables/xtables-monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iptables/xtables-monitor.c b/iptables/xtables-monitor.c index cf92355f76f8a..90d1cc5e37f31 100644 --- a/iptables/xtables-monitor.c +++ b/iptables/xtables-monitor.c @@ -544,7 +544,6 @@ static int trace_cb(const struct nlmsghdr *nlh, struct cb_arg *arg) err_free: nftnl_trace_free(nlt); err: - fflush(stdout); return MNL_CB_OK; } @@ -576,6 +575,7 @@ static int monitor_cb(const struct nlmsghdr *nlh, void *data) break; } + fflush(stdout); return ret; }