From: netdev-bot+sashiko@kernel.org
To: pablo@netfilter.org
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
Subject: Re: [PATCH net 03/11] ipvs: reject FTP control ports as data ports
Date: Tue, 17 Nov 2026 01:40:29 +0000 [thread overview]
Message-ID: <179487962993.3136.14851480745296161932@kernel.org> (raw)
In-Reply-To: <20261116004404.2821183-4-pablo@netfilter.org>
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
next prev parent reply other threads:[~2026-11-17 1:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 0:43 [PATCH net,v2 00/11] IPVS fixes for net Pablo Neira Ayuso
2026-11-16 0:43 ` [PATCH net 01/11] ipvs: fix problems during connection deletion Pablo Neira Ayuso
2026-11-16 0:47 ` netdev-bot+sinfo
2026-11-16 0:48 ` Pablo Neira Ayuso
2026-11-16 0:43 ` [PATCH net 02/11] ipvs: avoid stack overflow from recursive connection expiration Pablo Neira Ayuso
2026-11-16 0:43 ` [PATCH net 03/11] ipvs: reject FTP control ports as data ports Pablo Neira Ayuso
2026-11-17 1:40 ` netdev-bot+sashiko [this message]
2026-11-16 0:43 ` [PATCH net 04/11] ipvs: ftp: skip conntrack templates in ip_vs_ftp_out Pablo Neira Ayuso
2026-11-16 0:43 ` [PATCH net 05/11] ipvs: update flags and seqs in backup server under lock Pablo Neira Ayuso
2026-11-17 1:40 ` netdev-bot+sashiko
2026-11-16 0:43 ` [PATCH net 06/11] ipvs: read flags and seqs in master atomically Pablo Neira Ayuso
2026-11-16 0:44 ` [PATCH net 07/11] ipvs: honor the overload state and do not enter it forever Pablo Neira Ayuso
2026-11-16 0:44 ` [PATCH net 08/11] ipvs: validate cport in received sync records Pablo Neira Ayuso
2026-11-16 0:44 ` [PATCH net 09/11] ipvs: skip cport 0 connections in ip_vs_conn_out_get() Pablo Neira Ayuso
2026-11-17 1:40 ` netdev-bot+sashiko
2026-11-16 0:44 ` [PATCH net 10/11] ipvs: do not create conns from packets with port 0 Pablo Neira Ayuso
2026-11-17 1:40 ` netdev-bot+sashiko
2026-11-16 0:44 ` [PATCH net 11/11] ipvs: wait grace period before reusing destinations Pablo Neira Ayuso
2026-11-17 1:40 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179487962993.3136.14851480745296161932@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=ja@ssi.bg \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox