Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [91.216.245.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 169863A9605 for ; Thu, 9 Apr 2026 11:34:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.216.245.30 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775734463; cv=none; b=JIeugEQfAsgK5DpmIgy8we9jNvSS3aDwhw7ugHKe/CK004y16sJlNumbvOcNfUGWyirfPwFM3AIjJvt3bxn/OTdVZTbTxGQHWJIzEyqunQ//sBZCmozgdKmVltiHQ0hbuVG1S3zmjlxfzDyQ2CwH5sesMX4XCfb1OC1E86ywDbA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775734463; c=relaxed/simple; bh=+a511TALgLeqqdMEIBAs3WNphGKFqiU3hbVlYwW0ZRs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Y/ubsBmpbwsqsxFTmrUNTgVAPfDE9QW45LtoVN7lcrb2XTjWbQUwIXvp00QP7PjxJ7vBiPbYNK9hLUPbttPDInS+gLikfWB2MBqjTZpE2d1Kl5eH4+Y6K7j8gv+MZWoHuvn8L9MhEnuVFvQcABY++Rq8Rzheb6mR5XA8YstzvvI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de; spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc; arc=none smtp.client-ip=91.216.245.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc Received: by Chamillionaire.breakpoint.cc (Postfix, from userid 1003) id B780360636; Thu, 09 Apr 2026 13:34:19 +0200 (CEST) From: Florian Westphal To: Cc: Florian Westphal Subject: [PATCH nf-next] netfilter: nft_fwd_netdev: check ttl/hl before forwarding Date: Thu, 9 Apr 2026 13:34:09 +0200 Message-ID: <20260409113414.5800-1-fw@strlen.de> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: netfilter-devel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Drop packets if their ttl/hl is too small for forwarding. Fixes: d32de98ea70f ("netfilter: nft_fwd_netdev: allow to forward packets via neighbour layer") Signed-off-by: Florian Westphal --- net/netfilter/nft_fwd_netdev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/netfilter/nft_fwd_netdev.c b/net/netfilter/nft_fwd_netdev.c index 5804609c63ab..fb3a84dc7bd9 100644 --- a/net/netfilter/nft_fwd_netdev.c +++ b/net/netfilter/nft_fwd_netdev.c @@ -116,6 +116,11 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr, goto out; } iph = ip_hdr(skb); + if (iph->ttl <= 1) { + verdict = NF_DROP; + goto out; + } + ip_decrease_ttl(iph); neigh_table = NEIGH_ARP_TABLE; break; @@ -132,6 +137,11 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr, goto out; } ip6h = ipv6_hdr(skb); + if (ip6h->hop_limit <= 1) { + verdict = NF_DROP; + goto out; + } + ip6h->hop_limit--; neigh_table = NEIGH_ND_TABLE; break; -- 2.52.0