get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 132268,
    "url": "http://patches.dpdk.org/api/patches/132268/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231002183730.301163-3-stephen@networkplumber.org/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20231002183730.301163-3-stephen@networkplumber.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231002183730.301163-3-stephen@networkplumber.org",
    "date": "2023-10-02T18:37:29",
    "name": "[v2,2/3] rte_ether_unformat: accept more inputs",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d2c882b80b08cef0d7e17f3d9d8d806b067ae47d",
    "submitter": {
        "id": 27,
        "url": "http://patches.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20231002183730.301163-3-stephen@networkplumber.org/mbox/",
    "series": [
        {
            "id": 29717,
            "url": "http://patches.dpdk.org/api/series/29717/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29717",
            "date": "2023-10-02T18:37:27",
            "name": "rte_ether_unformat_addr changes",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/29717/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/132268/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/132268/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 6E5B4426A5;\n\tMon,  2 Oct 2023 20:37:55 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 59392402E6;\n\tMon,  2 Oct 2023 20:37:46 +0200 (CEST)",
            "from mail-pl1-f172.google.com (mail-pl1-f172.google.com\n [209.85.214.172])\n by mails.dpdk.org (Postfix) with ESMTP id 0BC5E40262\n for <dev@dpdk.org>; Mon,  2 Oct 2023 20:37:44 +0200 (CEST)",
            "by mail-pl1-f172.google.com with SMTP id\n d9443c01a7336-1c60a514f3aso821125ad.3\n for <dev@dpdk.org>; Mon, 02 Oct 2023 11:37:43 -0700 (PDT)",
            "from hermes.local (204-195-126-68.wavecable.com. [204.195.126.68])\n by smtp.gmail.com with ESMTPSA id\n iz7-20020a170902ef8700b001b9f7bc3e77sm12546595plb.189.2023.10.02.11.37.42\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 02 Oct 2023 11:37:42 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1696271863;\n x=1696876663; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=QgzAUgb634wFXn1aAuxin4P9Z47Vd+GEEggy/N4IhWE=;\n b=jfbgTg/iA4FPfJVNi+fP1OQi7E1drPCFWfYIquDvclM78NX2hG0o+v/ICcJy6mE+04\n oxbMLXK8bPmSIxJ+hQpMucp42A2F+2sJw4Y/tWgzRs6P/C91KO/RbdSGsgvvqeJz22Xo\n JzUCIF6dvSIOVGu+pP+ZLxuXmIMegMit85G9/oOcxkWJ/DX0qR7US2gopkF9AftvdSF7\n oo8o6iEApn91tNb/NdVjcozYj3QlbH3/BFwUfGRd7Ogq6OX4RCuEi4JbiCbfOhPN5cL7\n w7Nw7CmAsCd3tpmvRUEAaeNyEQPWoOeccdd2HaLhoS3SF8zV58D2bxLCFSMEB0q7bJEd\n Xs9A==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1696271863; x=1696876663;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=QgzAUgb634wFXn1aAuxin4P9Z47Vd+GEEggy/N4IhWE=;\n b=sNw+iA0Jnf+QvDsmF1Y0MShNReVzdzlpL8+mOstdjYcshQTIGOO4bW1gPMMxHfjaLE\n aYTXqNJm5tQEejh23BeWWFp6DssvLToY55LbeJAy0zxtIB49LHugI8CmUjvrn5vgDkF3\n fAKJE4+0vbbXL3DKDf8qKsffhHV6CbFrEXaO96AvG0lVX9O6sz4cq890H+q+MjRJTkjR\n x8BvgHjpWKXMUvwWW6VJA3+bRjPKTY8waFcQmHfgxQ0m/gIbMU0kxF15BWD8SNMs8/AA\n PHXXckSGzV03lKIPB5pxBracMxoAATvXsV7Y/LiT895hbnD66Hf3B/4Q3gBxKDgwhgfo\n Nbiw==",
        "X-Gm-Message-State": "AOJu0YwqH2HSyAz0cGPIqoevbyQdW+TFcLruThkXXYXSA1DlEwB3o/P9\n oHHBoe9rwQvVJ+TIxTZQ/hSMAGgas1UeFloiUFs=",
        "X-Google-Smtp-Source": "\n AGHT+IEe6+4Ol3g56LCp7oxLah5PIpUS2/7gEd0hQODi7K1v1EORy1CQMGAow5mREcFudMC+JI2Srw==",
        "X-Received": "by 2002:a17:903:26c6:b0:1b8:66f6:87a3 with SMTP id\n jg6-20020a17090326c600b001b866f687a3mr11146073plb.52.1696271862881;\n Mon, 02 Oct 2023 11:37:42 -0700 (PDT)",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "To": "dev@dpdk.org",
        "Cc": "Stephen Hemminger <stephen@networkplumber.org>",
        "Subject": "[PATCH v2 2/3] rte_ether_unformat: accept more inputs",
        "Date": "Mon,  2 Oct 2023 11:37:29 -0700",
        "Message-Id": "<20231002183730.301163-3-stephen@networkplumber.org>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20231002183730.301163-1-stephen@networkplumber.org>",
        "References": "<20230929163611.62691-1-stephen@networkplumber.org>\n <20231002183730.301163-1-stephen@networkplumber.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "This updates rte_ether_addr_unformat() to accept more types\nformats for MAC address. It allows IEEE, IETF and Cisco\nformats with leading zeros as well.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\n lib/net/rte_ether.c | 87 ++++++++++++++++++++++++++++++++++-----------\n lib/net/rte_ether.h |  9 +++--\n 2 files changed, 74 insertions(+), 22 deletions(-)",
    "diff": "diff --git a/lib/net/rte_ether.c b/lib/net/rte_ether.c\nindex 66d9a9d0699a..de3f456207e8 100644\n--- a/lib/net/rte_ether.c\n+++ b/lib/net/rte_ether.c\n@@ -38,7 +38,8 @@ static int8_t get_xdigit(char ch)\n }\n \n /* Convert 00:11:22:33:44:55 to ethernet address */\n-static bool get_ether_addr6(const char *s0, struct rte_ether_addr *ea)\n+static bool get_ether_addr6(const char *s0, struct rte_ether_addr *ea,\n+\t\t\t    const char sep)\n {\n \tconst char *s = s0;\n \tint i;\n@@ -48,25 +49,29 @@ static bool get_ether_addr6(const char *s0, struct rte_ether_addr *ea)\n \n \t\tx = get_xdigit(*s++);\n \t\tif (x < 0)\n-\t\t\treturn false;\n+\t\t\treturn false;\t/* not a hex digit */\n \n-\t\tea->addr_bytes[i] = x << 4;\n-\t\tx = get_xdigit(*s++);\n-\t\tif (x < 0)\n-\t\t\treturn false;\n-\t\tea->addr_bytes[i] |= x;\n+\t\tea->addr_bytes[i] = x;\n+\t\tif (*s != sep && *s != '\\0') {\n+\t\t\tx = get_xdigit(*s++);\n+\t\t\tif (x < 0)\n+\t\t\t\treturn false;\t/* not a hex digit */\n+\t\t\tea->addr_bytes[i] <<= 4;\n+\t\t\tea->addr_bytes[i] |= x;\n+\t\t}\n \n \t\tif (i < RTE_ETHER_ADDR_LEN - 1 &&\n-\t\t    *s++ != ':')\n-\t\t\treturn false;\n+\t\t    *s++ != sep)\n+\t\t\treturn false;\t/* premature end of string */\n \t}\n \n-\t/* return true if at end of string */\n+\t/* return true if no trailing characters */\n \treturn *s == '\\0';\n }\n \n /* Convert 0011:2233:4455 to ethernet address */\n-static bool get_ether_addr3(const char *s, struct rte_ether_addr *ea)\n+static bool get_ether_addr3(const char *s, struct rte_ether_addr *ea,\n+\t\t\t    const char sep)\n {\n \tint i, j;\n \n@@ -78,14 +83,17 @@ static bool get_ether_addr3(const char *s, struct rte_ether_addr *ea)\n \n \t\t\tx = get_xdigit(*s++);\n \t\t\tif (x < 0)\n-\t\t\t\treturn false;\n+\t\t\t\treturn false;\t/* not a hex digit */\n \t\t\tw = (w << 4) | x;\n+\t\t\tif (*s == sep || *s == '\\0')\n+\t\t\t\tbreak;\n \t\t}\n+\n \t\tea->addr_bytes[i] = w >> 8;\n \t\tea->addr_bytes[i + 1] = w & 0xff;\n \n \t\tif (i < RTE_ETHER_ADDR_LEN - 2 &&\n-\t\t    *s++ != ':')\n+\t\t    *s++ != sep)\n \t\t\treturn false;\n \t}\n \n@@ -93,17 +101,56 @@ static bool get_ether_addr3(const char *s, struct rte_ether_addr *ea)\n }\n \n /*\n- * Like ether_aton_r but can handle either\n- * XX:XX:XX:XX:XX:XX or XXXX:XXXX:XXXX\n- * and is more restrictive.\n+ * Scan input to see if separated by dash, colon or period\n+ * Returns separator and number of matches\n+ * If separators are mixed will return\n+ */\n+static unsigned int get_ether_sep(const char *s, char *sep)\n+{\n+\tstatic const char separators[] = \"-:.\";\n+\tunsigned int count = 0;\n+\tconst char *cp;\n+\n+\tcp = strpbrk(s, separators);\n+\tif (cp == NULL)\n+\t\treturn 0;\t/* no separator found */\n+\n+\t*sep = *cp;\t\t/* return the separator */\n+\tdo {\n+\t\t++count;\n+\t\t/* find next instance of separator */\n+\t\tcp = strchr(cp + 1, *sep);\n+\t} while (cp != NULL);\n+\n+\treturn count;\n+}\n+\n+/*\n+ * Be liberal in accepting a wide variety of notational formats\n+ * for MAC address including:\n+ *  - Linux format six groups of hexadecimal digits separated by colon\n+ *  - Windows format six groups separated by hyphen\n+ *  - two groups hexadecimal digits\n  */\n int\n rte_ether_unformat_addr(const char *s, struct rte_ether_addr *ea)\n {\n-\tif (get_ether_addr6(s, ea))\n-\t\treturn 0;\n-\tif (get_ether_addr3(s, ea))\n-\t\treturn 0;\n+\tunsigned int count;\n+\tchar sep = '\\0';\n+\n+\tcount = get_ether_sep(s, &sep);\n+\tswitch (count) {\n+\tcase 5:\t/* i.e 01:23:45:67:89:AB */\n+\t\tif (get_ether_addr6(s, ea, sep))\n+\t\t\treturn 0;\n+\t\tbreak;\n+\tcase 2: /* i.e 0123.4567.89AB */\n+\t\tif (get_ether_addr3(s, ea, sep))\n+\t\t\treturn 0;\n+\t\tbreak;\n+\tdefault:\n+\t\tbreak;\n+\t}\n \n \trte_errno = EINVAL;\n \treturn -1;\ndiff --git a/lib/net/rte_ether.h b/lib/net/rte_ether.h\nindex b35c72c7b0e0..097aedcf21eb 100644\n--- a/lib/net/rte_ether.h\n+++ b/lib/net/rte_ether.h\n@@ -254,8 +254,13 @@ rte_ether_format_addr(char *buf, uint16_t size,\n  *\n  * @param str\n  *   A pointer to buffer contains the formatted MAC address.\n- *   The supported formats are:\n- *     XX:XX:XX:XX:XX:XX or XXXX:XXXX:XXXX\n+ *   Accepts either byte or word format separated by colon,\n+ *   hyphen or period.\n+ *\n+ *   The example formats are:\n+ *     XX:XX:XX:XX:XX:XX - Canonical form\n+ *     XX-XX-XX-XX-XX-XX - Windows and IEEE 802\n+ *     XXXX.XXXX.XXXX    - Cisco\n  *   where XX is a hex digit: 0-9, a-f, or A-F.\n  * @param eth_addr\n  *   A pointer to a ether_addr structure.\n",
    "prefixes": [
        "v2",
        "2/3"
    ]
}