snort: support multiple instances per interface 70/41970/2
authorAgathiyan Bragadeesh <[email protected]>
Wed, 6 Nov 2024 14:33:12 +0000 (14:33 +0000)
committerDamjan Marion <[email protected]>
Fri, 17 Jan 2025 17:27:06 +0000 (17:27 +0000)
commit102575492c9199259aa5e468f21b46936d7a1ac4
treef7fbad6cfa602d8a56fd3e68a9d4a4611e062b5d
parentb33331925583a83c36aed67521b78e1f3db12a8c
snort: support multiple instances per interface

Implements load balancing between snort instances via flow hash.
New CLI commands have been made to support these changes:

snort attach instance <name1>
    [instance <name2> ... ] interface <ifname> [input|output|inout]
snort attach all-instances interface <ifname> [input|output|inout]
snort detach instance <name1> interface <ifname>
snort detach all-instances interface <ifname>

The output of "show snort interfaces" has an extra column to show the
direction of each attachment:

interface   instances   direction
Ethernet0:  snort1      inout
            snort2      inout
            snort3      inout
Ethernet1:  snort1      input
            snort3      output

To maintain backwards compatibility for the snort api, the
snort_interface_get api endpoint only returns one of the attached
instances and the snort_interface_detach endpoint detaches all
attached instances.

Type: improvement
Signed-off-by: Agathiyan Bragadeesh <[email protected]>
Change-Id: I6b7c26c203496d6a1dba244620907f28c04bb478
src/plugins/snort/cli.c
src/plugins/snort/enqueue.c
src/plugins/snort/main.c
src/plugins/snort/snort.h
src/plugins/snort/snort_api.c
test/test_snort.py