eal: fix plugin loading

Commit 49b536fc30 ("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: 49b536fc30 ("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>
This commit is contained in:
Timothy Redaelli 2020-11-24 16:14:15 +01:00 committed by Thomas Monjalon
parent 7781950f4d
commit c57f6e5c60

View 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);