json_object_set_new(js, "alert", ajs);
}
+static void AlertJsonTunnel(const Packet *p, json_t *js)
+{
+ json_t *tunnel = json_object();
+ if (tunnel == NULL)
+ return;
+
+ if (p->root == NULL) {
+ json_decref(tunnel);
+ return;
+ }
+
+ /* get a lock to access root packet fields */
+ SCMutex *m = &p->root->tunnel_mutex;
+
+ SCMutexLock(m);
+ JsonFiveTuple((const Packet *)p->root, 0, tunnel);
+ SCMutexUnlock(m);
+
+ json_object_set_new(tunnel, "depth", json_integer(p->recursion_level));
+
+ json_object_set_new(js, "tunnel", tunnel);
+}
+
static void AlertJsonPacket(const Packet *p, json_t *js)
{
unsigned long len = GET_PKT_LEN(p) * 2;
/* alert */
AlertJsonHeader(p, pa, js);
+ if (IS_TUNNEL_PKT(p)) {
+ AlertJsonTunnel(p, js);
+ }
+
if (json_output_ctx->flags & LOG_JSON_HTTP) {
if (p->flow != NULL) {
uint16_t proto = FlowGetAppProtocol(p->flow);