<html>
    <head>
      <base href="https://bugs.dpdk.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8" class="bz_new_table">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - l3fwd: crashes in ACL mode for mixed traffic"
   href="https://bugs.dpdk.org/show_bug.cgi?id=1434">1434</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>l3fwd: crashes in ACL mode for mixed traffic
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>DPDK
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>24.03
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>examples
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dev@dpdk.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>konstantin.v.ananyev@yandex.ru
          </td>
        </tr>

        <tr>
          <th>Target Milestone</th>
          <td>---
          </td>
        </tr></table>
      <p>
        <div class="bz_comment_block">
          <pre class="bz_comment_text">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. Something like:
#0  rte_eth_tx_burst (port_id=54, queue_id=0,
    tx_pkts=0x4b249c0 <lcore_conf+550528>, nb_pkts=32)
    at ../lib/ethdev/rte_ethdev.h:6437
#1  0x0000000000503c0d in send_burst (qconf=0x4b20d40 <lcore_conf+535040>,
    n=32, port=54) at ../examples/l3fwd/l3fwd.h:129
#2  0x0000000000503ced in send_single_packet (
    qconf=0x4b20d40 <lcore_conf+535040>, m=0x11fc70ba00, port=54)
    at ../examples/l3fwd/l3fwd.h:152
#3  0x0000000000504138 in send_packets_single (
    qconf=0x4b20d40 <lcore_conf+535040>, pkts=0x7ffff2f24070,
    hops=0x7ffff2f23ab0, nb_tx=32) at ../examples/l3fwd/l3fwd_acl_scalar.h:77
#4  0x0000000000504286 in l3fwd_acl_send_packets (
    qconf=0x4b20d40 <lcore_conf+535040>, pkts=0x7ffff2f24070,
    res=0x7ffff2f23fe8, nb_tx=32) at ../examples/l3fwd/l3fwd_acl_scalar.h:106
#5  0x0000000000506870 in acl_main_loop (dummy=0x0)

#4  0x0000000000504286 in l3fwd_acl_send_packets (
    qconf=0x4b20d40 <lcore_conf+535040>, pkts=0x7ffff2f24070,
    res=0x7ffff2f23fe8, nb_tx=32) at ../examples/l3fwd/l3fwd_acl_scalar.h:106
106             send_packets_single(qconf, pkts, dst_port, nb_tx);

And the array of dst_port[] will contain some junk values:
(gdb) print dst_port
$7 = {0 <repeats 16 times>, 65535, 65535, 65535, 65535, 54, 65535, 65535,
  65535, 65535, 65535, 65535, 32766, 58445, 65535, 65535, 65535}

And the reason for that is here:

acl_main_loop(__rte_unused void *dummy)
{

...

                                if (acl_search.num_ipv4) {
                                        rte_acl_classify(
                                                acl_config.acx_ipv4[socketid],
                                                acl_search.data_ipv4,
                                                acl_search.res_ipv4,
                                                acl_search.num_ipv4,
                                                DEFAULT_MAX_CATEGORIES);
        l3fwd_acl_send_packets(
                                                qconf,
                                                pkts_burst,
                                                acl_search.res_ipv4,
                                                nb_rx);
...

I.E. we split our burst of packets into 2 arrays - one for ipv4, anoterh 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:
--- 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);
                                }
          </pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
      <div itemscope itemtype="http://schema.org/EmailMessage">
        <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
          
          <link itemprop="url" href="https://bugs.dpdk.org/show_bug.cgi?id=1434">
          <meta itemprop="name" content="View bug">
        </div>
        <meta itemprop="description" content="Bugzilla bug update notification">
      </div>
    </body>
</html>