【发布时间】:2015-04-20 09:39:12
【问题描述】:
我不知道该怎么办,我希望有人能解决这个问题或给我一个有用的提示。
我正在尝试将预处理器和相应的检测插件添加到 Snort 中。 (包括预处理器没有任何错误但没有相应的检测插件无用)
我已经在源文件中包含了必要的代码部分,并将所有必要的文件复制到了正确的位置。
“配置”正在运行且没有任何错误:
./configure --enable-sourcefire --enable-targetbased
但是当我执行make 时,我收到以下错误:
plugbase.o: In function 'RegisterRuleOptions':
../snort-2.9.3.1/src/plugbase.c:199: undefined reference to 'SetupProfi'
collect2: error: ld returned 1 exit status
这是我plugbase.c的重要部分:
/* built-in detection plugins */
#include "detection-plugins/sp_profinet_func.h"
...
...
...
void RegisterRuleOptions(void)
{
LogMessage("Initializing Plug-ins!\n");
SetupProfi();
}
文件sp_profinet_func.c 和sp_profinet_func.h 位于src/detection-plugins。
这是sp_profinet_func.h的代码:
#ifndef __SP_PROFINET_H__
#define __SP_PROFINET_H__
void SetupProfi(void);
#ifdef DETECTION_OPTION_TREE
u_int32_t SpProfinetFunctionCodeCheckHash(void *d);
int SpProfinetFunctionCodeCheckCompare(void *l, void *r);
#endif
#endif /* __SP_PROFINET_H__ */
这是sp_profinet_func.c的摘录:
void SetupProfi(void)
{
printf("RULES-SetupProfi");
/* map the keyword to an initialization/processing function */
RegisterRuleOption("Profinet_func", SpProfinetFunctionCodeInit, NULL, OPT_TYPE_DETECTION, NULL);
}
我对 C/C++ 编程和编译比较陌生。 我已经发现这个错误可能意味着链接问题,但我不知道如何解决它。
有人知道如何解决这个问题并启动检测插件吗?
操作系统是 Debian 7.8,由于插件开发者的推荐,我使用 Snort-Version 2.9.3.1。
提前致谢!
\克里斯
【问题讨论】:
-
可能是缺少定义“SetupProfi”的库?
-
你能检查 makefile 中定义的库吗? stackoverflow.com/questions/6355454/snort-make-file-gives-error
-
您可能必须将 sp_profinet_func.c 添加到要编译的文件列表中
-
当我在
./configure之后查看/src/detection-plugins 中的Makefile时,没有sp_profinet_func.c sp_profinet_func.h和sp_profinet_func.$(OBJEXT)的声明,正如我在Makefile.am中声明的那样
标签: c++ c gcc undefined-reference snort