From patchwork Mon Mar 25 17:48:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Michelson X-Patchwork-Id: 1915778 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" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cPe9s78x; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V3L5M1Bl4z1yY2 for ; Tue, 26 Mar 2024 04:48:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0841B40281; Mon, 25 Mar 2024 17:48:37 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id SNcsIRHMy91P; Mon, 25 Mar 2024 17:48:35 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 8BF754023E Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cPe9s78x Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 8BF754023E; Mon, 25 Mar 2024 17:48:35 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5A69CC0077; Mon, 25 Mar 2024 17:48:35 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4C977C0037 for ; Mon, 25 Mar 2024 17:48:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 49B38605D9 for ; Mon, 25 Mar 2024 17:48:34 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id hnKtQPmUNsp2 for ; Mon, 25 Mar 2024 17:48:33 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=mmichels@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org DDA17605C2 Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org DDA17605C2 Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cPe9s78x Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id DDA17605C2 for ; Mon, 25 Mar 2024 17:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711388911; 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=iLU/yXCOjipIiqAxomEV8SrcUr0eJAmLKgM4VSpZuJ8=; b=cPe9s78xLOKqzwGkL69LdngvCHsjWuQub71Oe/L84yMf641p7FFoPeHfniC1secY7nW9Js syGHEUfJ31cFb/5hRuwQ9oL/sDOwDF8eYqsMrIJ4P/Nfg1M2aK/43DjJlUGEK58dKfJz4m OQkwuREVHIxQBq9E5K5+56IGQMBpxGs= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-531-YsqwH96INDOyKT2If__nWQ-1; Mon, 25 Mar 2024 13:48:29 -0400 X-MC-Unique: YsqwH96INDOyKT2If__nWQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7E5C73C0ED47 for ; Mon, 25 Mar 2024 17:48:29 +0000 (UTC) Received: from localhost.redhat.com (ovpn-0-15.rdu2.redhat.com [10.22.0.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C5FD492BD3 for ; Mon, 25 Mar 2024 17:48:29 +0000 (UTC) From: Mark Michelson To: dev@openvswitch.org Date: Mon, 25 Mar 2024 13:48:24 -0400 Message-ID: <20240325174828.530932-1-mmichels@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v2] acl-log: Properly log the "pass" verdict. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The "pass" verdict was not explicitly defined in the list of verdicts for ACL logging. This resulted in logs saying "Syntax error at `pass' unknown verdict." This change adds the "pass" verdict explicitly so that it shows up as a proper log in ovn-controller. Reported-at: https://issues.redhat.com/browse/FDP-442 Signed-off-by: Mark Michelson Acked-by: Ales Musil --- lib/acl-log.c | 4 +++- lib/acl-log.h | 1 + lib/actions.c | 2 ++ tests/ovn.at | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/acl-log.c b/lib/acl-log.c index 9530dd763..b3eb4bbd0 100644 --- a/lib/acl-log.c +++ b/lib/acl-log.c @@ -34,7 +34,9 @@ log_verdict_to_string(uint8_t verdict) return "drop"; } else if (verdict == LOG_VERDICT_REJECT) { return "reject"; - } else { + } else if (verdict == LOG_VERDICT_PASS) { + return "pass"; + } else { return ""; } } diff --git a/lib/acl-log.h b/lib/acl-log.h index da7fa2f02..3973a8e0b 100644 --- a/lib/acl-log.h +++ b/lib/acl-log.h @@ -33,6 +33,7 @@ enum log_verdict { LOG_VERDICT_ALLOW, LOG_VERDICT_DROP, LOG_VERDICT_REJECT, + LOG_VERDICT_PASS, LOG_VERDICT_UNKNOWN = UINT8_MAX }; diff --git a/lib/actions.c b/lib/actions.c index 71615fc53..29584a189 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -3596,6 +3596,8 @@ parse_log_arg(struct action_context *ctx, struct ovnact_log *log) log->verdict = LOG_VERDICT_REJECT; } else if (lexer_match_id(ctx->lexer, "allow")) { log->verdict = LOG_VERDICT_ALLOW; + } else if (lexer_match_id(ctx->lexer, "pass")) { + log->verdict = LOG_VERDICT_PASS; } else { lexer_syntax_error(ctx->lexer, "unknown verdict"); return; diff --git a/tests/ovn.at b/tests/ovn.at index 4d0c7ad53..f272749aa 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -1847,6 +1847,9 @@ log(name="test1", verdict=drop, severity=info, meter="meter1"); log(verdict=drop); formats as log(verdict=drop, severity=info); encodes as controller(userdata=00.00.00.07.00.00.00.00.01.06) +log(verdict=pass); + formats as log(verdict=pass, severity=info); + encodes as controller(userdata=00.00.00.07.00.00.00.00.03.06) log(verdict=bad_verdict, severity=info); Syntax error at `bad_verdict' unknown verdict. log(verdict=drop, severity=bad_severity);