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 05/15] ipvs: reject FTP control ports as data ports
Date: Sat, 14 Nov 2026 02:15:42 +0000 [thread overview]
Message-ID: <179462254263.2199510.8837041620739510741@kernel.org> (raw)
In-Reply-To: <20261113011447.2357709-6-pablo@netfilter.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
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 two new rejection checks in ip_vs_ftp_in() and
ip_vs_ftp_out() return 0.
--
ipvs: reject FTP control ports as data ports
This patch adds is_control_port() to the IPVS FTP helper and uses it to
refuse a zero port, or a configured FTP control port, as a data port.
ip_vs_ftp_out() refuses such ports in PASV/EPSV replies. ip_vs_ftp_in()
refuses PORT/EPRT commands that carry a zero port, or where vport - 1 is
a control port.
> 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;
> +
[Severity: Medium]
Does returning 0 here stall the whole FTP control connection, rather than
only refusing the data connection?
The pkt_in/pkt_out contract in include/net/ip_vs.h treats 0 as an error:
Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok,
On the inbound side, tcp_dnat_handler() passes that result up:
if (!(ret = ip_vs_app_pkt_in(cp, skb, iph)))
return 0;
ip_vs_nat_xmit() then takes the tx_error path and frees the skb. The
segment that carries the PORT/EPRT command is dropped.
cp->vport is fixed for the life of the connection, and ip_vs_ftp_in()
keeps no state for this case. Every retransmission of that segment is
parsed the same way and dropped again. Nothing after it in the TCP stream
gets through until the client's TCP gives up (tcp_retries2).
If vport - 1 is also in the ports module parameter (for example
ports=2120,2121), would active mode hang for every client of that service?
A client that sends PORT/EPRT with port 0 would hang its own session the
same way.
The check added to ip_vs_ftp_out() above behaves similarly. It returns 0
while cp->app_data is still IP_VS_FTP_PASV or IP_VS_FTP_EPSV, and
tcp_snat_handler() passes that up:
if (!(ret = ip_vs_app_pkt_out(cp, skb, iph)))
return 0;
handle_response() then drops the 227/229 reply. The server retransmits
it, the same port is parsed again, and the reply is dropped again.
The existing ret = 0 path at the end of ip_vs_ftp_out() sets
cp->app_data = IP_VS_FTP_ACTIVE before it returns, so it never re-parses
the reply. The ip_vs_conn_new() failure return is transient, which fits
the existing "hopefully it will succeed on the retransmitted packet"
comment. The new checks reject the same input every time.
Could ip_vs_ftp_in() return 1 here without creating the data connection,
since nothing is mangled on that path anyway? And could ip_vs_ftp_out()
set cp->app_data to IP_VS_FTP_ACTIVE before rejecting, so that only the
data connection fails?
> /* Passive mode off */
> cp->app_data = (void *) IP_VS_FTP_ACTIVE;
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113011447.2357709-2-pablo%40netfilter.org
next prev parent reply other threads:[~2026-11-14 2:15 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 1:14 [PATCH net 00/15] IPVS fixes for net Pablo Neira Ayuso
2026-11-13 1:14 ` [PATCH net 01/15] ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6 Pablo Neira Ayuso
2026-11-13 1:16 ` netdev-bot+sinfo
2026-11-13 3:17 ` Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 02/15] ipv6: update *offset for non-first fragments in ipv6_find_hdr() Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 03/15] ipvs: fix problems during connection deletion Pablo Neira Ayuso
2026-11-13 1:14 ` [PATCH net 04/15] ipvs: avoid stack overflow from recursive connection expiration Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 05/15] ipvs: reject FTP control ports as data ports Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko [this message]
2026-11-13 1:14 ` [PATCH net 06/15] ipvs: ftp: skip conntrack templates in ip_vs_ftp_out Pablo Neira Ayuso
2026-11-13 1:14 ` [PATCH net 07/15] ipvs: ftp: add seqadj extension before linking the expectation Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 08/15] ipvs: update flags and seqs in backup server under lock Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 09/15] ipvs: read flags and seqs in master atomically Pablo Neira Ayuso
2026-11-13 1:14 ` [PATCH net 10/15] ipvs: honor the overload state and do not enter it forever Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 11/15] ipvs: validate cport in received sync records Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 12/15] ipvs: skip cport 0 connections in ip_vs_conn_out_get() Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 13/15] ipvs: do not create conns from packets with port 0 Pablo Neira Ayuso
2026-11-13 1:14 ` [PATCH net 14/15] ipvs: wait grace period before reusing destinations Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 15/15] ipvs: pass correct sk to update_pmtu and on tunneling Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 22:34 ` [PATCH net 00/15] IPVS fixes for net Pablo Neira Ayuso
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=179462254263.2199510.8837041620739510741@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