Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/105132/?format=api
http://patches.dpdk.org/api/patches/105132/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20211214141242.3383831-3-ronan.randles@intel.com/", "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": "<20211214141242.3383831-3-ronan.randles@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20211214141242.3383831-3-ronan.randles@intel.com", "date": "2021-12-14T14:12:32", "name": "[02/12] net: add function to pretty print IPv4", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "2c09c00630948322482cfd53eef2f45424893a64", "submitter": { "id": 2439, "url": "http://patches.dpdk.org/api/people/2439/?format=api", "name": "Ronan Randles", "email": "ronan.randles@intel.com" }, "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/20211214141242.3383831-3-ronan.randles@intel.com/mbox/", "series": [ { "id": 20944, "url": "http://patches.dpdk.org/api/series/20944/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=20944", "date": "2021-12-14T14:12:30", "name": "add packet generator library and example app", "version": 1, "mbox": "http://patches.dpdk.org/series/20944/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/105132/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/105132/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 C3539A00C3;\n\tTue, 14 Dec 2021 15:13:04 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9984641151;\n\tTue, 14 Dec 2021 15:12:52 +0100 (CET)", "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n by mails.dpdk.org (Postfix) with ESMTP id 5B4AE410E4\n for <dev@dpdk.org>; Tue, 14 Dec 2021 15:12:50 +0100 (CET)", "from orsmga006.jf.intel.com ([10.7.209.51])\n by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 14 Dec 2021 06:12:49 -0800", "from silpixa00401120.ir.intel.com ([10.55.129.95])\n by orsmga006.jf.intel.com with ESMTP; 14 Dec 2021 06:12:48 -0800" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=simple/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1639491170; x=1671027170;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=wOqgJavZuJODwkZCtBBRtyUQznJztXAEEPL7JpEuFs8=;\n b=Y4cxdItgomr8u3ylS5M7y8igl9/lLrgm7p5NhqP1m0ViNhZH83vH4kl3\n cYqIe0/GJeHPcI9O1CqMtc7eyfRmbT+9gImKkBB5kdJsSMdrFoYAJxT+/\n QGCduada53VaX+9zW194gTtyAh86Cx9PXxMd3Hv35LcfxISR7So8i4aAQ\n 6Ux/QEdq7BDhHp5am/tg6dXKQd2zkjM9jSYfxh3MC/GHgh7ToCUBHNLIN\n 1uC/+z4ciax7jTm3yXcSUACf36SgPRpiLU/7Q9JJ9Mh035uxeNojAyplx\n 7b5dzvmS5dF+ScT8PCIjTkv3KWHEGxd5tHHUMByXqnC5oEUaDBP9+x910 Q==;", "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10197\"; a=\"302362304\"", "E=Sophos;i=\"5.88,205,1635231600\"; d=\"scan'208\";a=\"302362304\"", "E=Sophos;i=\"5.88,205,1635231600\"; d=\"scan'208\";a=\"465104094\"" ], "X-ExtLoop1": "1", "From": "Ronan Randles <ronan.randles@intel.com>", "To": "dev@dpdk.org", "Cc": "harry.van.haaren@intel.com,\n\tRonan Randles <ronan.randles@intel.com>", "Subject": "[PATCH 02/12] net: add function to pretty print IPv4", "Date": "Tue, 14 Dec 2021 14:12:32 +0000", "Message-Id": "<20211214141242.3383831-3-ronan.randles@intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20211214141242.3383831-1-ronan.randles@intel.com>", "References": "<20211214141242.3383831-1-ronan.randles@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": "This function accepts an uint32_t representation of an IP address and\nproduces a string representation stored in a char * buffer. Realavent\nunit tests also included.\n\nSigned-off-by: Ronan Randles <ronan.randles@intel.com>\n---\n app/test/test_net.c | 26 ++++++++++++++++++++++++++\n lib/net/rte_ip.c | 15 +++++++++++++++\n lib/net/rte_ip.h | 20 ++++++++++++++++++++\n lib/net/version.map | 1 +\n 4 files changed, 62 insertions(+)", "diff": "diff --git a/app/test/test_net.c b/app/test/test_net.c\nindex 2cb7d3e1c9..75beeea671 100644\n--- a/app/test/test_net.c\n+++ b/app/test/test_net.c\n@@ -46,7 +46,32 @@ test_rte_ip_parse_addr(void)\n \t\t\t\treturn -1;\n \t\t}\n \t}\n+\treturn 0;\n+}\n+\n+static int\n+test_rte_ip_print_addr(void)\n+{\n+\tprintf(\"Running IP printing tests...\\n\");\n+\tchar buffer[128];\n \n+\tstruct ip_str_t {\n+\t\tuint32_t ip_addr;\n+\t\tconst char *exp_output;\n+\t} ip_str_tests[] = {\n+\t\t{ .ip_addr = 16909060, .exp_output = \"1.2.3.4\"},\n+\t\t{ .ip_addr = 3232301055, . exp_output = \"192.168.255.255\"},\n+\t\t{ .ip_addr = 2886729737, .exp_output = \"172.16.0.9\"}\n+\t};\n+\n+\tuint32_t i;\n+\tfor (i = 0; i < RTE_DIM(ip_str_tests); i++) {\n+\t\tint32_t err = rte_ip_print_addr(ip_str_tests[i].ip_addr,\n+\t\t\t\t\t\t\t\tbuffer, 128);\n+\n+\t\tif (err || strcmp(buffer, ip_str_tests[i].exp_output))\n+\t\t\treturn -1;\n+\t}\n \n \treturn 0;\n }\n@@ -55,6 +80,7 @@ static int\n test_net_tests(void)\n {\n \tint ret = test_rte_ip_parse_addr();\n+\tret += test_rte_ip_print_addr();\n \treturn ret;\n }\n \ndiff --git a/lib/net/rte_ip.c b/lib/net/rte_ip.c\nindex b859dfb640..fbd9161317 100644\n--- a/lib/net/rte_ip.c\n+++ b/lib/net/rte_ip.c\n@@ -41,3 +41,18 @@ rte_ip_parse_addr(const char *src_ip, uint32_t *output_addr)\n \tfree(tok);\n \treturn ret;\n }\n+\n+int32_t\n+rte_ip_print_addr(uint32_t ip_addr, char *buffer, uint32_t buffer_size)\n+{\n+\tif (buffer == NULL)\n+\t\treturn -1;\n+\n+\tsnprintf(buffer, buffer_size, \"%u.%u.%u.%u\",\n+\t\t(ip_addr >> 24),\n+\t\t(ip_addr >> 16) & UINT8_MAX,\n+\t\t(ip_addr >> 8) & UINT8_MAX,\n+\t\t ip_addr & UINT8_MAX);\n+\n+\treturn 0;\n+}\ndiff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h\nindex 188054fda4..e46f0b41ba 100644\n--- a/lib/net/rte_ip.h\n+++ b/lib/net/rte_ip.h\n@@ -444,6 +444,26 @@ __rte_experimental\n int32_t\n rte_ip_parse_addr(const char *src_ip, uint32_t *output_addr);\n \n+\n+/**\n+ * Print IP address from 32 bit int into char * buffer.\n+ *\n+ * @param ip_addr\n+ * ip address to be printed.\n+ * @param buffer\n+ * The buffer the string will be saved into.\n+ * @param buffer_size\n+ * size of buffer to be used.\n+ *\n+ * @retval 0\n+ * Success.\n+ * @retval -1\n+ * Failure due to invalid input arguments.\n+ */\n+__rte_experimental\n+int32_t\n+rte_ip_print_addr(uint32_t ip_addr, char *buffer, uint32_t buffer_size);\n+\n /**\n * IPv6 Header\n */\ndiff --git a/lib/net/version.map b/lib/net/version.map\nindex 3e5a307e48..25028f28ff 100644\n--- a/lib/net/version.map\n+++ b/lib/net/version.map\n@@ -19,4 +19,5 @@ EXPERIMENTAL {\n \trte_net_skip_ip6_ext;\n \trte_ether_unformat_addr;\n \trte_ip_parse_addr;\n+\trte_ip_print_addr;\n };\n", "prefixes": [ "02/12" ] }{ "id": 105132, "url": "