Skip to content

Commit dd8ede5

Browse files
Pavel ŠiškaPavel Siska
authored andcommitted
ipfixprobe - add option -L PATH to specify plugins path
1 parent b8868aa commit dd8ede5

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/buildConfig.hpp.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313

1414
#define IPXP_APP_NAME "ipfixprobe"
1515
#define IPXP_APP_VERSION "@VERSION@"
16+
17+
#define IPXP_DEFAULT_PLUGINS_DIR "@INSTALL_DIR_LIB@/ipfixprobe/"

src/core/ipfixprobe.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828

2929
#include "ipfixprobe.hpp"
3030

31-
#include "buildConfig.hpp"
32-
3331
#include <fstream>
3432
#include <future>
3533
#include <iomanip>
@@ -637,7 +635,7 @@ int run(int argc, char* argv[])
637635
goto EXIT;
638636
}
639637

640-
conf.pluginManager.loadPlugins("/usr/local/lib64/ipfixprobe/", loadPluginsRecursive);
638+
conf.pluginManager.loadPlugins(parser.m_plugins_path, loadPluginsRecursive);
641639

642640
printPlugins();
643641

src/core/ipfixprobe.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#ifndef IPXP_IPFIXPROBE_HPP
3030
#define IPXP_IPFIXPROBE_HPP
3131

32+
#include "buildConfig.hpp"
3233
#include "pluginManager.hpp"
3334
#include "workers.hpp"
3435

@@ -91,6 +92,7 @@ class IpfixprobeOptParser : public OptionsParser {
9192
std::string m_help_str;
9293
bool m_version;
9394
std::vector<int> m_cpu_mask;
95+
std::string m_plugins_path;
9496

9597
IpfixprobeOptParser()
9698
: OptionsParser("ipfixprobe", "flow exporter supporting various custom IPFIX elements")
@@ -105,6 +107,7 @@ class IpfixprobeOptParser : public OptionsParser {
105107
, m_help(false)
106108
, m_help_str("")
107109
, m_version(false)
110+
, m_plugins_path(IPXP_DEFAULT_PLUGINS_DIR)
108111
{
109112
m_delim = ' ';
110113

@@ -238,6 +241,16 @@ class IpfixprobeOptParser : public OptionsParser {
238241
return m_pid != "";
239242
},
240243
OptionFlags::RequiredArgument);
244+
register_option(
245+
"-L",
246+
"--plugins-path",
247+
"PATH",
248+
"Path to the directory with plugins. Default: " IPXP_DEFAULT_PLUGINS_DIR,
249+
[this](const char* arg) {
250+
m_plugins_path = arg;
251+
return m_plugins_path != "";
252+
},
253+
OptionFlags::RequiredArgument);
241254
register_option(
242255
"-d",
243256
"--daemon",

0 commit comments

Comments
 (0)