Chris
Chris

Reputation: 31

Snort Error: plugbase.c: Undefined reference to: "Setup"

I am at a loss what to do and i hope somebody could solve this problem or give me a useful hint.

I am trying to add a preprocessor and a corresponding detection-plugin into Snort. (Including the preprocessor was without any error but is useless without the corresponding detection-plugin)

I already included the necessary parts of code into the source files and copied all necessary files in the right place.

"Configure" is running without any errors:

./configure --enable-sourcefire --enable-targetbased

But when i do make i get the following error:

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

Here is the important part of my plugbase.c:

/* built-in detection plugins */
#include "detection-plugins/sp_profinet_func.h"
...
...
...
void RegisterRuleOptions(void)
{
    LogMessage("Initializing Plug-ins!\n");

SetupProfi();
}

The files sp_profinet_func.c and sp_profinet_func.h are in src/detection-plugins. This is the code of 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__ */

And here is the extract of the 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);
}

I am relatively new to C/C++ programming and compiling. I already found out that this error can mean a linking problem but i don't know how to fix it.

Has anybody an idea how to fix this problem and get the detection plugin fired up?

Operating system is Debian 7.8 and I use the Snort-Version 2.9.3.1 because of recommendation of the plugins developer.

Thanks in advance!

\Chris

Upvotes: 2

Views: 500

Answers (1)

Chris
Chris

Reputation: 31

I solved the problem by myself. Thanks @ RP and @ Pandrei for the hint to look at the Makefile.

After ./configure i looked at the Makefile (src/detection-plugins) and saw that there was no declaration of sp_profinet_func.c sp_profinet_func.h under "am_libspd_a_SOURCES_DIST" and also no sp_profinet_func.$(OBJEXT) under "am_libspd_a_OBJECTS".

I simply added these declarations and did make and sudo make install and now the preprocessor and detection-plugin are running.

Thanks for your efforts.

\Chris

Upvotes: 1

Related Questions