{"id":2231486,"url":"http://patchwork.ozlabs.org/api/patches/2231486/?format=json","web_url":"http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260430182543.3931718-4-rc@rexion.ai/","project":{"id":26,"url":"http://patchwork.ozlabs.org/api/projects/26/?format=json","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":"<20260430182543.3931718-4-rc@rexion.ai>","list_archive_url":null,"date":"2026-04-30T18:25:43","name":"[net-next,v2,3/3] netfilter: nf_conntrack_amanda: use nf_ct_helper_parse_port()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"c79d0dad55a39883526c8c61b77d1d300c92a70c","submitter":{"id":93293,"url":"http://patchwork.ozlabs.org/api/people/93293/?format=json","name":"HACKE-RC","email":"rc@rexion.ai"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260430182543.3931718-4-rc@rexion.ai/mbox/","series":[{"id":502357,"url":"http://patchwork.ozlabs.org/api/series/502357/?format=json","web_url":"http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=502357","date":"2026-04-30T18:25:41","name":"netfilter: conntrack: add shared port parser and use it in IRC and Amanda helpers","version":2,"mbox":"http://patchwork.ozlabs.org/series/502357/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2231486/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2231486/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <netfilter-devel+bounces-12349-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","netfilter-devel@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"key not found in DNS\" header.d=rexion.ai\n header.i=@rexion.ai header.a=rsa-sha256 header.s=spacemail header.b=btA5f6cx;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=netfilter-devel+bounces-12349-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=fail reason=\"key not found in DNS\" (0-bit key) header.d=rexion.ai\n header.i=@rexion.ai header.b=\"btA5f6cx\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=63.250.43.96","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=rexion.ai","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=rexion.ai"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g62lH4smtz1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 04:29:47 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 9D200307841C\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 18:26:33 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 98B9347CC73;\n\tThu, 30 Apr 2026 18:26:32 +0000 (UTC)","from out-13.smtp.spacemail.com (out-13.smtp.spacemail.com\n [63.250.43.96])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C67A39D6DE;\n\tThu, 30 Apr 2026 18:26:30 +0000 (UTC)","from Kyren (unknown [49.207.224.37])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby mail.spacemail.com (Postfix) with ESMTPSA id 4g62gP5PlPz8sXN;\n\tThu, 30 Apr 2026 18:26:25 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777573592; cv=none;\n b=JdG1STQ0ayTxbbACqBf4QAB51W5RXhMtJpcs9cLNXPAX+H5Mj2XgxktOnRlz5cg/PL3IHoO2CTj9Bdp7nQO4mvDThPBZArm0B5f36MgFn8/mgwYioSUw0fNTMtBX9Oo4Xp04Q9rJaC4BxjRnZEBPGgVonHuaQAphxJT8qFhpMQM=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777573592; c=relaxed/simple;\n\tbh=9yyUUs2BXIToAhIyi6W6MlHL2Q0Rkg+H4tfy95uVAzs=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=EKyGWPpV8weTkrLA+s91U+UA3cPNhJ9Ou2D+h5nhVUePNpI4ufAhPW5prLHh6UH92mLvQHbHNY+C92Ooyo9mlZJXDsf3lQXWnzHddBu4gmrXDpc0O8bTci+EY7+ZD/9RsgCDdD15ysCuk+cgR54rywfIHFczERH92Nus1VERMM0=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=rexion.ai;\n spf=pass smtp.mailfrom=rexion.ai;\n dkim=fail (0-bit key) header.d=rexion.ai header.i=@rexion.ai\n header.b=btA5f6cx reason=\"key not found in DNS\";\n arc=none smtp.client-ip=63.250.43.96","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=rexion.ai;\n\ts=spacemail; t=1777573590;\n\tbh=aCT15It8ZbWGI5T3TU+l8UKx6cl6pDrHxcHnymDFNhk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=btA5f6cxO7/UPYYBJdlAzt3hu6DUQPvM9rOl5iAYVEx8HxzCuhlg7Qk9UJpEiqPCG\n\t NFpr8Vk7c0XWoyCNjKyr1E3CiNdxrI3Rz0L/jCQ/gUnAX11EnK0FZC/9X39hDwB3QW\n\t m4v76vaB5R6QM5CvNtgbPWgXnivKNadp03fGqZmjbWnkDJHfP4mB5aNKbo/9UBVNSt\n\t vg3i0BmfkKKkkc0YwSD66d56j/fmMCXLQD+XYDLcpbJmLkGLUPEdsS9oSWJpGHbu1F\n\t QKEB2dXqS77/UE4EsdRkmtMcy5evWNAC+1hOlTyF9F+MaL43OGNP+7BxOtJc72xTLE\n\t ggd6NV0uulXnA==","From":"HACKE-RC <rc@rexion.ai>","To":"Pablo Neira Ayuso <pablo@netfilter.org>,\n\tFlorian Westphal <fw@strlen.de>","Cc":"Phil Sutter <phil@nwl.cc>,\n\t\"David S . Miller\" <davem@davemloft.net>,\n\tEric Dumazet <edumazet@google.com>,\n\tJakub Kicinski <kuba@kernel.org>,\n\tPaolo Abeni <pabeni@redhat.com>,\n\tSimon Horman <horms@kernel.org>,\n\tnetfilter-devel@vger.kernel.org,\n\tcoreteam@netfilter.org,\n\tnetdev@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tHACKE-RC <rc@rexion.ai>","Subject":"[PATCH net-next v2 3/3] netfilter: nf_conntrack_amanda: use\n nf_ct_helper_parse_port()","Date":"Thu, 30 Apr 2026 23:55:43 +0530","Message-ID":"<20260430182543.3931718-4-rc@rexion.ai>","X-Mailer":"git-send-email 2.54.0","In-Reply-To":"<20260430182543.3931718-1-rc@rexion.ai>","References":"<20260430182543.3931718-1-rc@rexion.ai>","Precedence":"bulk","X-Mailing-List":"netfilter-devel@vger.kernel.org","List-Id":"<netfilter-devel.vger.kernel.org>","List-Subscribe":"<mailto:netfilter-devel+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:netfilter-devel+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Envelope-From":"rc@rexion.ai"},"content":"Replace the bare simple_strtoul() call with the shared\nnf_ct_helper_parse_port(). This removes reliance on the\nnul-terminated pbuf string for parsing and validates the port\nrange in a single call.\n\nThe len > 5 guard and port == 0 check are now handled by the\nshared parser, which rejects zero and values above 65535.\n\nReorder local variable declarations to reverse christmas tree.\n\nFixes: 16958900578b (\"[NETFILTER]: nf_conntrack/nf_nat: add amanda helper port\")\nSigned-off-by: HACKE-RC <rc@rexion.ai>\n---\n net/netfilter/nf_conntrack_amanda.c | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)","diff":"diff --git a/net/netfilter/nf_conntrack_amanda.c b/net/netfilter/nf_conntrack_amanda.c\nindex d2c09e8dd..30b5c4b84 100644\n--- a/net/netfilter/nf_conntrack_amanda.c\n+++ b/net/netfilter/nf_conntrack_amanda.c\n@@ -88,11 +88,12 @@ static int amanda_help(struct sk_buff *skb,\n \tstruct nf_conntrack_expect *exp;\n \tstruct nf_conntrack_tuple *tuple;\n \tunsigned int dataoff, start, stop, off, i;\n+\tnf_nat_amanda_hook_fn *nf_nat_amanda;\n \tchar pbuf[sizeof(\"65535\")], *tmp;\n+\tint ret = NF_ACCEPT;\n \tu_int16_t len;\n+\tu16 parsed_port;\n \t__be16 port;\n-\tint ret = NF_ACCEPT;\n-\tnf_nat_amanda_hook_fn *nf_nat_amanda;\n \n \t/* Only look at packets from the Amanda server */\n \tif (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL)\n@@ -132,10 +133,10 @@ static int amanda_help(struct sk_buff *skb,\n \t\t\tbreak;\n \t\tpbuf[len] = '\\0';\n \n-\t\tport = htons(simple_strtoul(pbuf, &tmp, 10));\n-\t\tlen = tmp - pbuf;\n-\t\tif (port == 0 || len > 5)\n+\t\tif (nf_ct_helper_parse_port(pbuf, len, &parsed_port, &tmp))\n \t\t\tbreak;\n+\t\tport = htons(parsed_port);\n+\t\tlen = tmp - pbuf;\n \n \t\texp = nf_ct_expect_alloc(ct);\n \t\tif (exp == NULL) {\n","prefixes":["net-next","v2","3/3"]}