Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2195930/?format=api
{ "id": 2195930, "url": "http://patchwork.ozlabs.org/api/patches/2195930/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260212122547.10437-3-fw@strlen.de/", "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": "<20260212122547.10437-3-fw@strlen.de>", "list_archive_url": null, "date": "2026-02-12T12:25:09", "name": "[nf-next,2/2] netfilter: nft_fib_ipv6: switch to fib6_lookup", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "1bc7d5ba82a84d10ef62e301f93e660f1f7804d8", "submitter": { "id": 1025, "url": "http://patchwork.ozlabs.org/api/people/1025/?format=api", "name": "Florian Westphal", "email": "fw@strlen.de" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260212122547.10437-3-fw@strlen.de/mbox/", "series": [ { "id": 491968, "url": "http://patchwork.ozlabs.org/api/series/491968/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=491968", "date": "2026-02-12T12:25:08", "name": "netfilter: nft_fib_ipv6: switch to fib6_lookup", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/491968/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2195930/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2195930/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <netfilter-devel+bounces-10748-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=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=netfilter-devel+bounces-10748-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 sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::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 4fBZKH598Tz1xwL\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 12 Feb 2026 23:26:11 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 1BBBE30152E4\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 12 Feb 2026 12:26:08 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 7377135772B;\n\tThu, 12 Feb 2026 12:26:04 +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 03E123570C9\n\tfor <netfilter-devel@vger.kernel.org>; Thu, 12 Feb 2026 12:26:02 +0000 (UTC)", "by Chamillionaire.breakpoint.cc (Postfix, from userid 1003)\n\tid 760946063D; Thu, 12 Feb 2026 13:26:01 +0100 (CET)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1770899164; cv=none;\n b=uCgs2hCCUKixbxeExAkHVlnS6UeYo9tBNM2r72oD4xLsqJSigPE7k5jV13vjRpqDN1KLXS9ZfY+VFCqCiznpiQRbvtOkGzUCMt7/JEv9fcSG2o91ujxJmq8gohqQroS8Q8OWBBoDcmjPdsGN+j/Uyo7T3xDBvRxjgumGOaVZtv8=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1770899164; c=relaxed/simple;\n\tbh=VQqn6a+78QBhypz3cIDDJv+6Rx276H7AhRWsW1CEyHI=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=YIc+FarcpwLZd4TR2U2Deu7X5oL1KA0U+0r8pY2qk0XFqvAtgTbHchdl9Nrcsb3I8BP7OenPvgd6Dd8FhVhA9b7UVaX97qsjhmPXskxQvumtnWO1q89HvYafcgWzBW7d3ZMJOa1JRGtiZIwr3WvaqTaNkmWhLsQROHCm6OHcTso=", "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": "<netfilter-devel@vger.kernel.org>", "Cc": "Florian Westphal <fw@strlen.de>", "Subject": "[PATCH nf-next 2/2] netfilter: nft_fib_ipv6: switch to fib6_lookup", "Date": "Thu, 12 Feb 2026 13:25:09 +0100", "Message-ID": "<20260212122547.10437-3-fw@strlen.de>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20260212122547.10437-1-fw@strlen.de>", "References": "<20260212122547.10437-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": "Existing code works but it requires a temporary dst object that is\nreleased again right away.\n\nSwitch to fib6_lookup + RT6_LOOKUP_F_DST_NOREF: no need for temporary dst\nobjects and refcount overhead anymore.\n\nProvides ~13% improvement in match performance.\n\nSigned-off-by: Florian Westphal <fw@strlen.de>\n---\n net/ipv6/netfilter/nft_fib_ipv6.c | 79 +++++++++++++++++++------------\n 1 file changed, 49 insertions(+), 30 deletions(-)", "diff": "diff --git a/net/ipv6/netfilter/nft_fib_ipv6.c b/net/ipv6/netfilter/nft_fib_ipv6.c\nindex 421036a3605b..4272a3f60b11 100644\n--- a/net/ipv6/netfilter/nft_fib_ipv6.c\n+++ b/net/ipv6/netfilter/nft_fib_ipv6.c\n@@ -52,7 +52,13 @@ static int nft_fib6_flowi_init(struct flowi6 *fl6, const struct nft_fib *priv,\n \tfl6->flowlabel = (*(__be32 *)iph) & IPV6_FLOWINFO_MASK;\n \tfl6->flowi6_l3mdev = nft_fib_l3mdev_master_ifindex_rcu(pkt, dev);\n \n-\treturn lookup_flags;\n+\treturn lookup_flags | RT6_LOOKUP_F_DST_NOREF;\n+}\n+\n+static int nft_fib6_lookup(struct net *net, struct flowi6 *fl6,\n+\t\t\t struct fib6_result *res, int flags)\n+{\n+\treturn fib6_lookup(net, fl6->flowi6_oif, fl6, res, flags);\n }\n \n static u32 __nft_fib6_eval_type(const struct nft_fib *priv,\n@@ -60,13 +66,14 @@ static u32 __nft_fib6_eval_type(const struct nft_fib *priv,\n \t\t\t\tstruct ipv6hdr *iph)\n {\n \tconst struct net_device *dev = NULL;\n+\tstruct fib6_result res = {};\n \tint route_err, addrtype;\n-\tstruct rt6_info *rt;\n \tstruct flowi6 fl6 = {\n \t\t.flowi6_iif = LOOPBACK_IFINDEX,\n \t\t.flowi6_proto = pkt->tprot,\n \t\t.flowi6_uid = sock_net_uid(nft_net(pkt), NULL),\n \t};\n+\tint lookup_flags;\n \tu32 ret = 0;\n \n \tif (priv->flags & NFTA_FIB_F_IIF)\n@@ -74,29 +81,23 @@ static u32 __nft_fib6_eval_type(const struct nft_fib *priv,\n \telse if (priv->flags & NFTA_FIB_F_OIF)\n \t\tdev = nft_out(pkt);\n \n-\tnft_fib6_flowi_init(&fl6, priv, pkt, dev, iph);\n+\tlookup_flags = nft_fib6_flowi_init(&fl6, priv, pkt, dev, iph);\n \n \tif (dev && nf_ipv6_chk_addr(nft_net(pkt), &fl6.daddr, dev, true))\n \t\tret = RTN_LOCAL;\n \n-\troute_err = nf_ip6_route(nft_net(pkt), (struct dst_entry **)&rt,\n-\t\t\t\t flowi6_to_flowi(&fl6), false);\n+\troute_err = nft_fib6_lookup(nft_net(pkt), &fl6, &res, lookup_flags);\n \tif (route_err)\n \t\tgoto err;\n \n-\tif (rt->rt6i_flags & RTF_REJECT) {\n-\t\troute_err = rt->dst.error;\n-\t\tdst_release(&rt->dst);\n-\t\tgoto err;\n-\t}\n+\tif (res.fib6_flags & RTF_REJECT)\n+\t\treturn RTN_PROHIBIT;\n \n-\tif (ipv6_anycast_destination((struct dst_entry *)rt, &fl6.daddr))\n+\tif (res.fib6_flags & RTF_ANYCAST)\n \t\tret = RTN_ANYCAST;\n-\telse if (!dev && rt->rt6i_flags & RTF_LOCAL)\n+\telse if (!dev && res.fib6_flags & RTF_LOCAL)\n \t\tret = RTN_LOCAL;\n \n-\tdst_release(&rt->dst);\n-\n \tif (ret)\n \t\treturn ret;\n \n@@ -152,6 +153,33 @@ static bool nft_fib_v6_skip_icmpv6(const struct sk_buff *skb, u8 next, const str\n \treturn ipv6_addr_type(&iph->daddr) & IPV6_ADDR_LINKLOCAL;\n }\n \n+static bool nft_fib6_info_nh_dev_match(const struct net_device *nh_dev,\n+\t\t\t\t const struct net_device *dev)\n+{\n+\treturn nh_dev == dev ||\n+\t l3mdev_master_ifindex_rcu(nh_dev) == dev->ifindex;\n+}\n+\n+static bool nft_fib6_info_nh_uses_dev(struct fib6_info *rt,\n+\t\t\t\t const struct net_device *dev)\n+{\n+\tconst struct net_device *nh_dev;\n+\tstruct fib6_info *iter;\n+\n+\tnh_dev = fib6_info_nh_dev(rt);\n+\tif (nft_fib6_info_nh_dev_match(nh_dev, dev))\n+\t\treturn true;\n+\n+\tlist_for_each_entry(iter, &rt->fib6_siblings, fib6_siblings) {\n+\t\tnh_dev = fib6_info_nh_dev(iter);\n+\n+\t\tif (nft_fib6_info_nh_dev_match(nh_dev, dev))\n+\t\t\treturn true;\n+\t}\n+\n+\treturn false;\n+}\n+\n void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs,\n \t\t const struct nft_pktinfo *pkt)\n {\n@@ -160,14 +188,14 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs,\n \tconst struct net_device *found = NULL;\n \tconst struct net_device *oif = NULL;\n \tu32 *dest = ®s->data[priv->dreg];\n+\tstruct fib6_result res = {};\n \tstruct ipv6hdr *iph, _iph;\n \tstruct flowi6 fl6 = {\n \t\t.flowi6_iif = LOOPBACK_IFINDEX,\n \t\t.flowi6_proto = pkt->tprot,\n \t\t.flowi6_uid = sock_net_uid(nft_net(pkt), NULL),\n \t};\n-\tstruct rt6_info *rt;\n-\tint lookup_flags;\n+\tint lookup_flags, ret;\n \n \tif (nft_fib_can_skip(pkt)) {\n \t\tnft_fib_store_result(dest, priv, nft_in(pkt));\n@@ -193,26 +221,17 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs,\n \tlookup_flags = nft_fib6_flowi_init(&fl6, priv, pkt, oif, iph);\n \n \t*dest = 0;\n-\trt = (void *)ip6_route_lookup(nft_net(pkt), &fl6, pkt->skb,\n-\t\t\t\t lookup_flags);\n-\tif (rt->dst.error)\n-\t\tgoto put_rt_err;\n-\n-\t/* Should not see RTF_LOCAL here */\n-\tif (rt->rt6i_flags & (RTF_REJECT | RTF_ANYCAST | RTF_LOCAL))\n-\t\tgoto put_rt_err;\n+\tret = nft_fib6_lookup(nft_net(pkt), &fl6, &res, lookup_flags);\n+\tif (ret || res.fib6_flags & (RTF_REJECT | RTF_ANYCAST | RTF_LOCAL))\n+\t\treturn;\n \n \tif (!oif) {\n-\t\tfound = rt->rt6i_idev->dev;\n+\t\tfound = fib6_info_nh_dev(res.f6i);\n \t} else {\n-\t\tif (oif == rt->rt6i_idev->dev ||\n-\t\t l3mdev_master_ifindex_rcu(rt->rt6i_idev->dev) == oif->ifindex)\n+\t\tif (nft_fib6_info_nh_uses_dev(res.f6i, oif))\n \t\t\tfound = oif;\n \t}\n-\n \tnft_fib_store_result(dest, priv, found);\n- put_rt_err:\n-\tip6_rt_put(rt);\n }\n EXPORT_SYMBOL_GPL(nft_fib6_eval);\n \n", "prefixes": [ "nf-next", "2/2" ] }