From 244ddfcc2c07c202281d0fb502093ae4f476db4d Mon Sep 17 00:00:00 2001 From: zhanghongyu Date: Mon, 13 Apr 2026 14:36:25 +0800 Subject: [PATCH] net/netfilter: fix match name for UDP in ipt_filter In both convert_ipv4entry() and convert_ipv6entry(), the IPPROTO_UDP case was incorrectly comparing against XT_MATCH_NAME_TCP instead of XT_MATCH_NAME_UDP. This caused UDP filter rules to never match. Signed-off-by: zhanghongyu --- net/netfilter/ipt_filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netfilter/ipt_filter.c b/net/netfilter/ipt_filter.c index b2587e54493..2a92ce8db1d 100644 --- a/net/netfilter/ipt_filter.c +++ b/net/netfilter/ipt_filter.c @@ -251,7 +251,7 @@ convert_ipv4entry(FAR const struct ipt_entry *entry) break; case IPPROTO_UDP: - if (strcmp(match->u.user.name, XT_MATCH_NAME_TCP) == 0) + if (strcmp(match->u.user.name, XT_MATCH_NAME_UDP) == 0) { FAR struct xt_udp *udp = (FAR struct xt_udp *)(match + 1); convert_tcpudp(&filter->common, udp->spts, udp->dpts, @@ -326,7 +326,7 @@ convert_ipv6entry(FAR const struct ip6t_entry *entry) break; case IPPROTO_UDP: - if (strcmp(match->u.user.name, XT_MATCH_NAME_TCP) == 0) + if (strcmp(match->u.user.name, XT_MATCH_NAME_UDP) == 0) { FAR struct xt_udp *udp = (FAR struct xt_udp *)(match + 1); convert_tcpudp(&filter->common, udp->spts, udp->dpts,