Project

General

Profile

Actions

Bug #8812

open
SD SD

stats: wrong registration causes compilation errors with --enable-dag

Bug #8812: stats: wrong registration causes compilation errors with --enable-dag

Added by Stephen Donnelly 1 day ago. Updated about 11 hours ago.

Status:
In Review
Priority:
Normal
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

Branch 'main' does not compile with --enable-dag due to counter API changes.


Related issues 1 (1 open0 closed)

Related to Suricata - Bug #8797: dag: Infinite loop in DAG record processing when rlen < dag_record_sizeAssignedStephen DonnellyActions

SD Updated by Stephen Donnelly 1 day ago Actions #1

Stephen Donnelly wrote:

Branch 'main' does not compile with --enable-dag due to counter API changes.

PR at https://github.com/OISF/suricata/pull/15985

SB Updated by Shivani Bhardwaj 1 day ago Actions #2

  • Status changed from New to In Review

SB Updated by Shivani Bhardwaj 1 day ago Actions #3

  • Subject changed from counters: counter API updates for source-erf-dag to stats: wrong registration causes compilation errors with --enable-dag

SD Updated by Stephen Donnelly about 13 hours ago Actions #4

source-erf-dag.c: In function ‘ReceiveErfDagThreadInit’:
source-erf-dag.c:286:65: warning: passing argument 2 of ‘StatsRegisterCounter’ from incompatible pointer type [-Wincompatible-pointer-types]
  286 |     ewtn->packets = StatsRegisterCounter("capture.dag_packets", tv);
      |                                                                 ^~
      |                                                                 |
      |                                                                 ThreadVars * {aka struct ThreadVars_ *}
In file included from threadvars.h:28,
                 from decode.h:32,
                 from tmqh-packetpool.h:27,
                 from tm-threads.h:28,
                 from source-erf-dag.c:31:
counters.h:148:51: note: expected ‘StatsThreadContext *’ {aka ‘struct StatsThreadContext_ *’} but argument is of type ‘ThreadVars *’ {aka ‘struct ThreadVars_ *’}
  148 | StatsCounterId StatsRegisterCounter(const char *, StatsThreadContext *);
      |                                                   ^~~~~~~~~~~~~~~~~~~~
source-erf-dag.c:286:21: error: incompatible types when assigning to type ‘uint16_t’ {aka ‘short unsigned int’} from type ‘StatsCounterId’
  286 |     ewtn->packets = StatsRegisterCounter("capture.dag_packets", tv);
      |                     ^~~~~~~~~~~~~~~~~~~~
source-erf-dag.c:287:61: warning: passing argument 2 of ‘StatsRegisterCounter’ from incompatible pointer type [-Wincompatible-pointer-types]
  287 |     ewtn->drops = StatsRegisterCounter("capture.dag_drops", tv);
      |                                                             ^~
      |                                                             |
      |                                                             ThreadVars * {aka struct ThreadVars_ *}
counters.h:148:51: note: expected ‘StatsThreadContext *’ {aka ‘struct StatsThreadContext_ *’} but argument is of type ‘ThreadVars *’ {aka ‘struct ThreadVars_ *’}
  148 | StatsCounterId StatsRegisterCounter(const char *, StatsThreadContext *);
      |                                                   ^~~~~~~~~~~~~~~~~~~~
source-erf-dag.c:287:19: error: incompatible types when assigning to type ‘uint16_t’ {aka ‘short unsigned int’} from type ‘StatsCounterId’
  287 |     ewtn->drops = StatsRegisterCounter("capture.dag_drops", tv);
      |                   ^~~~~~~~~~~~~~~~~~~~
source-erf-dag.c: In function ‘ProcessErfDagRecords’:
source-erf-dag.c:429:58: error: incompatible type for argument 2 of ‘StatsCounterAddI64’
  429 |                 StatsCounterAddI64(&ewtn->tv->stats, ewtn->drops, SCNtohs(dr->lctr));
      |                                                      ~~~~^~~~~~~
      |                                                          |
      |                                                          uint16_t {aka short unsigned int}
counters.h:157:47: note: expected ‘StatsCounterId’ but argument is of type ‘uint16_t’ {aka ‘short unsigned int’}
  157 | void StatsCounterAddI64(StatsThreadContext *, StatsCounterId, int64_t);
      |                                               ^~~~~~~~~~~~~~
source-erf-dag.c: In function ‘ProcessErfDagRecord’:
  CC       util-mpm-ac.o
source-erf-dag.c:516:44: error: incompatible type for argument 2 of ‘StatsCounterIncr’
  516 |     StatsCounterIncr(&ewtn->tv->stats, ewtn->packets);
      |                                        ~~~~^~~~~~~~~
      |                                            |
      |                                            uint16_t {aka short unsigned int}
