Skip to content

Fix/sniffer ip byte order#127

Merged
alonsoir merged 5 commits into
mainfrom
fix/sniffer-ip-byte-order
Jul 25, 2026
Merged

Fix/sniffer ip byte order#127
alonsoir merged 5 commits into
mainfrom
fix/sniffer-ip-byte-order

Conversation

@alonsoir

@alonsoir alonsoir commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Expanded environment startup to include Defender, Client, and Suricata virtual machines.
    • Added consistent IPv4 address formatting across network security events and alerts.
    • Extended sensor environments with the required build and development tooling.
  • Bug Fixes

    • Improved reliability of displayed source and destination IP addresses.
  • Tests

    • Added automated coverage for IPv4 formatting, including edge-case addresses.

alonsoir added 5 commits July 24, 2026 03:20
…l camino eBPF

DEBT-SNIFFER-IP-BYTE-ORDER-001.

sniffer.bpf.c:232 ensambla las IPs a mano como enteros en orden de HOST.
ring_consumer.cpp:844 se las pasaba a inet_ntop sin deshacer la conversion,
asi que el CSV de bronce escribia 1.56.168.192 donde el cable llevaba
192.168.56.1 — y el community_id se calculaba sobre esos mismos bytes
invertidos. Consecuencia: los community_id de aRGus no podian coincidir
con los de Suricata para el mismo flujo.

La misma conversion estaba escrita dos veces en el fichero (:844 sin htonl,
:1235 con htonl). Se extrae a ip_format.hpp como punto unico y los cuatro
llamantes pasan por ella, de modo que la duplicacion que causo el fallo
desaparece.

El criterio de HECHO anterior de la deuda (recomputar community_id desde
las IPs de la propia fila) NO discriminaba: pasaba en verde con el bug
presente, porque hash y cadena beben de la misma fuente. test_ip_format
ancla la verificacion en un oraculo externo (aritmetica de la RFC) y
reproduce el fallo de produccion en 0,02 s.

Medido: RED 3/6 -> GREEN 6/6; ctest del sniffer 12/12;
test_ring_consumer_protobuf 4/4. Base: main fb08e8f.

PENDIENTE: verificacion E2E sobre un CSV de bronce nuevo.
@alonsoir
alonsoir merged commit 1830c5a into main Jul 25, 2026
10 checks passed
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c588c81-32bb-4171-a84b-98b8804a0974

📥 Commits

Reviewing files that changed from the base of the PR and between fb08e8f and 62f3e55.

📒 Files selected for processing (8)
  • Makefile
  • Vagrantfile
  • docs/BACKLOG.md
  • docs/continuity/PROMPT_CONTINUE_CLAUDE.md
  • sniffer/CMakeLists.txt
  • sniffer/include/ip_format.hpp
  • sniffer/src/userspace/ring_consumer.cpp
  • sniffer/tests/test_ip_format.cpp

📝 Walkthrough

Walkthrough

The sniffer centralizes host-order IPv4 formatting, adds unit-test coverage, provisions a shared adapter toolchain on three sensor VMs, starts Suricata in EMECAS setup, and updates continuity and backlog documentation.

Changes

IPv4 formatting

Layer / File(s) Summary
Shared IPv4 formatting path
sniffer/include/ip_format.hpp, sniffer/src/userspace/ring_consumer.cpp, docs/continuity/PROMPT_CONTINUE_CLAUDE.md
Adds ip_host_to_buffer and uses it for protobuf events and fast alerts; continuity notes document the byte-order fix and its measured scope.
IPv4 formatting validation
sniffer/CMakeLists.txt, sniffer/tests/test_ip_format.cpp, docs/continuity/PROMPT_CONTINUE_CLAUDE.md
Registers a conversion test executable with CTest, exercises fixed IPv4 vectors, and updates validation procedures and follow-up actions.

Sensor VM provisioning

Layer / File(s) Summary
Shared sensor toolchain
Vagrantfile
Defines a fail-fast toolchain provisioning script and applies it to the suricata, zeek, and wazuh VMs.
EMECAS startup and VM debt records
Makefile, docs/BACKLOG.md
Starts defender, client, and suricata in the EMECAS setup and records open debts for sensor VM placement and duplicate Suricata definitions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sniffer-ip-byte-order

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@alonsoir alonsoir mentioned this pull request Jul 25, 2026
alonsoir added a commit that referenced this pull request Jul 25, 2026
## feat: Suricata → bronce → grafo Kuzu

Integra el segundo productor del pipeline (Suricata) de extremo a extremo:
- `suricata-adapter/`: eve.json → bronce correlation_v1 (2.870 filas validadas).
- Bronce plano multi-sensor con prefijo de sensor.
- `bronze_to_gold_converter`, `parquet_to_kuzu_loader`, `kuzu_query`.
- DAY 228: Suricata en el grafo (2.870 TelemetryEvent / 775 NetworkFlow),
  consultable vía kuzu_query.

Rebasada sobre main (PR #127), así que hereda el arreglo del byte order del
sniffer (`ip_host_to_buffer`, DEBT-SNIFFER-IP-BYTE-ORDER-001).

### Alcance / lo que este merge NO cierra
EMECAS+++ verde = build + provisioning + circuito SINTÉTICO (fixture, clave
constante), ciego al byte order. La verificación E2E del bronce con IPs reales
(147.32.84.x) y la convergencia aRGus↔Suricata en el mismo NetworkFlow se hará
provocando tráfico real al grafo (paso 2 del plan de cierre, script MITRE).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant