summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKaiwen Deng <[email protected]>2024-07-03 15:50:37 +0800
committerThomas Monjalon <[email protected]>2024-07-23 18:06:56 +0200
commit0cf06d7d846523abd48307613d429830bfb45ac9 (patch)
tree3cbe626f1bb69748974998038ed9c67aa6836a60 /examples
parentaa7c6077c19bd39b48ac17cd844b91f0dd03319f (diff)
examples/l3fwd: fix crash on multiple sockets
Setting acl will clear the acl config of other sockets, which will result in core dump. This commit will no longer clear the acl config when setting acl. Fixes: 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example") Cc: [email protected] Signed-off-by: Kaiwen Deng <[email protected]> Tested-by: Hongbo Li <[email protected]> Acked-by: Konstantin Ananyev <[email protected]>
Diffstat (limited to 'examples')
-rw-r--r--examples/l3fwd/l3fwd_acl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/l3fwd/l3fwd_acl.c b/examples/l3fwd/l3fwd_acl.c
index ab8222c9db..2109ab0a8c 100644
--- a/examples/l3fwd/l3fwd_acl.c
+++ b/examples/l3fwd/l3fwd_acl.c
@@ -950,8 +950,6 @@ setup_acl(const int socket_id)
acl_log("IPv6 ACL entries %u:\n", acl_num_ipv6);
dump_ipv6_rules((struct acl6_rule *)acl_base_ipv6, acl_num_ipv6, 1);
- memset(&acl_config, 0, sizeof(acl_config));
-
/* Check sockets a context should be created on */
if (socket_id >= NB_SOCKETS) {
acl_log("Socket %d is out "
@@ -961,6 +959,9 @@ setup_acl(const int socket_id)
return;
}
+ rte_acl_free(acl_config.acx_ipv4[socket_id]);
+ rte_acl_free(acl_config.acx_ipv6[socket_id]);
+
acl_config.acx_ipv4[socket_id] = app_acl_init(route_base_ipv4,
acl_base_ipv4, route_num_ipv4, acl_num_ipv4,
0, socket_id);