Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/66451/?format=api
http://patches.dpdk.org/api/patches/66451/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1583757743-375198-4-git-send-email-vladimir.medvedkin@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": "<1583757743-375198-4-git-send-email-vladimir.medvedkin@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1583757743-375198-4-git-send-email-vladimir.medvedkin@intel.com", "date": "2020-03-09T12:42:22", "name": "[3/4] app/testfib: get rid of libresolv dependency", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "57608a2d926065614e0acde900df46a2a4a339d5", "submitter": { "id": 1216, "url": "http://patches.dpdk.org/api/people/1216/?format=api", "name": "Vladimir Medvedkin", "email": "vladimir.medvedkin@intel.com" }, "delegate": { "id": 24651, "url": "http://patches.dpdk.org/api/users/24651/?format=api", "username": "dmarchand", "first_name": "David", "last_name": "Marchand", "email": "david.marchand@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1583757743-375198-4-git-send-email-vladimir.medvedkin@intel.com/mbox/", "series": [ { "id": 8846, "url": "http://patches.dpdk.org/api/series/8846/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8846", "date": "2020-03-09T12:42:19", "name": "app/testfib: testfib app various fixes", "version": 1, "mbox": "http://patches.dpdk.org/series/8846/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/66451/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/66451/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 34A5CA052E;\n\tMon, 9 Mar 2020 13:43:02 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 6BDAD1C0B2;\n\tMon, 9 Mar 2020 13:42:39 +0100 (CET)", "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n by dpdk.org (Postfix) with ESMTP id 3F1851C065\n for <dev@dpdk.org>; Mon, 9 Mar 2020 13:42:35 +0100 (CET)", "from fmsmga004.fm.intel.com ([10.253.24.48])\n by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n 09 Mar 2020 05:42:34 -0700", "from silpixa00400072.ir.intel.com ([10.237.222.213])\n by fmsmga004.fm.intel.com with ESMTP; 09 Mar 2020 05:42:33 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.70,533,1574150400\"; d=\"scan'208\";a=\"265243900\"", "From": "Vladimir Medvedkin <vladimir.medvedkin@intel.com>", "To": "dev@dpdk.org", "Date": "Mon, 9 Mar 2020 12:42:22 +0000", "Message-Id": "<1583757743-375198-4-git-send-email-vladimir.medvedkin@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1583757743-375198-1-git-send-email-vladimir.medvedkin@intel.com>", "References": "<1583757743-375198-1-git-send-email-vladimir.medvedkin@intel.com>", "Subject": "[dpdk-dev] [PATCH 3/4] app/testfib: get rid of libresolv dependency", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "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", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Get rid of using inet_net_pton(). Implement it internally in the app.\n\nSigned-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>\n---\n app/test-fib/Makefile | 2 --\n app/test-fib/main.c | 85 +++++++++++++++++++++++++--------------------------\n 2 files changed, 41 insertions(+), 46 deletions(-)", "diff": "diff --git a/app/test-fib/Makefile b/app/test-fib/Makefile\nindex 78b45fe..9da34eb 100644\n--- a/app/test-fib/Makefile\n+++ b/app/test-fib/Makefile\n@@ -11,8 +11,6 @@ CFLAGS += -O3\n CFLAGS += $(WERROR_FLAGS)\n CFLAGS += -DALLOW_EXPERIMENTAL_API\n \n-LDFLAGS += -lresolv\n-\n # all source are stored in SRCS-y\n SRCS-y := main.c\n \ndiff --git a/app/test-fib/main.c b/app/test-fib/main.c\nindex 7fd3420..5fb67f3 100644\n--- a/app/test-fib/main.c\n+++ b/app/test-fib/main.c\n@@ -2,14 +2,10 @@\n * Copyright(c) 2019 Intel Corporation\n */\n \n-#include <rte_string_fns.h>\n #include <getopt.h>\n #include <string.h>\n-#include <stdio.h>\n-#include <sys/types.h>\n-#include <sys/socket.h>\n-#include <netinet/in.h>\n #include <arpa/inet.h>\n+#include <sys/socket.h>\n \n #include <rte_cycles.h>\n #include <rte_errno.h>\n@@ -444,46 +440,12 @@ gen_rnd_lookup_tbl(int af)\n }\n \n static int\n-parse_rt_4(FILE *f)\n-{\n-\tint ret, i, j = 0;\n-\tchar *s, *sp, *in[RT_NUM];\n-\tstatic const char *dlm = \" \\t\\n\";\n-\tint string_tok_nb = RTE_DIM(in);\n-\tstruct rt_rule_4 *rt;\n-\n-\trt = (struct rt_rule_4 *)config.rt;\n-\n-\twhile (fgets(line, sizeof(line), f) != NULL) {\n-\t\ts = line;\n-\t\tfor (i = 0; i != string_tok_nb; i++) {\n-\t\t\tin[i] = strtok_r(s, dlm, &sp);\n-\t\t\tif (in[i] == NULL)\n-\t\t\t\treturn -EINVAL;\n-\t\t\ts = NULL;\n-\t\t}\n-\n-\t\tret = inet_net_pton(AF_INET, in[RT_PREFIX], &rt[j].addr,\n-\t\t\tsizeof(rt[j].addr));\n-\t\tif (ret == -1)\n-\t\t\treturn -errno;\n-\n-\t\trt[j].addr = rte_be_to_cpu_32(rt[j].addr);\n-\t\trt[j].depth = ret;\n-\t\tconfig.nb_routes_per_depth[ret]++;\n-\t\tGET_CB_FIELD(in[RT_NEXTHOP], rt[j].nh, 0,\n-\t\t\t\tUINT32_MAX, 0);\n-\t\tj++;\n-\t}\n-\treturn 0;\n-}\n-\n-static int\n-__inet_net_pton6(char *prefix, uint8_t *addr)\n+_inet_net_pton(int af, char *prefix, void *addr)\n {\n \tconst char *dlm = \"/\";\n \tchar *s, *sp;\n \tint ret, depth;\n+\tunsigned max_depth;\n \n \tif ((prefix == NULL) || (addr == NULL))\n \t\treturn -EINVAL;\n@@ -492,17 +454,52 @@ __inet_net_pton6(char *prefix, uint8_t *addr)\n \tif (s == NULL)\n \t\treturn -EINVAL;\n \n-\tret = inet_pton(AF_INET6, s, addr);\n+\tret = inet_pton(af, s, addr);\n \tif (ret != 1)\n \t\treturn -errno;\n \n \ts = strtok_r(NULL, dlm, &sp);\n-\tGET_CB_FIELD(s, depth, 0, 128, 0);\n+\tmax_depth = (af == AF_INET) ? 32 : 128;\n+\tGET_CB_FIELD(s, depth, 0, max_depth, 0);\n \n \treturn depth;\n }\n \n static int\n+parse_rt_4(FILE *f)\n+{\n+\tint ret, i, j = 0;\n+\tchar *s, *sp, *in[RT_NUM];\n+\tstatic const char *dlm = \" \\t\\n\";\n+\tint string_tok_nb = RTE_DIM(in);\n+\tstruct rt_rule_4 *rt;\n+\n+\trt = (struct rt_rule_4 *)config.rt;\n+\n+\twhile (fgets(line, sizeof(line), f) != NULL) {\n+\t\ts = line;\n+\t\tfor (i = 0; i != string_tok_nb; i++) {\n+\t\t\tin[i] = strtok_r(s, dlm, &sp);\n+\t\t\tif (in[i] == NULL)\n+\t\t\t\treturn -EINVAL;\n+\t\t\ts = NULL;\n+\t\t}\n+\n+\t\tret = _inet_net_pton(AF_INET, in[RT_PREFIX], &rt[j].addr);\n+\t\tif (ret == -1)\n+\t\t\treturn -errno;\n+\n+\t\trt[j].addr = rte_be_to_cpu_32(rt[j].addr);\n+\t\trt[j].depth = ret;\n+\t\tconfig.nb_routes_per_depth[ret]++;\n+\t\tGET_CB_FIELD(in[RT_NEXTHOP], rt[j].nh, 0,\n+\t\t\t\tUINT32_MAX, 0);\n+\t\tj++;\n+\t}\n+\treturn 0;\n+}\n+\n+static int\n parse_rt_6(FILE *f)\n {\n \tint ret, i, j = 0;\n@@ -522,7 +519,7 @@ parse_rt_6(FILE *f)\n \t\t\ts = NULL;\n \t\t}\n \n-\t\tret = __inet_net_pton6(in[RT_PREFIX], rt[j].addr);\n+\t\tret = _inet_net_pton(AF_INET6, in[RT_PREFIX], rt[j].addr);\n \t\tif (ret < 0)\n \t\t\treturn ret;\n \n", "prefixes": [ "3/4" ] }{ "id": 66451, "url": "