{"id":2221782,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2221782/?format=json","web_url":"http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260410112352.23599-7-fw@strlen.de/","project":{"id":26,"url":"http://patchwork.ozlabs.org/api/1.2/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":"<20260410112352.23599-7-fw@strlen.de>","list_archive_url":null,"date":"2026-04-10T11:23:47","name":"[net-next,06/11] netfilter: xt_HL: add pr_fmt and checkentry validation","commit_ref":null,"pull_url":null,"state":"handled-elsewhere","archived":true,"hash":"f511badbc6be818d393b0d7070acbf29fb2acb5a","submitter":{"id":1025,"url":"http://patchwork.ozlabs.org/api/1.2/people/1025/?format=json","name":"Florian Westphal","email":"fw@strlen.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260410112352.23599-7-fw@strlen.de/mbox/","series":[{"id":499444,"url":"http://patchwork.ozlabs.org/api/1.2/series/499444/?format=json","web_url":"http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=499444","date":"2026-04-10T11:23:46","name":"[net-next,01/11] ipvs: show the current conn_tab size to users","version":1,"mbox":"http://patchwork.ozlabs.org/series/499444/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221782/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221782/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <netfilter-devel+bounces-11802-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 spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=netfilter-devel+bounces-11802-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=91.216.245.30","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=strlen.de","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fsZQc58K0z1yGS\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 21:32:08 +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 4E3233093D95\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 11:24:27 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 88C2F39E17A;\n\tFri, 10 Apr 2026 11:24:25 +0000 (UTC)","from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc\n [91.216.245.30])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 209881448E0;\n\tFri, 10 Apr 2026 11:24:24 +0000 (UTC)","by Chamillionaire.breakpoint.cc (Postfix, from userid 1003)\n\tid 412D560490; Fri, 10 Apr 2026 13:24:22 +0200 (CEST)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775820265; cv=none;\n b=J53HuGp+r4JUHvnNg5yAduwZsdbGSR0/ugvf96hxKYlDp/C8vcvviLsvyyjxIyz2sydhyD6d5RD3Kc76theTp/nYCrl5CIGijcjdfgR8XtMhirZ5Cc6A2PyVUPC1sKn3JLYH0aD+l8Vd976gA8pmBJ3cGsLI5Fti6YUjIb7njTU=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775820265; c=relaxed/simple;\n\tbh=TBTiNZweeWkez7cak9BlklkN+msCb9QglyhD54CmUCM=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=Eu1JtRi5GKjHSWXGRXz6Nm83mQy+E75FXrAwes9pFC5xP17/VswUlskmrY2/DRuFcUGuOAt4Jv+sFjXR/eZZT7ZP0jx4nqkXiE1W2c7gBmC3Ae/IRKg478oW8Oo8Rl2I0Y4r7lYYYIvJUWYjLL7B+udYbSneglsJOSALvG+vaO4=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=strlen.de;\n spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc;\n arc=none smtp.client-ip=91.216.245.30","From":"Florian Westphal <fw@strlen.de>","To":"<netdev@vger.kernel.org>","Cc":"Paolo Abeni <pabeni@redhat.com>,\n\t\"David S. Miller\" <davem@davemloft.net>,\n\tEric Dumazet <edumazet@google.com>,\n\tJakub Kicinski <kuba@kernel.org>,\n\t<netfilter-devel@vger.kernel.org>,\n\tpablo@netfilter.org","Subject":"[PATCH net-next 06/11] netfilter: xt_HL: add pr_fmt and checkentry\n validation","Date":"Fri, 10 Apr 2026 13:23:47 +0200","Message-ID":"<20260410112352.23599-7-fw@strlen.de>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20260410112352.23599-1-fw@strlen.de>","References":"<20260410112352.23599-1-fw@strlen.de>","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"},"content":"From: Marino Dzalto <marino.dzalto@gmail.com>\n\nAdd pr_fmt to prefix log messages with the module name for\neasier debugging in dmesg.\n\nAdd checkentry functions for IPv4 (ttl_mt_check) and IPv6\n(hl_mt6_check) to validate the match mode at rule registration\ntime, rejecting invalid modes with -EINVAL.\n\nThe evaluation function returns false in case the mode is\nunknown, so this is a cleanup, not a bug fix.\n\nSigned-off-by: Marino Dzalto <marino.dzalto@gmail.com>\nSigned-off-by: Florian Westphal <fw@strlen.de>\n---\n net/netfilter/xt_hl.c | 27 +++++++++++++++++++++++++++\n 1 file changed, 27 insertions(+)","diff":"diff --git a/net/netfilter/xt_hl.c b/net/netfilter/xt_hl.c\nindex c1a70f8f0441..4a12a757ecbf 100644\n--- a/net/netfilter/xt_hl.c\n+++ b/net/netfilter/xt_hl.c\n@@ -6,6 +6,7 @@\n  * Hop Limit matching module\n  * (C) 2001-2002 Maciej Soltysiak <solt@dns.toxicfilms.tv>\n  */\n+#define pr_fmt(fmt) KBUILD_MODNAME \": \" fmt\n \n #include <linux/ip.h>\n #include <linux/ipv6.h>\n@@ -22,6 +23,18 @@ MODULE_LICENSE(\"GPL\");\n MODULE_ALIAS(\"ipt_ttl\");\n MODULE_ALIAS(\"ip6t_hl\");\n \n+static int ttl_mt_check(const struct xt_mtchk_param *par)\n+{\n+\tconst struct ipt_ttl_info *info = par->matchinfo;\n+\n+\tif (info->mode > IPT_TTL_GT) {\n+\t\tpr_err(\"Unknown TTL match mode: %d\\n\", info->mode);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static bool ttl_mt(const struct sk_buff *skb, struct xt_action_param *par)\n {\n \tconst struct ipt_ttl_info *info = par->matchinfo;\n@@ -41,6 +54,18 @@ static bool ttl_mt(const struct sk_buff *skb, struct xt_action_param *par)\n \treturn false;\n }\n \n+static int hl_mt6_check(const struct xt_mtchk_param *par)\n+{\n+\tconst struct ip6t_hl_info *info = par->matchinfo;\n+\n+\tif (info->mode > IP6T_HL_GT) {\n+\t\tpr_err(\"Unknown Hop Limit match mode: %d\\n\", info->mode);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static bool hl_mt6(const struct sk_buff *skb, struct xt_action_param *par)\n {\n \tconst struct ip6t_hl_info *info = par->matchinfo;\n@@ -65,6 +90,7 @@ static struct xt_match hl_mt_reg[] __read_mostly = {\n \t\t.name       = \"ttl\",\n \t\t.revision   = 0,\n \t\t.family     = NFPROTO_IPV4,\n+\t\t.checkentry = ttl_mt_check,\n \t\t.match      = ttl_mt,\n \t\t.matchsize  = sizeof(struct ipt_ttl_info),\n \t\t.me         = THIS_MODULE,\n@@ -73,6 +99,7 @@ static struct xt_match hl_mt_reg[] __read_mostly = {\n \t\t.name       = \"hl\",\n \t\t.revision   = 0,\n \t\t.family     = NFPROTO_IPV6,\n+\t\t.checkentry = hl_mt6_check,\n \t\t.match      = hl_mt6,\n \t\t.matchsize  = sizeof(struct ip6t_hl_info),\n \t\t.me         = THIS_MODULE,\n","prefixes":["net-next","06/11"]}