Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2194943/?format=api
{ "id": 2194943, "url": "http://patchwork.ozlabs.org/api/patches/2194943/?format=api", "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/20260210092340.646445-3-amusil@redhat.com/", "project": { "id": 68, "url": "http://patchwork.ozlabs.org/api/projects/68/?format=api", "name": "Open Virtual Network development", "link_name": "ovn", "list_id": "ovs-dev.openvswitch.org", "list_email": "ovs-dev@openvswitch.org", "web_url": "http://openvswitch.org/", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260210092340.646445-3-amusil@redhat.com>", "list_archive_url": null, "date": "2026-02-10T09:23:39", "name": "[ovs-dev,v7,2/3] ovn-util: Add helper for parsing and working with masked MACs.", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "52eb6660647b026699a955819c100c828112834c", "submitter": { "id": 83634, "url": "http://patchwork.ozlabs.org/api/people/83634/?format=api", "name": "Ales Musil", "email": "amusil@redhat.com" }, "delegate": { "id": 94943, "url": "http://patchwork.ozlabs.org/api/users/94943/?format=api", "username": "dceara", "first_name": "Dumitru", "last_name": "Ceara", "email": "dceara@redhat.com" }, "mbox": "http://patchwork.ozlabs.org/project/ovn/patch/20260210092340.646445-3-amusil@redhat.com/mbox/", "series": [ { "id": 491630, "url": "http://patchwork.ozlabs.org/api/series/491630/?format=api", "web_url": "http://patchwork.ozlabs.org/project/ovn/list/?series=491630", "date": "2026-02-10T09:23:37", "name": "Add support for VRRPv3 in port security.", "version": 7, "mbox": "http://patchwork.ozlabs.org/series/491630/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2194943/comments/", "check": "warning", "checks": "http://patchwork.ozlabs.org/api/patches/2194943/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<ovs-dev-bounces@openvswitch.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "dev@openvswitch.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "ovs-dev@lists.linuxfoundation.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=jFiTk0ye;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org)", "smtp3.osuosl.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=jFiTk0ye", "smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com", "smtp4.osuosl.org;\n dkim=fail reason=\"signature verification failed\" (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=jFiTk0ye" ], "Received": [ "from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4f9GMy4xt7z1xtr\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 20:23:58 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby smtp3.osuosl.org (Postfix) with ESMTP id 2D00F610DB;\n\tTue, 10 Feb 2026 09:23:54 +0000 (UTC)", "from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id mq1H7uMEOg-a; Tue, 10 Feb 2026 09:23:52 +0000 (UTC)", "from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp3.osuosl.org (Postfix) with ESMTPS id 6DAD0610C2;\n\tTue, 10 Feb 2026 09:23:52 +0000 (UTC)", "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 3CD99C077F;\n\tTue, 10 Feb 2026 09:23:52 +0000 (UTC)", "from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 2BAB6C077E\n for <dev@openvswitch.org>; Tue, 10 Feb 2026 09:23:50 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n by smtp4.osuosl.org (Postfix) with ESMTP id 2139840D66\n for <dev@openvswitch.org>; Tue, 10 Feb 2026 09:23:50 +0000 (UTC)", "from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id U8TL2_VEzvU0 for <dev@openvswitch.org>;\n Tue, 10 Feb 2026 09:23:49 +0000 (UTC)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by smtp4.osuosl.org (Postfix) with ESMTPS id 0643B40D62\n for <dev@openvswitch.org>; Tue, 10 Feb 2026 09:23:48 +0000 (UTC)", "from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-678-cTe871-6OwSRa8DYNsTfkw-1; Tue,\n 10 Feb 2026 04:23:46 -0500", "from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id B67741800454\n for <dev@openvswitch.org>; Tue, 10 Feb 2026 09:23:45 +0000 (UTC)", "from amusil.brq.redhat.com (unknown [10.43.17.233])\n by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 64ECD19560A3; Tue, 10 Feb 2026 09:23:44 +0000 (UTC)" ], "X-Virus-Scanned": [ "amavis at osuosl.org", "amavis at osuosl.org" ], "X-Comment": "SPF check N/A for local connections -\n client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN> ", "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6DAD0610C2", "OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0643B40D62" ], "Received-SPF": "Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124;\n helo=us-smtp-delivery-124.mimecast.com; envelope-from=amusil@redhat.com;\n receiver=<UNKNOWN>", "DMARC-Filter": "OpenDMARC Filter v1.4.2 smtp4.osuosl.org 0643B40D62", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1770715427;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=ju1Ccifq1TDve2rRuJ12rivMkEqcFIu8fy/3jiRoyBA=;\n b=jFiTk0yecotD0TCPE4KwnLvDCbszf5qO4FRt6e/BbA+1e898ZqvaRoXFuYtMv266DGuHIY\n w3sbDqMOhW8/6VykigkWk4j75Ru4dBivCSATNoWP+nrqw/7kziphdlFUzZ3F3ncO5K6viE\n GCAg3t3HXvPJuhyfGF1yhFnksoeCWII=", "X-MC-Unique": "cTe871-6OwSRa8DYNsTfkw-1", "X-Mimecast-MFC-AGG-ID": "cTe871-6OwSRa8DYNsTfkw_1770715425", "To": "dev@openvswitch.org", "Date": "Tue, 10 Feb 2026 10:23:39 +0100", "Message-ID": "<20260210092340.646445-3-amusil@redhat.com>", "In-Reply-To": "<20260210092340.646445-1-amusil@redhat.com>", "References": "<20260210092340.646445-1-amusil@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.12", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "OrRaKUMrjKpV8F7JPfAFGO2UzQzaGV53tmtyQ_4o66U_1770715425", "X-Mimecast-Originator": "redhat.com", "Subject": "[ovs-dev] [PATCH ovn v7 2/3] ovn-util: Add helper for parsing and\n working with masked MACs.", "X-BeenThere": "ovs-dev@openvswitch.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "<ovs-dev.openvswitch.org>", "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>", "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>", "List-Post": "<mailto:ovs-dev@openvswitch.org>", "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>", "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>", "From": "Ales Musil via dev <ovs-dev@openvswitch.org>", "Reply-To": "Ales Musil <amusil@redhat.com>", "Cc": "Dumitru Ceara <dceara@redhat.com>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "ovs-dev-bounces@openvswitch.org", "Sender": "\"dev\" <ovs-dev-bounces@openvswitch.org>" }, "content": "Add helpers for parsing masked MAC in format of MAC/MAC and\nMAC/prefix. In additions to utils that convert MAC into prefix\nlen and in reverse, creating MAC mask from prefix len. This\nwill be used for the extended port_security parsing.\n\nAcked-by: Dumitru Ceara <dceara@redhat.com>\nAcked-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>\nSigned-off-by: Ales Musil <amusil@redhat.com>\n---\nv4: Rebase on top of latest main.\nv5: Rebase on top of latest main.\n Add Dumitru's ack.\n Add Lorenzo's ack.\nv6: Rebase on top of latest main.\nv7: Rebase on top of latest main.\n---\n lib/ovn-util.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++\n lib/ovn-util.h | 18 ++++++++++++++++++\n tests/ovn.at | 49 ++++++++++++++++++++++++++++++++++++++++++++++++\n tests/test-ovn.c | 22 ++++++++++++++++++++++\n 4 files changed, 138 insertions(+)", "diff": "diff --git a/lib/ovn-util.c b/lib/ovn-util.c\nindex 8a065e3c2..46b837c02 100644\n--- a/lib/ovn-util.c\n+++ b/lib/ovn-util.c\n@@ -1762,3 +1762,52 @@ shuffled_range(size_t n)\n \n return indices;\n }\n+\n+/* Parses string 's', which must be a MAC address with an optional mask or\n+ * mask prefix length. Stores the MAC address into '*ea' and the mask prefix\n+ * length into '*len' (if 's' does not contain a mask, all-one-bits\n+ * is assumed).\n+ *\n+ * Returns true if successful, otherwise false and the '*ea' is zeroed out in\n+ * case. */\n+bool\n+eth_addr_parse_masked(const char *s, struct eth_addr *ea, unsigned int *plen)\n+{\n+ int n = 0;\n+\n+ if (!ovs_scan_len(s, &n, ETH_ADDR_SCAN_FMT, ETH_ADDR_SCAN_ARGS(*ea))) {\n+ *ea = eth_addr_zero;\n+ return false;\n+ }\n+\n+ /* There isn't any mask provided. */\n+ if (s[n] != '/') {\n+ *plen = 48;\n+ return true;\n+ }\n+\n+ struct eth_addr mask;\n+ if (ovs_scan_len(s, &n, \"/\"ETH_ADDR_SCAN_FMT, ETH_ADDR_SCAN_ARGS(mask))) {\n+ int prefix = eth_addr_get_prefix_len(mask);\n+ if (!eth_addr_equals(mask, eth_addr_create_mask(prefix))) {\n+ *ea = eth_addr_zero;\n+ return false;\n+ }\n+\n+ *plen = prefix;\n+ return true;\n+ }\n+\n+ int prefix;\n+ if (ovs_scan_len(s, &n, \"/%d\", &prefix)) {\n+ if (prefix < 0 || prefix > 48) {\n+ *ea = eth_addr_zero;\n+ return false;\n+ }\n+ *plen = prefix;\n+ return true;\n+ }\n+\n+ *ea = eth_addr_zero;\n+ return false;\n+}\ndiff --git a/lib/ovn-util.h b/lib/ovn-util.h\nindex 0ba0d1c26..402a7b155 100644\n--- a/lib/ovn-util.h\n+++ b/lib/ovn-util.h\n@@ -672,6 +672,24 @@ is_uuid_with_prefix(const char *uuid)\n return uuid[0] == '0' && (uuid[1] == 'x' || uuid[1] == 'X');\n }\n \n+static inline struct eth_addr\n+eth_addr_create_mask(unsigned int len)\n+{\n+ struct eth_addr mac;\n+ eth_addr_from_uint64((UINT64_MAX << (48 - len)), &mac);\n+\n+ return mac;\n+}\n+\n+static inline unsigned int\n+eth_addr_get_prefix_len(struct eth_addr mac)\n+{\n+ uint64_t n = (UINT64_C(0xffff) << 48) | eth_addr_to_uint64(mac);\n+ return 48 - ctz64(n);\n+}\n+\n+bool eth_addr_parse_masked(const char *, struct eth_addr *, unsigned int *);\n+\n bool is_partial_uuid_match(const struct uuid *uuid, const char *match);\n \n /* Utilities around properly handling exit command. */\ndiff --git a/tests/ovn.at b/tests/ovn.at\nindex 6a4efef97..8fa5a54fd 100644\n--- a/tests/ovn.at\n+++ b/tests/ovn.at\n@@ -2443,6 +2443,55 @@ check ovstest test-sparse-array add\n check ovstest test-sparse-array remove-replace\n AT_CLEANUP\n \n+AT_SETUP([Parse MAC])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:xx], [1])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06], [0], [dnl\n+01:02:03:04:05:06/ff:ff:ff:ff:ff:ff 01:02:03:04:05:06/48\n+])\n+\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/-1], [1])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/-40], [1])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/49], [1])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/128], [1])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/48], [0], [dnl\n+01:02:03:04:05:06/ff:ff:ff:ff:ff:ff 01:02:03:04:05:06/48\n+])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/40], [0], [dnl\n+01:02:03:04:05:06/ff:ff:ff:ff:ff:00 01:02:03:04:05:06/40\n+])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:00/40], [0], [dnl\n+01:02:03:04:05:00/ff:ff:ff:ff:ff:00 01:02:03:04:05:00/40\n+])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/25], [0], [dnl\n+01:02:03:04:05:06/ff:ff:ff:80:00:00 01:02:03:04:05:06/25\n+])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:00:00:00/25], [0], [dnl\n+01:02:03:00:00:00/ff:ff:ff:80:00:00 01:02:03:00:00:00/25\n+])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/0], [0], [dnl\n+01:02:03:04:05:06/00:00:00:00:00:00 01:02:03:04:05:06/0\n+])\n+\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/ff:ff:ff:ff:ff:xx], [1])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/ff:ff:ff:ff:0f:00], [1])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/01:02:03:04:05:00], [1])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/ff:ff:ff:ff:ff:00], [0], [dnl\n+01:02:03:04:05:06/ff:ff:ff:ff:ff:00 01:02:03:04:05:06/40\n+])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/ff:ff:ff:ff:00:00], [0], [dnl\n+01:02:03:04:05:06/ff:ff:ff:ff:00:00 01:02:03:04:05:06/32\n+])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/ff:ff:ff:00:00:00], [0], [dnl\n+01:02:03:04:05:06/ff:ff:ff:00:00:00 01:02:03:04:05:06/24\n+])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/ff:ff:ff:ff:ff:f0], [0], [dnl\n+01:02:03:04:05:06/ff:ff:ff:ff:ff:f0 01:02:03:04:05:06/44\n+])\n+AT_CHECK([ovstest test-ovn parse-eth-addr 01:02:03:04:05:06/00:00:00:00:00:00], [0], [dnl\n+01:02:03:04:05:06/00:00:00:00:00:00 01:02:03:04:05:06/0\n+])\n+AT_CLEANUP\n+\n AT_BANNER([OVN end-to-end tests])\n \n OVN_FOR_EACH_NORTHD([\ndiff --git a/tests/test-ovn.c b/tests/test-ovn.c\nindex e88d3d45e..f35bd980c 100644\n--- a/tests/test-ovn.c\n+++ b/tests/test-ovn.c\n@@ -1474,6 +1474,22 @@ test_parse_actions(struct ovs_cmdl_context *ctx OVS_UNUSED)\n flow_collector_ids_destroy(&collector_ids);\n exit(ok ? EXIT_SUCCESS : EXIT_FAILURE);\n }\n+\n+static void\n+test_parse_eth_addr(struct ovs_cmdl_context *ctx)\n+{\n+ unsigned int plen;\n+ struct eth_addr mac;\n+\n+ if (!eth_addr_parse_masked(ctx->argv[1], &mac, &plen)) {\n+ ovs_assert(eth_addr_equals(mac, eth_addr_zero));\n+ exit(EXIT_FAILURE);\n+ }\n+\n+ printf(ETH_ADDR_FMT \"/\" ETH_ADDR_FMT \" \" ETH_ADDR_FMT \"/%u\\n\",\n+ ETH_ADDR_ARGS(mac), ETH_ADDR_ARGS(eth_addr_create_mask(plen)),\n+ ETH_ADDR_ARGS(mac), plen);\n+}\n \f\n static unsigned int\n parse_relops(const char *s)\n@@ -1560,6 +1576,9 @@ exhaustive N\\n\\\n parse-actions\\n\\\n Parses OVN actions from stdin and prints the equivalent OpenFlow actions\\n\\\n on stdout.\\n\\\n+parse-eth-addr\\n\\\n+ Parses masked MAC address from stdin and prints the equivalent MAC/plen \\n\\\n+ and MAC/mask to stdout\\n\\\n \",\n program_name, program_name);\n exit(EXIT_SUCCESS);\n@@ -1685,6 +1704,9 @@ test_ovn_main(int argc, char *argv[])\n /* Actions. */\n {\"parse-actions\", NULL, 0, 0, test_parse_actions, OVS_RO},\n \n+ /* Utils. */\n+ {\"parse-eth-addr\", NULL, 1, 1, test_parse_eth_addr, OVS_RO},\n+\n {NULL, NULL, 0, 0, NULL, OVS_RO},\n };\n struct ovs_cmdl_context ctx;\n", "prefixes": [ "ovs-dev", "v7", "2/3" ] }