diff --git a/etc/schema.json b/etc/schema.json index 74439841a22f..4ccb864844bd 100644 --- a/etc/schema.json +++ b/etc/schema.json @@ -3465,6 +3465,10 @@ "properties": { "linktype": { "type": "integer" + }, + "linktype_name": { + "type": "string", + "description": "the descriptive name of the linktype" } }, "additionalProperties": false diff --git a/src/output-json.c b/src/output-json.c index b18ecadc5c9d..8a80d70696bc 100644 --- a/src/output-json.c +++ b/src/output-json.c @@ -438,8 +438,15 @@ void EvePacket(const Packet *p, JsonBuilder *js, unsigned long max_length) return; } if (!jb_set_uint(js, "linktype", p->datalink)) { + jb_close(js); return; } + + const char *dl_name = pcap_datalink_val_to_name(p->datalink); + // Intentionally ignore the return value from jb_set_string and proceed + // so the jb object is closed + jb_set_string(js, "linktype_name", dl_name == NULL ? "n/a" : dl_name); + jb_close(js); }