[PATCH v1] examples/l3fwd: fix core dump after packet match
Sean Morrissey
sean.morrissey at intel.com
Wed Sep 7 13:33:54 CEST 2022
This patch fixes a core dump which occurs on 32-bit-builds
after sending a matched packet due to overrunning an array.
Fixes: 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example")
Cc: sean.morrissey at intel.com
Cc: stable at dpdk.org
Signed-off-by: Sean Morrissey <sean.morrissey at intel.com>
---
examples/l3fwd/l3fwd_acl_scalar.h | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/examples/l3fwd/l3fwd_acl_scalar.h b/examples/l3fwd/l3fwd_acl_scalar.h
index cd99f8594a..542c303d3b 100644
--- a/examples/l3fwd/l3fwd_acl_scalar.h
+++ b/examples/l3fwd/l3fwd_acl_scalar.h
@@ -70,15 +70,12 @@ send_packets_single(struct lcore_conf *qconf, struct rte_mbuf *pkts[], uint16_t
/* Set MAC addresses. */
eth_hdr = rte_pktmbuf_mtod(pkts[j], struct rte_ether_hdr *);
- *(uint64_t *)ð_hdr->dst_addr = dest_eth_addr[hops[j]];
- rte_ether_addr_copy(&ports_eth_addr[hops[j]],
- ð_hdr->src_addr);
- }
-
- for (j = 0; j != nb_tx; j++) {
- if (hops[j] != BAD_PORT)
+ if (hops[j] != BAD_PORT) {
+ *(uint64_t *)ð_hdr->dst_addr = dest_eth_addr[hops[j]];
+ rte_ether_addr_copy(&ports_eth_addr[hops[j]],
+ ð_hdr->src_addr);
send_single_packet(qconf, pkts[j], hops[j]);
- else
+ } else
rte_pktmbuf_free(pkts[j]);
}
}
--
2.34.1
More information about the dev
mailing list