Skip to contentSkip to conversation

examples/l3fwd: fix compilation when DP debug on

PATCH Superseded Andrei-Niculae Petre 3 participants 6 messages Apr 14 – Nov 12

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/l3fwd: fix compilation when DP debug on

Previously, l3fwd example app would fail to compile ([1]) if one would put RTE_LOG_DP_LEVEL=RTE_LOG_DEBUG in config/rte_config.h and try to compile dpdk; this path was not enabled via compiling debug build (--buildtype=debug) alone, but needed the data path to be at debug level.

[1] https://bugs.dpdk.org/show_bug.cgi?id=1318

Bugzilla ID: 1318

Fixes 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example")
---
 .mailmap                   |  1 +
 MAINTAINERS                |  2 ++
 examples/l3fwd/l3fwd_acl.c | 27 ++++++++++++++-------------
 examples/l3fwd/l3fwd_acl.h |  6 ------
 4 files changed, 17 insertions(+), 19 deletions(-)
.mailmap +1 -0
index cdaa471715..df999d00d8 100644
@@ -106,6 +106,7 @@ Andre Muezerie <[email protected]> <[email protected]>
 Andre Richter <[email protected]>
 Andrea Arcangeli <[email protected]>
 Andrea Grandi <[email protected]>
+Andrei-Niculae Petre <[email protected]>
 Andrew Bailey <[email protected]>
 Andrew Boyer <[email protected]> <[email protected]>
 Andrew Harvey <[email protected]>
MAINTAINERS +2 -0
index 5683b87e4a..501f312ba1 100644
@@ -1740,6 +1740,8 @@ F: lib/acl/
 F: doc/guides/prog_guide/packet_classif_access_ctrl.rst
 F: app/test-acl/
 F: app/test/test_acl.*
+F: examples/l3fwd/l3fwd_acl*
+F: doc/guides/sample_app_ug/l3_forward.rst
 
 EFD
 M: Byron Marohn <[email protected]>
