eal: fix plugin loading
authorTimothy Redaelli <tredaelli@redhat.com>
Tue, 24 Nov 2020 15:14:15 +0000 (16:14 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 25 Nov 2020 23:00:06 +0000 (00:00 +0100)
Commit 49b536fc3060 ("eal: load only shared libs from driver plugin directories")
introduced a check that any shared library must ends with .so, but it can't
work, at least, on Fedora/CentOS/RHEL since .so symlinks are not installed
when you install dpdk package, but only when you install dpdk-devel package.

This commit adds also a check for .so.ABI_VERSION to check for shared lib.

See Fedora Packaging Guidelines for more information:
https://docs.fedoraproject.org/en-US/packaging-guidelines/#_devel_packages

Fixes: 49b536fc3060 ("eal: load only shared libs from driver plugin directories")
Cc: stable@dpdk.org
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Marchand <david.marchand@redhat.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Ali Alnubani <alialnu@nvidia.com>
lib/librte_eal/common/eal_common_options.c

index ac3884a..424e8bc 100644 (file)
@@ -402,8 +402,10 @@ eal_plugindir_init(const char *path)
                struct stat sb;
                int nlen = strnlen(dent->d_name, sizeof(dent->d_name));
 
-               /* check if name ends in .so */
-               if (strcmp(&dent->d_name[nlen - 3], ".so") != 0)
+               /* check if name ends in .so or .so.ABI_VERSION */
+               if (strcmp(&dent->d_name[nlen - 3], ".so") != 0 &&
+                   strcmp(&dent->d_name[nlen - 4 - strlen(ABI_VERSION)],
+                          ".so."ABI_VERSION) != 0)
                        continue;
 
                snprintf(sopath, sizeof(sopath), "%s/%s", path, dent->d_name);