]> git.ipfire.org Git - thirdparty/suricata.git/commit
stats: Do not expand dots of tm_name
authorArne Welzel <arne.welzel@corelight.com>
Mon, 5 Feb 2024 16:45:30 +0000 (17:45 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 14 Feb 2024 20:20:52 +0000 (21:20 +0100)
commitb8b8aa69b49ac0dd222446c28d00a50f9fd7d716
treec2aa984678c7ad1ddce2be9c0751caf46b144af0
parent17f9d7aeccd5a69ef2e3344386d1585d231e2933
stats: Do not expand dots of tm_name

When an interface with dots is used, per worker stats are nested by the
dot-separated-components of the interface due to the usage of
OutputStats2Json().

Prevent this by using OutputStats2Json() on a per-thread specific object
and setting this object into the threads object using the
json_object_set_new() which won't do the dot expansion.

This was tested by creating an interface with dots in the name
and checking the stats.

    ip link add name a.b.c type dummy

With Suricata 7.0.2, sniffing on the a.b.c interface results in the
following worker stats format:

    "threads": {
      "W#01-a": {
        "b": {
          "c": {
            "capture": {
              "kernel_packets": 0,

After this fix, the output looks as follows:

    "threads": {
      "W#01-a.b.c": {
        "capture": {
          "kernel_packets": 0,

Ticket: #6732
src/output-json-stats.c