examples/l3fwd/l3fwd_acl.c +14 -13
index a1275e18bc..8e24f1c599 100644
@@ -235,6 +235,9 @@ enum {
 RTE_ACL_RULE_DEF(acl4_rule, RTE_DIM(ipv4_defs));
 RTE_ACL_RULE_DEF(acl6_rule, RTE_DIM(ipv6_defs));
 
+/* Must be included before acl_config definition to enable L3FWDACL_DEBUG */
+#include "l3fwd_acl.h"
+
 static struct {
 	struct rte_acl_ctx *acx_ipv4[NB_SOCKETS];
 	struct rte_acl_ctx *acx_ipv6[NB_SOCKETS];
@@ -251,8 +254,6 @@ static struct rte_acl_rule *acl_base_ipv4, *route_base_ipv4,
 static unsigned int acl_num_ipv4, route_num_ipv4,
 		acl_num_ipv6, route_num_ipv6;
 
-#include "l3fwd_acl.h"
-
 #include "l3fwd_acl_scalar.h"
 
 /*
@@ -773,7 +774,7 @@ read_config_files_acl(void)
 	}
 }
 
-void
+static void
 print_one_ipv4_rule(struct acl4_rule *rule, int extra)
 {
 	char abuf[INET6_ADDRSTRLEN];
@@ -800,7 +801,7 @@ print_one_ipv4_rule(struct acl4_rule *rule, int extra)
 			rule->data.userdata);
 }
 
-void
+static void
 print_one_ipv6_rule(struct acl6_rule *rule, int extra)
 {
 	unsigned char a, b, c, d;
@@ -855,17 +856,17 @@ print_one_ipv6_rule(struct acl6_rule *rule, int extra)
 
 #ifdef L3FWDACL_DEBUG
 static inline void
-dump_acl4_rule(struct rte_mbuf *m, uint32_t sig)
+dump_acl4_rule(const struct rte_mbuf *m, uint32_t sig)
 {
-	char abuf[INET6_ADDRSTRLEN];
+	char abuf[INET_ADDRSTRLEN];
 	uint32_t offset = sig & ~ACL_DENY_SIGNATURE;
 	struct rte_ipv4_hdr *ipv4_hdr =
 		rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *,
 					sizeof(struct rte_ether_hdr));
 
-	printf("Packet Src:%s ", inet_ntop(AF_INET, ipv4_hdr->src_addr,
+	printf("Packet Src:%s ", inet_ntop(AF_INET, &ipv4_hdr->src_addr,
 		abuf, sizeof(abuf)));
-	printf("Dst:%s ", inet_ntop(AF_INET, ipv4_hdr->dst_addr,
+	printf("Dst:%s ", inet_ntop(AF_INET, &ipv4_hdr->dst_addr,
 		abuf, sizeof(abuf)));
 
 	printf("Src port:%hu,Dst port:%hu ",
@@ -879,7 +880,7 @@ dump_acl4_rule(struct rte_mbuf *m, uint32_t sig)
 }
 
 static inline void
-dump_acl6_rule(struct rte_mbuf *m, uint32_t sig)
+dump_acl6_rule(const struct rte_mbuf *m, uint32_t sig)
 {
 	char abuf[INET6_ADDRSTRLEN];
 	uint32_t offset = sig & ~ACL_DENY_SIGNATURE;
@@ -888,10 +889,10 @@ dump_acl6_rule(struct rte_mbuf *m, uint32_t sig)
 					sizeof(struct rte_ether_hdr));
 
 	printf("Packet Src");
-	printf("%s", inet_ntop(AF_INET6, ipv6_hdr->src_addr,
+	printf("%s", inet_ntop(AF_INET6, &ipv6_hdr->src_addr,
 		abuf, sizeof(abuf)));
 	printf("\nDst");
-	printf("%s", inet_ntop(AF_INET6, ipv6_hdr->dst_addr,
+	printf("%s", inet_ntop(AF_INET6, &ipv6_hdr->dst_addr,
 		abuf, sizeof(abuf)));
 
 	printf("\nSrc port:%hu,Dst port:%hu ",
@@ -984,8 +985,8 @@ dump_denied_pkt(const struct rte_mbuf *pkt, uint32_t res)
 	if ((res & ACL_DENY_SIGNATURE) != 0) {
 		if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type))
 			dump_acl4_rule(pkt, res);
-		else if (RTE_ETH_IS_IPV6_HDR(pkt[i]->packet_type))
-			dump_acl6_rule(pkt[i], res[i]);
+		else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type))
+			dump_acl6_rule(pkt, res);
 	}
 #else
 	RTE_SET_USED(pkt);
examples/l3fwd/l3fwd_acl.h +0 -6
index 05af62fe10..a34a08eb7f 100644
@@ -48,10 +48,4 @@
  */
 #define FWD_PORT_SHIFT 1
 
-void
-print_one_ipv4_rule(struct acl4_rule *rule, int extra);
-
-void
-print_one_ipv6_rule(struct acl6_rule *rule, int extra);
-
 #endif /* L3FWD_ACL_H */
Signature · 1 line
2.39.5
#1 lore raw

PATCH v2 1/1 examples/l3fwd: fix compilation when DP debug on

Update l3fwd example app to fix compilation when building dpdk with RTE_LOG_DP_LEVEL=RTE_LOG_DEBUG in config/rte_config.h . Move l3fwd_acl.h include above all #ifdef L3FWDACL_DEBUG checks, as previously one ifdef would evaluate to false all the time (as header include was added too late).

Adapt maintainers line from previous examples/l3fwd-acl (removed in 6de0ea50e9b9) to examples/l3fwd/l3fwd_acl* after l3fwd-acl app unification into l3fwd. In 6de0ea50e9b9, a line with maintainer expertise was removed.

Own testing of the l3fwd example:
1. It now compiles with "#define RTE_LOG_DP_LEVEL RTE_LOG_DEBUG" in config/rte_config.h. See Bugzilla ID 1318 comments for full error seen before this patch.
2. I ran the l3fwd app with IPv4/IPv6 ACL rules to see the prints (when RTE_LOG_DP_LEVEL RTE_LOG_DEBUG is set) in the application around ACL work as expected. See extract below (I added \ to format to 72chars):

// dump_acl4_rule extract:
Packet Src:192.168.1.100 Dst:192.168.1.101 Src port:2048,Dst port:1846 \
hit ACL 1 - 192.168.1.100/24 0.0.0.0/0 0 : 65535 0 : 65535 0x0/0x0 \
0xffffffff-0x1ffffffe-0xf0000001

// dump_acl6_rule extract:
Packet Src2001:db8:1::100
Dst2001:db8:1::101
Src port:32768,Dst port:21005 hit ACL 0 - \
2001:0db8:0001:0000:0000:0000:0000:0000/64 \
0000:0000:0000:0000:0000:0000:0000:0000/0 0 : 65535 0 : 65535 \
0x0/0x0 0xffffffff-0x1fffffff-0xf0000000

Bugzilla ID: 1318

Fixes 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example")

---
v2
* Rebase from latest main
* Shrink/simplify patch by not making print_one_ipv*_rule static
* Test l3fwd app with acl rules and add to description

---
 .mailmap                   |  1 +
 MAINTAINERS                |  2 ++
 examples/l3fwd/l3fwd_acl.c | 23 ++++++++++++-----------
 3 files changed, 15 insertions(+), 11 deletions(-)
.mailmap +1 -0
index fcb3d1bb3f..01a4bedf97 100644
@@ -112,6 +112,7 @@ Andre Richter <[email protected]>
 Andrea Arcangeli <[email protected]>
 Andrea Grandi <[email protected]>
 Andrea Panattoni <[email protected]>
+Andrei-Niculae Petre <[email protected]> <[email protected]>
 Andrew Bailey <[email protected]>
 Andrew Boyer <[email protected]> <[email protected]>
 Andrew Harvey <[email protected]>
MAINTAINERS +2 -0
index e99a65d197..6b6446a998 100644
@@ -1756,6 +1756,8 @@ F: lib/acl/
 F: doc/guides/prog_guide/packet_classif_access_ctrl.rst
 F: app/test-acl/
 F: app/test/test_acl.*
+F: examples/l3fwd/l3fwd_acl*
+F: doc/guides/sample_app_ug/l3_forward.rst
 
 EFD
 M: Yipeng Wang <[email protected]>
examples/l3fwd/l3fwd_acl.c +12 -11
index 4ee3411d2a..6f39923140 100644
@@ -239,6 +239,9 @@ enum {
 RTE_ACL_RULE_DEF(acl4_rule, RTE_DIM(ipv4_defs));
 RTE_ACL_RULE_DEF(acl6_rule, RTE_DIM(ipv6_defs));
 
+/* Must be included before any L3FWDACL_DEBUG define check. */
+#include "l3fwd_acl.h"
+
 static struct {
 	struct rte_acl_ctx *acx_ipv4[NB_SOCKETS];
 	struct rte_acl_ctx *acx_ipv6[NB_SOCKETS];
@@ -255,8 +258,6 @@ static struct rte_acl_rule *acl_base_ipv4, *route_base_ipv4,
 static unsigned int acl_num_ipv4, route_num_ipv4,
 		acl_num_ipv6, route_num_ipv6;
 
-#include "l3fwd_acl.h"
-
 #include "l3fwd_acl_scalar.h"
 
 /*
@@ -859,17 +860,17 @@ print_one_ipv6_rule(struct acl6_rule *rule, int extra)
 
 #ifdef L3FWDACL_DEBUG
 static inline void
-dump_acl4_rule(struct rte_mbuf *m, uint32_t sig)
+dump_acl4_rule(const struct rte_mbuf *m, uint32_t sig)
 {
-	char abuf[INET6_ADDRSTRLEN];
+	char abuf[INET_ADDRSTRLEN];
 	uint32_t offset = sig & ~ACL_DENY_SIGNATURE;
 	struct rte_ipv4_hdr *ipv4_hdr =
 		rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *,
 					sizeof(struct rte_ether_hdr));
 
-	printf("Packet Src:%s ", inet_ntop(AF_INET, ipv4_hdr->src_addr,
+	printf("Packet Src:%s ", inet_ntop(AF_INET, &ipv4_hdr->src_addr,
 		abuf, sizeof(abuf)));
-	printf("Dst:%s ", inet_ntop(AF_INET, ipv4_hdr->dst_addr,
+	printf("Dst:%s ", inet_ntop(AF_INET, &ipv4_hdr->dst_addr,
 		abuf, sizeof(abuf)));
 
 	printf("Src port:%hu,Dst port:%hu ",
@@ -883,7 +884,7 @@ dump_acl4_rule(struct rte_mbuf *m, uint32_t sig)
 }
 
 static inline void
-dump_acl6_rule(struct rte_mbuf *m, uint32_t sig)
+dump_acl6_rule(const struct rte_mbuf *m, uint32_t sig)
 {
 	char abuf[INET6_ADDRSTRLEN];
 	uint32_t offset = sig & ~ACL_DENY_SIGNATURE;
@@ -892,10 +893,10 @@ dump_acl6_rule(struct rte_mbuf *m, uint32_t sig)
 					sizeof(struct rte_ether_hdr));
 
 	printf("Packet Src");
-	printf("%s", inet_ntop(AF_INET6, ipv6_hdr->src_addr,
+	printf("%s", inet_ntop(AF_INET6, &ipv6_hdr->src_addr,
 		abuf, sizeof(abuf)));
 	printf("\nDst");
-	printf("%s", inet_ntop(AF_INET6, ipv6_hdr->dst_addr,
+	printf("%s", inet_ntop(AF_INET6, &ipv6_hdr->dst_addr,
 		abuf, sizeof(abuf)));
 
 	printf("\nSrc port:%hu,Dst port:%hu ",
@@ -988,8 +989,8 @@ dump_denied_pkt(const struct rte_mbuf *pkt, uint32_t res)
 	if ((res & ACL_DENY_SIGNATURE) != 0) {
 		if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type))
 			dump_acl4_rule(pkt, res);
-		else if (RTE_ETH_IS_IPV6_HDR(pkt[i]->packet_type))
-			dump_acl6_rule(pkt[i], res[i]);
+		else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type))
+			dump_acl6_rule(pkt, res);
 	}
 #else
 	RTE_SET_USED(pkt);
Signature · 1 line
2.39.5
#2 lore raw
Quoted 45 lines · On Fri, 31 Jul 2026 16:37:39 +0300 Andrei-Niculae Petre <[email protected]>…

Update l3fwd example app to fix compilation when building dpdk with RTE_LOG_DP_LEVEL=RTE_LOG_DEBUG in config/rte_config.h . Move l3fwd_acl.h include above all #ifdef L3FWDACL_DEBUG checks, as previously one ifdef would evaluate to false all the time (as header include was added too late).

Adapt maintainers line from previous examples/l3fwd-acl (removed in 6de0ea50e9b9) to examples/l3fwd/l3fwd_acl* after l3fwd-acl app unification into l3fwd. In 6de0ea50e9b9, a line with maintainer expertise was removed.

Own testing of the l3fwd example:
1. It now compiles with "#define RTE_LOG_DP_LEVEL RTE_LOG_DEBUG" in config/rte_config.h. See Bugzilla ID 1318 comments for full error seen before this patch.
2. I ran the l3fwd app with IPv4/IPv6 ACL rules to see the prints (when RTE_LOG_DP_LEVEL RTE_LOG_DEBUG is set) in the application around ACL work as expected. See extract below (I added \ to format to 72chars):

// dump_acl4_rule extract:
Packet Src:192.168.1.100 Dst:192.168.1.101 Src port:2048,Dst port:1846 \
hit ACL 1 - 192.168.1.100/24 0.0.0.0/0 0 : 65535 0 : 65535 0x0/0x0 \
0xffffffff-0x1ffffffe-0xf0000001

// dump_acl6_rule extract:
Packet Src2001:db8:1::100
Dst2001:db8:1::101
Src port:32768,Dst port:21005 hit ACL 0 - \
2001:0db8:0001:0000:0000:0000:0000:0000/64 \
0000:0000:0000:0000:0000:0000:0000:0000/0 0 : 65535 0 : 65535 \
0x0/0x0 0xffffffff-0x1fffffff-0xf0000000

Bugzilla ID: 1318

Fixes 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example")

---

MAINTAINERS +0 -0
index e99a65d197..6b6446a998 100644

MAINTAINERS F: lib/acl/ · line 1760

Quoted 5 lines
MAINTAINERS +2 -0
@@ -1756,6 +1756,8 @@ F: lib/acl/
 F: doc/guides/prog_guide/packet_classif_access_ctrl.rst
 F: app/test-acl/
 F: app/test/test_acl.*
+F: examples/l3fwd/l3fwd_acl*
+F: doc/guides/sample_app_ug/l3_forward.rst

I don't think all of l3_forward should fall under the ACL maintainer bucket.

#3 lore raw
Quoted 43 lines · Stephen Hemminger
Quoted 39 lines · On Fri, 31 Jul 2026 16:37:39 +0300 Andrei-Niculae Petre <[email protected]>…

Update l3fwd example app to fix compilation when building dpdk with RTE_LOG_DP_LEVEL=RTE_LOG_DEBUG in config/rte_config.h . Move l3fwd_acl.h include above all #ifdef L3FWDACL_DEBUG checks, as previously one ifdef would evaluate to false all the time (as header include was added too late).

Adapt maintainers line from previous examples/l3fwd-acl (removed in 6de0ea50e9b9) to examples/l3fwd/l3fwd_acl* after l3fwd-acl app unification into l3fwd. In 6de0ea50e9b9, a line with maintainer expertise was removed.

Own testing of the l3fwd example:
1. It now compiles with "#define RTE_LOG_DP_LEVEL RTE_LOG_DEBUG" in config/rte_config.h. See Bugzilla ID 1318 comments for full error seen before this patch.
2. I ran the l3fwd app with IPv4/IPv6 ACL rules to see the prints (when RTE_LOG_DP_LEVEL RTE_LOG_DEBUG is set) in the application around ACL work as expected. See extract below (I added \ to format to 72chars):

// dump_acl4_rule extract:
Packet Src:192.168.1.100 Dst:192.168.1.101 Src port:2048,Dst port:1846 \
hit ACL 1 - 192.168.1.100/24 0.0.0.0/0 0 : 65535 0 : 65535 0x0/0x0 \
0xffffffff-0x1ffffffe-0xf0000001

// dump_acl6_rule extract:
Packet Src2001:db8:1::100
Dst2001:db8:1::101
Src port:32768,Dst port:21005 hit ACL 0 - \
2001:0db8:0001:0000:0000:0000:0000:0000/64 \
0000:0000:0000:0000:0000:0000:0000:0000/0 0 : 65535 0 : 65535 \
0x0/0x0 0xffffffff-0x1fffffff-0xf0000000

Bugzilla ID: 1318

Fixes 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example")

---

Quoted 14 lines

MAINTAINERS F: lib/acl/ · line 1760

Quoted 10 lines
MAINTAINERS +2 -0
index e99a65d197..6b6446a998 100644
@@ -1756,6 +1756,8 @@ F: lib/acl/
 F: doc/guides/prog_guide/packet_classif_access_ctrl.rst
 F: app/test-acl/
 F: app/test/test_acl.*
+F: examples/l3fwd/l3fwd_acl*
+F: doc/guides/sample_app_ug/l3_forward.rst

I don't think all of l3_forward should fall under the ACL maintainer bucket.

Hi Stephen,

I totally agree, but I didn't know of a better way to do this given all the info was merged in a single file post l3fwd unification. Do you or Konstantin have any better ideas how to do this instead to avoid losing information re ACL maintainer?

Thanks for checking the patch also.

Andrei

Quoted 1 line
#4 lore raw

PATCH v3 1/1 examples/l3fwd: fix compilation when DP debug on

In reply to Andrei-Niculae Petre

Update l3fwd example app to fix compilation when building dpdk with RTE_LOG_DP_LEVEL=RTE_LOG_DEBUG in config/rte_config.h . Move l3fwd_acl.h include above all #ifdef L3FWDACL_DEBUG checks, as previously one ifdef would evaluate to false all the time (as header include was added too late).

Adapt maintainers line from previous examples/l3fwd-acl (removed in 6de0ea50e9b9) to examples/l3fwd/l3fwd_acl* after l3fwd-acl app unification into l3fwd. In 6de0ea50e9b9, a line with maintainer expertise was removed.

Own testing of the l3fwd example:
1. It now compiles with "#define RTE_LOG_DP_LEVEL RTE_LOG_DEBUG" in config/rte_config.h. See Bugzilla ID 1318 comments for full error seen before this patch.
2. I ran the l3fwd app with IPv4/IPv6 ACL rules to see the prints (when RTE_LOG_DP_LEVEL RTE_LOG_DEBUG is set) in the application around ACL work as expected. See extract below (I added \ to format to 72chars):

// dump_acl4_rule extract:
Packet Src:192.168.1.100 Dst:192.168.1.101 Src port:2048,Dst port:1846 \
hit ACL 1 - 192.168.1.100/24 0.0.0.0/0 0 : 65535 0 : 65535 0x0/0x0 \
0xffffffff-0x1ffffffe-0xf0000001

// dump_acl6_rule extract:
Packet Src2001:db8:1::100
Dst2001:db8:1::101
Src port:32768,Dst port:21005 hit ACL 0 - \
2001:0db8:0001:0000:0000:0000:0000:0000/64 \
0000:0000:0000:0000:0000:0000:0000:0000/0 0 : 65535 0 : 65535 \
0x0/0x0 0xffffffff-0x1fffffff-0xf0000000

Bugzilla ID: 1318

Fixes 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example")

---
v3
* Drop l3_forward.rst addition from MAINTAINERS to avoid overmatching. v2
* Rebase from latest main
* Shrink/simplify patch by not making print_one_ipv*_rule static
* Test l3fwd app with acl rules and add to description

---
 .mailmap                   |  1 +
 MAINTAINERS                |  1 +
 examples/l3fwd/l3fwd_acl.c | 23 ++++++++++++-----------
 3 files changed, 14 insertions(+), 11 deletions(-)
.mailmap +1 -0
index 754dd9e760..844deef539 100644
@@ -115,6 +115,7 @@ Andre Richter <[email protected]>
 Andrea Arcangeli <[email protected]>
 Andrea Grandi <[email protected]>
 Andrea Panattoni <[email protected]>
+Andrei-Niculae Petre <[email protected]> <[email protected]>
 Andrew Bailey <[email protected]>
 Andrew Boyer <[email protected]> <[email protected]>
 Andrew Harvey <[email protected]>
MAINTAINERS +1 -0
index 1d865ffd46..386338a00a 100644
@@ -1757,6 +1757,7 @@ F: lib/acl/
 F: doc/guides/prog_guide/packet_classif_access_ctrl.rst
 F: app/test-acl/
 F: app/test/test_acl.*
+F: examples/l3fwd/l3fwd_acl*
 
 EFD
 M: Yipeng Wang <[email protected]>
examples/l3fwd/l3fwd_acl.c +12 -11
index 4ee3411d2a..6f39923140 100644
@@ -239,6 +239,9 @@ enum {
 RTE_ACL_RULE_DEF(acl4_rule, RTE_DIM(ipv4_defs));
 RTE_ACL_RULE_DEF(acl6_rule, RTE_DIM(ipv6_defs));
 
+/* Must be included before any L3FWDACL_DEBUG define check. */
+#include "l3fwd_acl.h"
+
 static struct {
 	struct rte_acl_ctx *acx_ipv4[NB_SOCKETS];
 	struct rte_acl_ctx *acx_ipv6[NB_SOCKETS];
@@ -255,8 +258,6 @@ static struct rte_acl_rule *acl_base_ipv4, *route_base_ipv4,
 static unsigned int acl_num_ipv4, route_num_ipv4,
 		acl_num_ipv6, route_num_ipv6;
 
-#include "l3fwd_acl.h"
-
 #include "l3fwd_acl_scalar.h"
 
 /*
@@ -859,17 +860,17 @@ print_one_ipv6_rule(struct acl6_rule *rule, int extra)
 
 #ifdef L3FWDACL_DEBUG
 static inline void
-dump_acl4_rule(struct rte_mbuf *m, uint32_t sig)
+dump_acl4_rule(const struct rte_mbuf *m, uint32_t sig)
 {
-	char abuf[INET6_ADDRSTRLEN];
+	char abuf[INET_ADDRSTRLEN];
 	uint32_t offset = sig & ~ACL_DENY_SIGNATURE;
 	struct rte_ipv4_hdr *ipv4_hdr =
 		rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *,
 					sizeof(struct rte_ether_hdr));
 
-	printf("Packet Src:%s ", inet_ntop(AF_INET, ipv4_hdr->src_addr,
+	printf("Packet Src:%s ", inet_ntop(AF_INET, &ipv4_hdr->src_addr,
 		abuf, sizeof(abuf)));
-	printf("Dst:%s ", inet_ntop(AF_INET, ipv4_hdr->dst_addr,
+	printf("Dst:%s ", inet_ntop(AF_INET, &ipv4_hdr->dst_addr,
 		abuf, sizeof(abuf)));
 
 	printf("Src port:%hu,Dst port:%hu ",
@@ -883,7 +884,7 @@ dump_acl4_rule(struct rte_mbuf *m, uint32_t sig)
 }
 
 static inline void
-dump_acl6_rule(struct rte_mbuf *m, uint32_t sig)
+dump_acl6_rule(const struct rte_mbuf *m, uint32_t sig)
 {
 	char abuf[INET6_ADDRSTRLEN];
 	uint32_t offset = sig & ~ACL_DENY_SIGNATURE;
@@ -892,10 +893,10 @@ dump_acl6_rule(struct rte_mbuf *m, uint32_t sig)
 					sizeof(struct rte_ether_hdr));
 
 	printf("Packet Src");
-	printf("%s", inet_ntop(AF_INET6, ipv6_hdr->src_addr,
+	printf("%s", inet_ntop(AF_INET6, &ipv6_hdr->src_addr,
 		abuf, sizeof(abuf)));
 	printf("\nDst");
-	printf("%s", inet_ntop(AF_INET6, ipv6_hdr->dst_addr,
+	printf("%s", inet_ntop(AF_INET6, &ipv6_hdr->dst_addr,
 		abuf, sizeof(abuf)));
 
 	printf("\nSrc port:%hu,Dst port:%hu ",
@@ -988,8 +989,8 @@ dump_denied_pkt(const struct rte_mbuf *pkt, uint32_t res)
 	if ((res & ACL_DENY_SIGNATURE) != 0) {
 		if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type))
 			dump_acl4_rule(pkt, res);
-		else if (RTE_ETH_IS_IPV6_HDR(pkt[i]->packet_type))
-			dump_acl6_rule(pkt[i], res[i]);
+		else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type))
+			dump_acl6_rule(pkt, res);
 	}
 #else
 	RTE_SET_USED(pkt);
Signature · 1 line
2.39.5
#5 lore raw

07/11/2026 23:17, Andrei-Niculae Petre:

Quoted 10 lines

Update l3fwd example app to fix compilation when building dpdk with RTE_LOG_DP_LEVEL=RTE_LOG_DEBUG in config/rte_config.h . Move l3fwd_acl.h include above all #ifdef L3FWDACL_DEBUG checks, as previously one ifdef would evaluate to false all the time (as header include was added too late).

Adapt maintainers line from previous examples/l3fwd-acl (removed in 6de0ea50e9b9) to examples/l3fwd/l3fwd_acl* after l3fwd-acl app unification into l3fwd. In 6de0ea50e9b9, a line with maintainer expertise was removed.

It is not related to the compilation fix, but OK to add this line.

Quoted 14 lines

Own testing of the l3fwd example:
1. It now compiles with "#define RTE_LOG_DP_LEVEL RTE_LOG_DEBUG" in config/rte_config.h. See Bugzilla ID 1318 comments for full error seen before this patch.
2. I ran the l3fwd app with IPv4/IPv6 ACL rules to see the prints (when RTE_LOG_DP_LEVEL RTE_LOG_DEBUG is set) in the application around ACL work as expected. See extract below (I added \ to format to 72chars):

// dump_acl4_rule extract:
Packet Src:192.168.1.100 Dst:192.168.1.101 Src port:2048,Dst port:1846 \
hit ACL 1 - 192.168.1.100/24 0.0.0.0/0 0 : 65535 0 : 65535 0x0/0x0 \
0xffffffff-0x1ffffffe-0xf0000001

Quoted 7 lines

// dump_acl6_rule extract:
Packet Src2001:db8:1::100
Dst2001:db8:1::101
Src port:32768,Dst port:21005 hit ACL 0 - \
2001:0db8:0001:0000:0000:0000:0000:0000/64 \
0000:0000:0000:0000:0000:0000:0000:0000/0 0 : 65535 0 : 65535 \
0x0/0x0 0xffffffff-0x1fffffff-0xf0000000

These testing results are unrelated. Dropped.

Quoted 6 lines

Bugzilla ID: 1318

Fixes 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example")

Applied, thanks.