DPDK patches and discussions
 help / color / mirror / Atom feed
From: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
To: dev@dpdk.org
Cc: Konstantin Ananyev <konstantin.ananyev@huawei.com>, stable@dpdk.org
Subject: [PATCH 1/2] examples/l3fwd: fix crash in ACL mode for mixed traffic
Date: Thu,  2 May 2024 16:28:15 +0100	[thread overview]
Message-ID: <20240502152816.65562-2-konstantin.v.ananyev@yandex.ru> (raw)
In-Reply-To: <20240502152816.65562-1-konstantin.v.ananyev@yandex.ru>

From: Konstantin Ananyev <konstantin.ananyev@huawei.com>

When running l3fwd in ACL mode, if we'll have mix of IPv4/IPv6 packets in
the same burst, it will most likely cause a crash.
The reason for that is that we split our burst of packets into 2 arrays -
one for ipv4, another for ipv6 for classify().
But then we try to send all packets as one burst again, not taking into account
that acl_search.res_ipv4[] will be set only for ipv4 packets.
Same story for ipv6.
The fix is straightforward: use two already split arrays for TX.

Bugzilla ID: 1434
Fixes: 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example")
Cc: stable@dpdk.org

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
---
 examples/l3fwd/l3fwd_acl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/l3fwd/l3fwd_acl.c b/examples/l3fwd/l3fwd_acl.c
index 401692bcec..d9e4ae543f 100644
--- a/examples/l3fwd/l3fwd_acl.c
+++ b/examples/l3fwd/l3fwd_acl.c
@@ -1073,9 +1073,9 @@ acl_main_loop(__rte_unused void *dummy)
 
 					l3fwd_acl_send_packets(
 						qconf,
-						pkts_burst,
+						acl_search.m_ipv4,
 						acl_search.res_ipv4,
-						nb_rx);
+						acl_search.num_ipv4);
 				}
 
 				if (acl_search.num_ipv6) {
@@ -1088,9 +1088,9 @@ acl_main_loop(__rte_unused void *dummy)
 
 					l3fwd_acl_send_packets(
 						qconf,
-						pkts_burst,
+						acl_search.m_ipv6,
 						acl_search.res_ipv6,
-						nb_rx);
+						acl_search.num_ipv6);
 				}
 			}
 		}
-- 
2.35.3


  reply	other threads:[~2024-05-02 15:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02 15:28 [PATCH 0/2] examples/l3fwd: ACL mode fixups and improvements Konstantin Ananyev
2024-05-02 15:28 ` Konstantin Ananyev [this message]
2024-05-02 15:28 ` [PATCH 2/2] examples/l3fwd: avoid packets reorder in ACL mode Konstantin Ananyev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240502152816.65562-2-konstantin.v.ananyev@yandex.ru \
    --to=konstantin.v.ananyev@yandex.ru \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@huawei.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).