You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2026/04/13 11:47:09 UTC

(nuttx) 05/07: net/netfilter: fix match name for UDP in ipt_filter

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 244ddfcc2c07c202281d0fb502093ae4f476db4d
Author: zhanghongyu <zh...@xiaomi.com>
AuthorDate: Mon Apr 13 14:36:25 2026 +0800

    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 <zh...@xiaomi.com>
---
 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,