ipvs: drop the packets with port 0
Subsystems (3)
Julian Anastasov
maintainerPATCH 1/1 ipvs: drop the packets with port 0
Sashiko warns that ignoring connection with port 0 passes it to the local listener where it can be accepted. Instead of passing it we should drop it but after ensuring it is for IPVS service.
Link https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261103140308.591690-3-pablo%40netfilter.org
Fixes 3c3ff3b998fd ("ipvs: do not create conns from packets with port 0")
Signed-off-by Julian Anastasov <[email protected]>
--- net/netfilter/ipvs/ip_vs_proto_sctp.c | 10 ++++++---- net/netfilter/ipvs/ip_vs_proto_tcp.c | 10 ++++++---- net/netfilter/ipvs/ip_vs_proto_udp.c | 10 ++++++---- 3 files changed, 18 insertions(+), 12 deletions(-)
net/netfilter/ipvs/ip_vs_proto_sctp.c +6 -4
@@ -48,10 +48,6 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb,return 0 ; } -/* Do not create connection for port 0, skip the packet */ -if (!ports[0 ] || !ports[1 ]) -return 1 ; -if (likely (!ip_vs_iph_inverse (iph))) svc =ip_vs_service_find (ipvs, af, skb->mark, iph->protocol, &iph->daddr, ports[1 ]);
@@ -61,6 +57,12 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb,if (svc) {int ignored; +/* Do not create connection for port 0 */ +if (!ports[0 ] || !ports[1 ]) { + *verdict =NF_DROP ; +return 0 ; + } +if (ip_vs_todrop (ipvs)) {/* * It seems that we are very loaded.
net/netfilter/ipvs/ip_vs_proto_tcp.c +6 -4
@@ -63,10 +63,6 @@ tcp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb,return 0 ; } -/* Do not create connection for port 0, skip the packet */ -if (!ports[0 ] || !ports[1 ]) -return 1 ; -/* No !th->ack check to allow scheduling on SYN+ACK for Active FTP */ if (likely (!ip_vs_iph_inverse (iph)))
@@ -79,6 +75,12 @@ tcp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb,if (svc) {int ignored; +/* Do not create connection for port 0 */ +if (!ports[0 ] || !ports[1 ]) { + *verdict =NF_DROP ; +return 0 ; + } +if (ip_vs_todrop (ipvs)) {/* * It seems that we are very loaded.
net/netfilter/ipvs/ip_vs_proto_udp.c +6 -4
@@ -52,10 +52,6 @@ udp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb,return 0 ; } -/* Do not create connection for port 0, skip the packet */ -if (!ports[0 ] || !ports[1 ]) -return 1 ; -if (likely (!ip_vs_iph_inverse (iph))) svc =ip_vs_service_find (ipvs, af, skb->mark, iph->protocol, &iph->daddr, ports[1 ]);
@@ -66,6 +62,12 @@ udp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb,if (svc) {int ignored; +/* Do not create connection for port 0 */ +if (!ports[0 ] || !ports[1 ]) { + *verdict =NF_DROP ; +return 0 ; + } +if (ip_vs_todrop (ipvs)) {/* * It seems that we are very loaded.
Signature · 1 line
2.56.0