examples/l3fwd: fix core dump after packet match
PATCH 1/1 examples/l3fwd: fix core dump after packet match
This patch fixes a core dump which occurs on 32-bit-builds after sending a matched packet due to overrunning an array.
--- examples/l3fwd/l3fwd_acl_scalar.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
examples/l3fwd/l3fwd_acl_scalar.h +5 -8
@@ -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]); } }
Signature · 1 line
2.34.1
Quoted 37 lines · Sean Morrissey
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")Signed-off-by Sean Morrissey <[email protected]>--- examples/l3fwd/l3fwd_acl_scalar.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)examples/l3fwd/l3fwd_acl_scalar.h +5
-8@@ -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]); } }
Signature · 2 lines
Regards, Vladimir
Quoted 12 lines
-----Original Message-----
From: Sean Morrissey <[email protected]>
Sent: Wednesday, September 7, 2022 7:34 PM
To: Konstantin Ananyev <[email protected]>; Morrissey, Sean <[email protected]>
Cc: [email protected]; [email protected]
Subject: [PATCH v1] examples/l3fwd: fix core dump after packet matchThis patch fixes a core dump which occurs on 32-bit-builds after sending a matched packet due to overrunning an array.
Quoted 6 lines
Fixes 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example")Signed-off-by Sean Morrissey <[email protected]>---
Thomas Monjalon
AppliedQuoted 9 lines
Quoted 8 lines
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")Signed-off-by Sean Morrissey <[email protected]>Tested-by Lingli Chen <[email protected]>
Applied, thanks.