Skip to content

building against OpENer as external library fails due to missing definitions #610

Description

@LeSpocky

The declaration of type ENIPMessage in file enipmessage.h contains PC_OPENER_ETHERNET_BUFFER_SIZE as buffer size for the message buffer inside of that struct:

typedef struct enip_message {
  CipOctet message_buffer[PC_OPENER_ETHERNET_BUFFER_SIZE];
  CipOctet *current_message_position;
  size_t used_message_length;
} ENIPMessage;

It is part of libUtils and used by other parts of the stack. The file enipmessage.h is included by other headers and installed, so can be considered part of the public API of the stack. The value PC_OPENER_ETHERNET_BUFFER_SIZE however is not only referenced in that header but used in various places of the stack's code. It is passed as preprocessor option at build time of the stack and comes from the CMake files through an add_definition() statement which takes the CMake option OPENER_ETHERNET_BUFFER_SIZE as input.

This leads to the following situation: there is this build time option (OPENER_ETHERNET_BUFFER_SIZE) which results in hardcoded array sizes of the built stack. When later building against the stack as external library the same value is required as preprocessor definition but it's defined nowhere and you don't get it from public API headers. So it is essentially impossible to know its value at build time of an app. You need to guess.

An app using a different value for PC_OPENER_ETHERNET_BUFFER_SIZE as the stack used will probably crash?!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions