Skip to contentSkip to conversation

net: airoha: Fix debugfs new-tuple display for IPv4 ROUTE entries

PATCH Superseded Wayen.Yan 2 participants 2 messages Jun 11 – Jun 12

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wayen.Yan

author
#0 lore raw

PATCH 1/1 net: airoha: Fix debugfs new-tuple display for IPv4 ROUTE entries

In airoha_ppe_debugfs_foe_show(), the second switch statement falls through from PPE_PKT_TYPE_IPV4_HNAPT/DSLITE to PPE_PKT_TYPE_IPV4_ROUTE, accessing hwe->ipv4.new_tuple for all three types. However, IPv4 ROUTE (3-tuple) entries do not contain a valid new_tuple — this field is only meaningful for NATted flows (HNAPT/DSLITE). For ROUTE entries, the memory at the new_tuple offset holds routing information, not NAT data, so displaying "new=" produces garbage output.

Split the fallthrough: display new_tuple only for HNAPT and DSLITE, and add an explicit empty case for IPV4_ROUTE.

Fixes 3fe15c640f38 ("net: airoha: Introduce PPE debugfs support")
---
 drivers/net/ethernet/airoha/airoha_ppe_debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/airoha/airoha_ppe_debugfs.c +2 -2
index 0112c41..f9c12e7 100644
@@ -121,8 +121,6 @@ static int airoha_ppe_debugfs_foe_show(struct seq_file *m, void *private,
 		case PPE_PKT_TYPE_IPV4_DSLITE:
 			src_port = &hwe->ipv4.new_tuple.src_port;
 			dest_port = &hwe->ipv4.new_tuple.dest_port;
-			fallthrough;
-		case PPE_PKT_TYPE_IPV4_ROUTE:
 			src_addr = &hwe->ipv4.new_tuple.src_ip;
 			dest_addr = &hwe->ipv4.new_tuple.dest_ip;
 			seq_puts(m, " new=");
@@ -130,6 +128,8 @@ static int airoha_ppe_debugfs_foe_show(struct seq_file *m, void *private,
 						       src_port, dest_port,
 						       ipv6);
 			break;
+		case PPE_PKT_TYPE_IPV4_ROUTE:
+			break;
 		default:
 			break;
 		}
Signature · 1 line
2.51.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 31 lines

In airoha_ppe_debugfs_foe_show(), the second switch statement falls through from PPE_PKT_TYPE_IPV4_HNAPT/DSLITE to PPE_PKT_TYPE_IPV4_ROUTE, accessing hwe->ipv4.new_tuple for all three types. However, IPv4 ROUTE (3-tuple) entries do not contain a valid new_tuple — this field is only meaningful for NATted flows (HNAPT/DSLITE). For ROUTE entries, the memory at the new_tuple offset holds routing information, not NAT data, so displaying "new=" produces garbage output.

Split the fallthrough: display new_tuple only for HNAPT and DSLITE, and add an explicit empty case for IPV4_ROUTE.

Fixes 3fe15c640f38 ("net: airoha: Introduce PPE debugfs support")
---
 drivers/net/ethernet/airoha/airoha_ppe_debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/airoha/airoha_ppe_debugfs.c +0 -2
index 0112c41..f9c12e7 100644
@@ -121,8 +121,6 @@ static int airoha_ppe_debugfs_foe_show(struct seq_file *m, void *private,
 		case PPE_PKT_TYPE_IPV4_DSLITE:
 			src_port = &hwe->ipv4.new_tuple.src_port;
 			dest_port = &hwe->ipv4.new_tuple.dest_port;
-			fallthrough;
-		case PPE_PKT_TYPE_IPV4_ROUTE:
 			src_addr = &hwe->ipv4.new_tuple.src_ip;
 			dest_addr = &hwe->ipv4.new_tuple.dest_ip;
 			seq_puts(m, " new=");

drivers/net/ethernet/airoha/airoha_ppe_debugfs.c static int airoha_ppe_debugfs_foe_show(struct seq_file *m, void *private, · line 131

Quoted 4 lines
drivers/net/ethernet/airoha/airoha_ppe_debugfs.c +1 -0
@@ -130,6 +128,8 @@ static int airoha_ppe_debugfs_foe_show(struct seq_file *m, void *private,
 						       src_port, dest_port,
 						       ipv6);
 			break;
+		case PPE_PKT_TYPE_IPV4_ROUTE:

I guess you can just drop PPE_PKT_TYPE_IPV4_ROUTE and use the default case. Fixing it:

Quoted 8 lines
drivers/net/ethernet/airoha/airoha_ppe_debugfs.c +1 -0
+			break;
 		default:
 			break;
 		}
Signature · 1 line
2.51.0