Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/803577/?format=api
{ "id": 803577, "url": "http://patchwork.ozlabs.org/api/patches/803577/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20170819152420.22563-16-eric@regit.org/", "project": { "id": 26, "url": "http://patchwork.ozlabs.org/api/projects/26/?format=api", "name": "Netfilter Development", "link_name": "netfilter-devel", "list_id": "netfilter-devel.vger.kernel.org", "list_email": "netfilter-devel@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170819152420.22563-16-eric@regit.org>", "list_archive_url": null, "date": "2017-08-19T15:24:17", "name": "[PATH,nft,v2,15/18] libnftables: set max_errors to 1 in library", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "e67341a9333403dea42313e21ab9b29f94679d85", "submitter": { "id": 8198, "url": "http://patchwork.ozlabs.org/api/people/8198/?format=api", "name": "Eric Leblond", "email": "eric@regit.org" }, "delegate": { "id": 6139, "url": "http://patchwork.ozlabs.org/api/users/6139/?format=api", "username": "pablo", "first_name": "Pablo", "last_name": "Neira", "email": "pablo@netfilter.org" }, "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20170819152420.22563-16-eric@regit.org/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/803577/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/803577/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netfilter-devel-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netfilter-devel-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xZP9L18Zsz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 20 Aug 2017 01:33:10 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751672AbdHSPdJ (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tSat, 19 Aug 2017 11:33:09 -0400", "from home.regit.org ([37.187.126.138]:33818 \"EHLO home.regit.org\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751667AbdHSPdJ (ORCPT <rfc822; netfilter-devel@vger.kernel.org>);\n\tSat, 19 Aug 2017 11:33:09 -0400", "from [2a01:e34:ee97:b130:c685:8ff:feb3:c9c8]\n\t(helo=localhost.localdomain) by home.regit.org with esmtpsa\n\t(TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89)\n\t(envelope-from <eric@regit.org>)\n\tid 1dj5cL-0001ro-Pg; Sat, 19 Aug 2017 17:24:54 +0200" ], "From": "Eric Leblond <eric@regit.org>", "To": "pablo@netfilter.org", "Cc": "netfilter-devel@vger.kernel.org, Eric Leblond <eric@regit.org>", "Subject": "[PATH nft v2 15/18] libnftables: set max_errors to 1 in library", "Date": "Sat, 19 Aug 2017 17:24:17 +0200", "Message-Id": "<20170819152420.22563-16-eric@regit.org>", "X-Mailer": "git-send-email 2.14.1", "In-Reply-To": "<20170819152420.22563-1-eric@regit.org>", "References": "<20170819152420.22563-1-eric@regit.org>", "X-Spam-Score": "-1.0 (-)", "Sender": "netfilter-devel-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netfilter-devel.vger.kernel.org>", "X-Mailing-List": "netfilter-devel@vger.kernel.org" }, "content": "As memory handling is defficient if we don't do so, we can't really\nuse a non 1 value for the parameter in the library due to memory\nleak.\n\nAlso this is not a real issue as programmatically a user of the\nlibrary should only encounter one error at a time.\n\nThis patch also introduces a function that can be used to modify\nthe max_errors parameter. It is used in main to keep the existing\nbehavior.\n\nSigned-off-by: Eric Leblond <eric@regit.org>\n---\n include/nftables/nftables.h | 1 +\n src/libnftables.c | 8 +++++++-\n src/main.c | 1 +\n 3 files changed, 9 insertions(+), 1 deletion(-)", "diff": "diff --git a/include/nftables/nftables.h b/include/nftables/nftables.h\nindex 2ddb38a..f419884 100644\n--- a/include/nftables/nftables.h\n+++ b/include/nftables/nftables.h\n@@ -22,6 +22,7 @@ enum nftables_exit_codes {\n };\n \n void nft_global_init(void);\n+int nft_global_set_max_errors(unsigned int errors);\n void nft_global_deinit(void);\n \n struct nft_ctx *nft_context_new(void);\ndiff --git a/src/libnftables.c b/src/libnftables.c\nindex 61ed4e5..15345ae 100644\n--- a/src/libnftables.c\n+++ b/src/libnftables.c\n@@ -25,7 +25,7 @@\n #include <fcntl.h>\n \n \n-unsigned int max_errors = 10;\n+unsigned int max_errors = 1;\n unsigned int numeric_output;\n unsigned int ip2name_output;\n unsigned int handle_output;\n@@ -58,6 +58,12 @@ void nft_global_deinit(void)\n \tmark_table_exit();\n }\n \n+int nft_global_set_max_errors(unsigned int errors)\n+{\n+\tmax_errors = errors;\n+\treturn NFT_EXIT_SUCCESS;\n+}\n+\n __attribute__((format(printf, 2, 0)))\n static int nft_print(void *ctx, const char *fmt, ...)\n {\ndiff --git a/src/main.c b/src/main.c\nindex 08d77d0..355f429 100644\n--- a/src/main.c\n+++ b/src/main.c\n@@ -187,6 +187,7 @@ int main(int argc, char * const *argv)\n \tstruct nft_ctx *nft;\n \n \tnft_global_init();\n+\tnft_global_set_max_errors(10);\n \tnft = nft_context_new();\n \twhile (1) {\n \t\tval = getopt_long(argc, argv, OPTSTRING, options, NULL);\n", "prefixes": [ "PATH", "nft", "v2", "15/18" ] }