counters.h:159:45: note: expected ‘StatsCounterId’ but argument is of type ‘uint16_t’ {aka ‘short unsigned int’}
  159 | void StatsCounterIncr(StatsThreadContext *, StatsCounterId);
      |                                             ^~~~~~~~~~~~~~
In file included from util-atomic.h:38,
                 from suricata-common.h:537,
                 from source-erf-dag.c:29:
source-erf-dag.c: In function ‘ReceiveErfDagThreadExitStats’:
source-erf-dag.c:537:88: error: incompatible type for argument 2 of ‘StatsCounterGetLocalValue’
  537 |     (void)SC_ATOMIC_SET(ewtn->livedev->pkts, StatsCounterGetLocalValue(&tv->stats, ewtn->packets));
      |                                                                                    ~~~~^~~~~~~~~
      |                                                                                        |
      |                                                                                        uint16_t {aka short unsigned int}
source-erf-dag.c:537:11: note: in expansion of macro ‘SC_ATOMIC_SET’
  537 |     (void)SC_ATOMIC_SET(ewtn->livedev->pkts, StatsCounterGetLocalValue(&tv->stats, ewtn->packets));
      |           ^~~~~~~~~~~~~
counters.h:166:57: note: expected ‘StatsCounterId’ but argument is of type ‘uint16_t’ {aka ‘short unsigned int’}
  166 | int64_t StatsCounterGetLocalValue(StatsThreadContext *, StatsCounterId);
      |                                                         ^~~~~~~~~~~~~~
source-erf-dag.c:538:88: error: incompatible type for argument 2 of ‘StatsCounterGetLocalValue’
  538 |     (void)SC_ATOMIC_SET(ewtn->livedev->drop, StatsCounterGetLocalValue(&tv->stats, ewtn->drops));
      |                                                                                    ~~~~^~~~~~~
      |                                                                                        |
      |                                                                                        uint16_t {aka short unsigned int}
source-erf-dag.c:538:11: note: in expansion of macro ‘SC_ATOMIC_SET’
  538 |     (void)SC_ATOMIC_SET(ewtn->livedev->drop, StatsCounterGetLocalValue(&tv->stats, ewtn->drops));
      |           ^~~~~~~~~~~~~
  CC       util-mpm-hs-cache.o
  CC       util-mpm-hs-core.o
  CC       util-mpm-hs.o
counters.h:166:57: note: expected ‘StatsCounterId’ but argument is of type ‘uint16_t’ {aka ‘short unsigned int’}
  166 | int64_t StatsCounterGetLocalValue(StatsThreadContext *, StatsCounterId);
      |                                                         ^~~~~~~~~~~~~~
In file included from decode.h:33:
source-erf-dag.c:541:85: error: incompatible type for argument 2 of ‘StatsCounterGetLocalValue’
  541 |             ewtn->dagstream, ewtn->bytes, StatsCounterGetLocalValue(&tv->stats, ewtn->packets),
      |                                                                                 ~~~~^~~~~~~~~
      |                                                                                     |
      |                                                                                     uint16_t {aka short unsigned int}
util-debug.h:232:89: note: in definition of macro ‘SCLogInfo’
  232 | #define SCLogInfo(...) SCLog(SC_LOG_INFO, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
      |                                                                                         ^~~~~~~~~~~
counters.h:166:57: note: expected ‘StatsCounterId’ but argument is of type ‘uint16_t’ {aka ‘short unsigned int’}
  166 | int64_t StatsCounterGetLocalValue(StatsThreadContext *, StatsCounterId);
      |                                                         ^~~~~~~~~~~~~~
source-erf-dag.c:542:55: error: incompatible type for argument 2 of ‘StatsCounterGetLocalValue’
  542 |             StatsCounterGetLocalValue(&tv->stats, ewtn->drops));
      |                                                   ~~~~^~~~~~~
      |                                                       |
      |                                                       uint16_t {aka short unsigned int}
util-debug.h:232:89: note: in definition of macro ‘SCLogInfo’
  232 | #define SCLogInfo(...) SCLog(SC_LOG_INFO, __FILE__, __FUNCTION__, __LINE__, _sc_module, __VA_ARGS__)
      |                                                                                         ^~~~~~~~~~~
counters.h:166:57: note: expected ‘StatsCounterId’ but argument is of type ‘uint16_t’ {aka ‘short unsigned int’}
  166 | int64_t StatsCounterGetLocalValue(StatsThreadContext *, StatsCounterId);
      |                                                         ^~~~~~~~~~~~~~

SD Updated by Stephen Donnelly about 10 hours ago Actions #6

  • Related to Bug #8797: dag: Infinite loop in DAG record processing when rlen < dag_record_size added
Actions

Also available in: PDF Atom