get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 114166,
    "url": "http://patchwork.dpdk.org/api/patches/114166/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20220725163543.875775-7-bruce.richardson@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20220725163543.875775-7-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220725163543.875775-7-bruce.richardson@intel.com",
    "date": "2022-07-25T16:35:35",
    "name": "[v2,06/13] telemetry: limit characters allowed in dictionary names",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "946a59cf9091426433d23e06f21c6f1ea9932405",
    "submitter": {
        "id": 20,
        "url": "http://patchwork.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20220725163543.875775-7-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 24069,
            "url": "http://patchwork.dpdk.org/api/series/24069/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=24069",
            "date": "2022-07-25T16:35:29",
            "name": "telemetry JSON escaping and other enhancements",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/24069/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/114166/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/114166/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 76773A00C4;\n\tMon, 25 Jul 2022 18:36:34 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 04EF442B7C;\n\tMon, 25 Jul 2022 18:36:22 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n by mails.dpdk.org (Postfix) with ESMTP id 741D042B76\n for <dev@dpdk.org>; Mon, 25 Jul 2022 18:36:19 +0200 (CEST)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 25 Jul 2022 09:36:19 -0700",
            "from silpixa00401385.ir.intel.com (HELO\n silpixa00401385.ger.corp.intel.com.) ([10.237.223.47])\n by orsmga006.jf.intel.com with ESMTP; 25 Jul 2022 09:36:17 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1658766979; x=1690302979;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=1nxMwCwaTD1+yMyvGrZuFIwtw1bNb4w86zM8At6BbB8=;\n b=RNoqdhXNIrM6lTMhx2hd7k4WBr8N2JkDopQIlNZbCgs0JX5kAV2UlujD\n qUM5/tPR3XtOuclxGRQBcFiMnENJjVBZWhSwy+RftfHhwR0pQYucQ4VHx\n oKSndNt2mFekjHv8RuKf70kBLT/AGMEzi8b+HsNEdBORSFhuwcAfVeI3D\n 97MxoPH9DAeYuoesnlb58dVMor4ykP52G7dXjbPOdvdRXmGHSk9+x7bRx\n Gye81QtvgoApOUERvahm2ydFM96NKRqLpS+JN12RlMy5d1lZrvZj4WZnq\n /hjhsp6PrC3WxDRkFm0G33+tFy1/XG7vy4cJ8rAPnTFsJWn0rF5uzCIbe Q==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10419\"; a=\"288499095\"",
            "E=Sophos;i=\"5.93,193,1654585200\"; d=\"scan'208\";a=\"288499095\"",
            "E=Sophos;i=\"5.93,193,1654585200\"; d=\"scan'208\";a=\"575121940\""
        ],
        "X-ExtLoop1": "1",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>,\n Ciara Power <ciara.power@intel.com>",
        "Subject": "[PATCH v2 06/13] telemetry: limit characters allowed in dictionary\n names",
        "Date": "Mon, 25 Jul 2022 17:35:35 +0100",
        "Message-Id": "<20220725163543.875775-7-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220725163543.875775-1-bruce.richardson@intel.com>",
        "References": "<20220623164245.561371-1-bruce.richardson@intel.com>\n <20220725163543.875775-1-bruce.richardson@intel.com>",
        "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": "To save issues with encoding the names of values in dicts, we limit the\nallowed names to a subset of character values. This list of allowed\ncharacters can be expanded as necessary in future.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n lib/telemetry/rte_telemetry.h  |  8 ++++++++\n lib/telemetry/telemetry_data.c | 32 ++++++++++++++++++++++++++++++++\n 2 files changed, 40 insertions(+)",
    "diff": "diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h\nindex d586dd0fc1..a0d21d6b7f 100644\n--- a/lib/telemetry/rte_telemetry.h\n+++ b/lib/telemetry/rte_telemetry.h\n@@ -64,6 +64,10 @@ rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type);\n /**\n  * Start a dictionary of values for returning from a callback\n  *\n+ * Dictionaries consist of key-values pairs to be returned, where the keys,\n+ * or names, are strings and the values can be any of the types supported by telemetry.\n+ * Name strings may only contain alphanumeric characters as well as '_' or '/'\n+ *\n  * @param d\n  *   The data structure passed to the callback\n  * @return\n@@ -159,6 +163,7 @@ rte_tel_data_add_array_container(struct rte_tel_data *d,\n  *   The data structure passed to the callback\n  * @param name\n  *   The name the value is to be stored under in the dict\n+ *   Must contain only alphanumeric characters or the symbols: '_' or '/'\n  * @param val\n  *   The string to be stored in the dict\n  * @return\n@@ -177,6 +182,7 @@ rte_tel_data_add_dict_string(struct rte_tel_data *d, const char *name,\n  *   The data structure passed to the callback\n  * @param name\n  *   The name the value is to be stored under in the dict\n+ *   Must contain only alphanumeric characters or the symbols: '_' or '/'\n  * @param val\n  *   The number to be stored in the dict\n  * @return\n@@ -193,6 +199,7 @@ rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val);\n  *   The data structure passed to the callback\n  * @param name\n  *   The name the value is to be stored under in the dict\n+ *   Must contain only alphanumeric characters or the symbols: '_' or '/'\n  * @param val\n  *   The number to be stored in the dict\n  * @return\n@@ -212,6 +219,7 @@ rte_tel_data_add_dict_u64(struct rte_tel_data *d,\n  *   The data structure passed to the callback\n  * @param name\n  *   The name the value is to be stored under in the dict.\n+ *   Must contain only alphanumeric characters or the symbols: '_' or '/'\n  * @param val\n  *   The pointer to the container to be stored in the dict.\n  * @param keep\ndiff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c\nindex e14ae3c4d4..b5cd74b25b 100644\n--- a/lib/telemetry/telemetry_data.c\n+++ b/lib/telemetry/telemetry_data.c\n@@ -3,6 +3,8 @@\n  */\n \n #undef RTE_USE_LIBBSD\n+#include <stdbool.h>\n+\n #include <rte_string_fns.h>\n \n #include \"telemetry_data.h\"\n@@ -92,6 +94,24 @@ rte_tel_data_add_array_container(struct rte_tel_data *d,\n \treturn 0;\n }\n \n+static bool\n+valid_name(const char *name)\n+{\n+\tchar allowed[128] = {\n+\t\t\t['0' ... '9'] = 1,\n+\t\t\t['A' ... 'Z'] = 1,\n+\t\t\t['a' ... 'z'] = 1,\n+\t\t\t['_'] = 1,\n+\t\t\t['/'] = 1,\n+\t};\n+\twhile (*name != '\\0') {\n+\t\tif ((size_t)*name >= RTE_DIM(allowed) || allowed[(int)*name] == 0)\n+\t\t\treturn false;\n+\t\tname++;\n+\t}\n+\treturn true;\n+}\n+\n int\n rte_tel_data_add_dict_string(struct rte_tel_data *d, const char *name,\n \t\tconst char *val)\n@@ -104,6 +124,9 @@ rte_tel_data_add_dict_string(struct rte_tel_data *d, const char *name,\n \tif (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES)\n \t\treturn -ENOSPC;\n \n+\tif (!valid_name(name))\n+\t\treturn -EINVAL;\n+\n \td->data_len++;\n \te->type = RTE_TEL_STRING_VAL;\n \tvbytes = strlcpy(e->value.sval, val, RTE_TEL_MAX_STRING_LEN);\n@@ -123,6 +146,9 @@ rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val)\n \tif (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES)\n \t\treturn -ENOSPC;\n \n+\tif (!valid_name(name))\n+\t\treturn -EINVAL;\n+\n \td->data_len++;\n \te->type = RTE_TEL_INT_VAL;\n \te->value.ival = val;\n@@ -140,6 +166,9 @@ rte_tel_data_add_dict_u64(struct rte_tel_data *d,\n \tif (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES)\n \t\treturn -ENOSPC;\n \n+\tif (!valid_name(name))\n+\t\treturn -EINVAL;\n+\n \td->data_len++;\n \te->type = RTE_TEL_U64_VAL;\n \te->value.u64val = val;\n@@ -161,6 +190,9 @@ rte_tel_data_add_dict_container(struct rte_tel_data *d, const char *name,\n \tif (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES)\n \t\treturn -ENOSPC;\n \n+\tif (!valid_name(name))\n+\t\treturn -EINVAL;\n+\n \td->data_len++;\n \te->type = RTE_TEL_CONTAINER;\n \te->value.container.data = val;\n",
    "prefixes": [
        "v2",
        "06/13"
    ]
}