diff --git a/backend/src/utilities/database.py b/backend/src/utilities/database.py index 5f4ffcb..6b9cd34 100644 --- a/backend/src/utilities/database.py +++ b/backend/src/utilities/database.py @@ -461,7 +461,16 @@ class DatabasePool: OR ($1::int IS NULL AND $2::int IS NOT NULL AND eth_type_raw = $2) ) - AND (capture_iface = $3 OR ingress_if = $3 OR egress_if = $3) + AND ( + capture_iface = $3 + OR ingress_if = $3 + OR egress_if = $3 + OR EXISTS ( + SELECT 1 + FROM jsonb_array_elements(COALESCE(capture_observations, '[]'::jsonb)) AS observation + WHERE observation ->> 'iface' = $3 + ) + ) AND src_ip = $4::inet AND dst_ip = $5::inet AND COALESCE(src_port, 0) = $6 @@ -588,7 +597,16 @@ class DatabasePool: FROM packets WHERE ip_proto_raw = $1 - AND (capture_iface = $2 OR ingress_if = $2 OR egress_if = $2) + AND ( + capture_iface = $2 + OR ingress_if = $2 + OR egress_if = $2 + OR EXISTS ( + SELECT 1 + FROM jsonb_array_elements(COALESCE(capture_observations, '[]'::jsonb)) AS observation + WHERE observation ->> 'iface' = $2 + ) + ) AND timestamp BETWEEN $5 AND $6 AND ( (