get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2195507/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2195507,
    "url": "http://patchwork.ozlabs.org/api/patches/2195507/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/20260211093707.846789-2-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": "<20260211093707.846789-2-amusil@redhat.com>",
    "list_archive_url": null,
    "date": "2026-02-11T09:37:06",
    "name": "[ovs-dev,v8,1/2] ovn-util: Add helper for parsing and working with masked MACs.",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "8bb17e3aa66bde2159b97d0e1ee1195cf6504cc4",
    "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/20260211093707.846789-2-amusil@redhat.com/mbox/",
    "series": [
        {
            "id": 491803,
            "url": "http://patchwork.ozlabs.org/api/series/491803/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/ovn/list/?series=491803",
            "date": "2026-02-11T09:37:05",
            "name": "Add support for VRRPv3 in port security.",
            "version": 8,
            "mbox": "http://patchwork.ozlabs.org/series/491803/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2195507/comments/",
    "check": "warning",
    "checks": "http://patchwork.ozlabs.org/api/patches/2195507/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=JEF+11G1;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org)",
            "smtp2.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=JEF+11G1",
            "smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com",
            "smtp1.osuosl.org;\n dkim=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=JEF+11G1"
        ],
        "Received": [
            "from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133])\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 4f9tcz1mxCz1xvb\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 11 Feb 2026 20:37:22 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp2.osuosl.org (Postfix) with ESMTP id 38FBC40905;\n\tWed, 11 Feb 2026 09:37:21 +0000 (UTC)",
            "from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id mszjdMHQlspe; Wed, 11 Feb 2026 09:37:19 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])\n\tby smtp2.osuosl.org (Postfix) with ESMTPS id B9884408B3;\n\tWed, 11 Feb 2026 09:37:19 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 6EE81C0782;\n\tWed, 11 Feb 2026 09:37:19 +0000 (UTC)",
            "from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 829FEC077E\n for <dev@openvswitch.org>; Wed, 11 Feb 2026 09:37:18 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp1.osuosl.org (Postfix) with ESMTP id 6192183506\n for <dev@openvswitch.org>; Wed, 11 Feb 2026 09:37:18 +0000 (UTC)",
            "from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id zqeLXNh_r_L3 for <dev@openvswitch.org>;\n Wed, 11 Feb 2026 09:37:16 +0000 (UTC)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by smtp1.osuosl.org (Postfix) with ESMTPS id A60B4834E1\n for <dev@openvswitch.org>; Wed, 11 Feb 2026 09:37:16 +0000 (UTC)",
            "from mx-prod-mc-06.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-610-gM-of6QUMW--NA-G4Dzmbg-1; Wed,\n 11 Feb 2026 04:37:13 -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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id C15CB18005AD; Wed, 11 Feb 2026 09:37:12 +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 167E519560A3; Wed, 11 Feb 2026 09:37:10 +0000 (UTC)"
        ],
        "X-Virus-Scanned": [
            "amavis at osuosl.org",
            "amavis at osuosl.org"
        ],
        "X-Comment": "SPF check N/A for local connections - client-ip=140.211.9.56;\n helo=lists.linuxfoundation.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN> ",
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 smtp2.osuosl.org B9884408B3",
            "OpenDKIM Filter v2.11.0 smtp1.osuosl.org A60B4834E1"
        ],
        "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 smtp1.osuosl.org A60B4834E1",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1770802635;\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=c0vuNaZhC3sAnBkbzKp0pJLroBeUE9hN2C/1bSluaAc=;\n b=JEF+11G1NmGJ8Z8Y7v64et2qw0OCNmxeL16OsWAfMHfwhuxhiJUtwNSrXE/GhQMiIxLZ4T\n R/sXuHMdJqYVgF//TIEH5OybnGGvqATjCbQduSdoeIVrls2JYuaSpPPcvjIK81OMWoR2+L\n EMnp3DDP7vpYqcdwuY3j5djLolj+I6Y=",
        "X-MC-Unique": "gM-of6QUMW--NA-G4Dzmbg-1",
        "X-Mimecast-MFC-AGG-ID": "gM-of6QUMW--NA-G4Dzmbg_1770802632",
        "To": "dev@openvswitch.org",
        "Date": "Wed, 11 Feb 2026 10:37:06 +0100",
        "Message-ID": "<20260211093707.846789-2-amusil@redhat.com>",
        "In-Reply-To": "<20260211093707.846789-1-amusil@redhat.com>",
        "References": "<20260211093707.846789-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": "sF5YGyG3xeiRcx8dw2XzIBEHZY62iGzX6QwFY_NP6kE_1770802632",
        "X-Mimecast-Originator": "redhat.com",
        "Subject": "[ovs-dev] [PATCH ovn v8 1/2] 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": "i.maximets@ovn.org, 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.\nv8: Rebase on top of latest main.\n    Address small nit from Dumitru.\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 802e6d0da..c2d113f8e 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..3c89eeba0 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",
        "v8",
        "1/2"
    ]
}