Article View: linux.kernel.netdev
Article #17559Re: [PATCH net 03/11] ipvs: reject FTP control ports as data ports
From: netdev-bot+sashiko
Date: Tue, 17 Nov 2026 01:40
Date: Tue, 17 Nov 2026 01:40
148 lines
13209 bytes
13209 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The new rejection checks in ip_vs_ftp_out() and ip_vs_ftp_in()
(net/netfilter/ipvs/ip_vs_ftp.c) return 0.
- [Low] The commit message says that accepting a control port as a data
port 'leads to recursive expiration and kernel stack exhaustion'.
--
ipvs: reject FTP control ports as data ports
This patch adds is_control_port() to the IPVS FTP helper. Before a data
connection is created, the helper now rejects zero ports and configured
FTP control ports. In passive mode it checks the port from the server's
PASV/EPSV reply; in active mode it checks the client port and the derived
data port (vport - 1).
> The FTP helper must not treat a configured control port as a data port.
> Accepting such a port can leave IPVS connections in a state that leads
> to recursive expiration and kernel stack exhaustion.
[Severity: Low]
Is this rationale still accurate once the previous patch in this series
is applied?
"ipvs: avoid stack overflow from recursive connection expiration" already
rewrote ip_vs_conn_expire() so that it walks the ->control chain
iteratively, in a single stack frame:
net/netfilter/ipvs/ip_vs_conn.c:ip_vs_conn_expire() {
...
next = ip_vs_conn_del_reference(ct);
...
if (next) {
cp = ct;
goto repeat;
}
...
}
With that change, the recursive expiration described here should no
longer happen in this tree.
Could the commit message point to the companion commit and say what this
guard still prevents now that expiration is iterative? Two candidates are
long chains of FTP-bound data connections, and NO_CPORT entries on
VIP:control-port capturing the client's new control connections.
Both commits carry Cc: stable, but with different Fixes: tags
(f9200a52eedf and 1da177e4c3f4). A stable backporter can't tell from the
messages whether the two are alternatives or must both be applied.
> diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
> index 9e3e005a82635..4822a1a75212d 100644
> --- a/net/netfilter/ipvs/ip_vs_ftp.c
> +++ b/net/netfilter/ipvs/ip_vs_ftp.c
[ ... ]
> @@ -319,6 +330,10 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
> return 1;
> }
>
> + /* Do not redirect data to control ports */
> + if (!port || is_control_port(ntohs(port)))
> + return 0;
> +
> /* Now update or create a connection entry for it */
> {
> struct ip_vs_conn_param p;
> @@ -529,6 +544,9 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
> return 1;
> }
>
> + if (!port || is_control_port(ntohs(cp->vport) - 1))
> + return 0;
> +
> /* Passive mode off */
> cp->app_data = (void *) IP_VS_FTP_ACTIVE;
>
[Severity: Medium]
Should these new checks return 0? In include/net/ip_vs.h, struct
ip_vs_app documents pkt_out/pkt_in as:
Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok,
The callers drop the packet when they get 0:
ip_vs_ftp_in() returns 0
tcp_dnat_handler() returns 0
ip_vs_nat_xmit()
if (pp->dnat_handler && !pp->dnat_handler(skb, pp, cp, ipvsh))
goto tx_error;
ip_vs_ftp_out() returns 0
tcp_snat_handler() returns 0
handle_response()
if (pp->snat_handler &&
!SNAT_CALL(pp->snat_handler, skb, pp, cp, iph))
goto drop;
So instead of just skipping the data connection, the FTP control segment
itself seems to be dropped silently.
In ip_vs_ftp_in(), the is_control_port(ntohs(cp->vport) - 1) test depends
only on configuration, not on packet contents. Take an FTP virtual service
on port V where V-1 is also in the ports= module parameter (for example
ports=20,21 or ports=2120,2121). Wouldn't every PORT/EPRT command on V be
dropped, retransmissions included? The control session would then stall
until TCP gives up, and nothing would be logged.
Before this patch, active-mode FTP worked in that configuration. The data
connection was created with vport V-1, and tcp_app_conn_bind() also bound
it to the FTP app, because binding depends only on the vport.
In ip_vs_ftp_out(), the return 0 comes before cp->app_data is reset to
IP_VS_FTP_ACTIVE. Wouldn't each retransmitted 227/229 reply then be parsed
and dropped again? A comment later in that function justifies a 0 return
only because mangling failures are transient:
* Mangling can only fail under memory pressure,
* hopefully it will succeed on the retransmitted
* packet.
This rejection isn't transient.
Would returning 1 work better here? The payload would pass through
unmangled and no data connection would be created. The control session
would survive (the server reports a data connection failure), and the
self-binding would still be prevented. A rate-limited log message might
also help.
Since this is tagged for stable, could the commit message also say that
active FTP stops working when V-1 is also a configured control port?
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116004404.2821183-2-pablo%40netfilter.org
Technical Details
Message-ID:
<179487962993.3136.14851480745296161932@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364879-linux-kernel-netdev=dewy.ruReferences:
<20261116004404.2821183-4-pablo@netfilter.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364879-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 03/11] ipvs: reject FTP control ports as data ports Date: Tue, 17 Nov 2026 01:40:29 +0000 Organization: Usenet Network Message-ID: <179487962993.3136.14851480745296161932@kernel.org> References: <20261116004404.2821183-4-pablo@netfilter.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2214500"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:gp+A0UO+E3bWIZEp2z0h3rqttQo= sha256:ZMasR4FqrAyrcLjxQG1yT1xICVyWcP+j1PgLATWEgBs= sha1:8VyOQ9805fjptMrynIbedK9ZU1c= sha256:rY0X4lPvPVAJgfmtCKcR2rJRVFe5UBDoP4JFKhaqxIc= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id E5BA6114E09; Tue, 17 Nov 2026 04:40:45 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6f0En0AJkWw5; Tue, 17 Nov 2026 04:40:42 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-364879-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id CC717114E01; Tue, 17 Nov 2026 04:40:33 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 5A1882A656; Tue, 17 Nov 2026 01:40:32 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794879632; b=rztT/GGL1O5lBJHPGHbT26tmBzc523JkXp2kOzKxco7ayboV4/hZIyMnYcL//eqU73PD nCSHafB5Ac1yBmSxDGuNlxfmGp2gEKqSVtoVdvt14JnE2k8SQpkYZcbYF4xDJ3d+JbhV5 HV2/2d822IoGbyrcDrJVhYq+X/mE36cyWdBOTSstRxSmPSVJhwANVuQyJi1+pzhkQobOx GuzCIutsWMTtCKeGv6UAGokrRelwOS2+Zc9uT0ilvkVNl9dvVuOqDBXn1uslgK5bg5keR 4Fd0RtnYJtA1u755Ve7n0PVNO963dsCXG8UCupJz8gRXUTaqCZGjch8s9gS4NM4PemA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794879632; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=P/78TN4zpBip53jvAVPl/wLOQX6H0z2TVhUcsrZra6E=; b=ozkfbk6FN3musC0JHS+va7OL4bFWP47J9pybXIzIE0gYIVo10CcMvsp46VJ9DPvluYsp hXe+HiVcAxi6UwPT10Rh+DcyJ6UljyfvuYOVTHT+aM9XJSFIjiwDD66Ay4OZU9cLIMKGu b/suzPHuDBWqNdwuB/z1JQ1WjK2jr/j0G4VYrrk9So5/DHgTjDZIqDX4aZRNnREtLhQr4 /kBkaG9ezmJt6oI7F8kzGMjRttFmm26HiZdc7e8k75ECmxwPcarbesbehPAlpbiZu4+9j z85O1mimsBQEIy9ujaNwS/DWs3qt4950pPWlX007NH8ahfaGct6iv5IcMsgr/HS+W9g== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ToUd9lRc; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD83B606A336; Tue, 17 Nov 2026 01:40:31 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ToUd9lRc X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794879631; b=CHeSSLlIyQohxfQkxdv6q8+3TF7zLZ4B8oesMuaB4xpDCA41xl4IAaU8Ree8OeImS4Th npV/VoSoNAu39gktNcwdCyQlC52GwKD9hX7N3ValbJoqmbv0vmoE+tfFBKQ/SzMsUFH9i NFKPXlI9X3lDtQGblkFYcAzelHaDBuu3T72z6vF9PjiY4DZfcPVkvAeFg+gdYe4wcSEo+ 3iINObm0aJAZp6AJRvzT8NeI2/newyg+e41OM/Gye0tCbo5VcrPBzVRQoWbDwRaAqpB5n RopthlibIP3kD7ZCKNwHI+zdkzf0ivvDCtQ3wj2qg933rjoLXhHS65Vib4CRxlshzWQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794879631; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=P/78TN4zpBip53jvAVPl/wLOQX6H0z2TVhUcsrZra6E=; b=dW48Wp4I2QSjlVaxa8bcPEk7b5SDJ7vC5jtHgD/w0A++CHVtKUyPzdb5A4gDgvi9H5aM kBDyFWgSR4x0FRx8VZSyJ2NBg7y5Um7O4XQmoeMZJmBycSNuuM78X4yTU2Rq2T6R1I+CQ Bh5XFVDf77n/HaT6zfgxCvdsW9ztzyWerLVQnsLA0zscDknHH8YjIyJNPCS4CUahzqges yLfFYqBD4ia1OuPrA0xuoLXixM5YtWkAvzuwvuAbtaXkHd3Zq8hgsRAKUZ+wDbGW1Xi8P hUSt4X2nYgU0T0JARixiG+zJQNjZogToG1nFeB4712Lcu7bIAMnduyIyxgbD6Lf1jkg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ToUd9lRc; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08FD9606A31C; Tue, 17 Nov 2026 01:40:31 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 606E91F000C4; Tue, 17 Nov 2026 01:40:30 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794879630; bh=P/78TN4zpBip53jvAVPl/wLOQX6H0z2TVhUcsrZra6E=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=ToUd9lRcul3MhHeYazGHa4iNRWaz415Rkdyk+NVAPcWIinJpkK/7umKiIfWhl8JSs iZYrzx7DSTN7Qm7lH209TLFF1xuI8w08jiq67FMCozYGf26ZM44+1CtZrhn04E8wPD wHJThCDse6mi53Fne/Itw6cAwP7CGNOXK3KDSSgy9ANOnpYiw/olxic2nkWvJT8yz6 foGFKsVYT9HVRP96m+9Z6h2K7T60/8AZCICPiLcPLrSEbDz8hm6Bz4pOkRBtra9B8/ PvEikZalPq4/nrRPFHrCeTmsnEoMeh3c2Ab6nn+sPFtyT/eBwDyk0JfRO3jMMXAgXW Pmd4ibXYgVyeQ== X-Cc: netfilter-devel@vger.kernel.org, davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com, edumazet@kernel.org, horms@kernel.org, fw@strlen.de, ja@ssi.bg X-In-Reply-To: <20261116004404.2821183-4-pablo@netfilter.org> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list