【问题标题】:Snort Error: plugbase.c: Undefined reference to: "Setup"Snort 错误:plugbase.c:未定义引用:“设置”
【发布时间】: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.csp_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.hsp_profinet_func.$(OBJEXT) 的声明,正如我在Makefile.am 中声明的那样

标签: c++ c gcc undefined-reference snort


【解决方案1】:

我自己解决了这个问题。 感谢@RP 和@Pandrei 提供查看Makefile 的提示。

./configure 之后,我查看了Makefile (src/detection-plugins),发现“am_libspd_a_SOURCES_DIST”下没有sp_profinet_func.c sp_profinet_func.h 的声明,“am_libspd_a_OBJECTS”下也没有sp_profinet_func.$(OBJEXT)

我只是添加了这些声明并执行了makesudo make install,现在预处理器和检测插件正在运行。

感谢您的努力。

\克里斯

【讨论】:

    猜你喜欢
    • 2022-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多