diff --git a/src/decode-vlan.h b/src/decode-vlan.h index bf9135ec57..c82e33be12 100644 --- a/src/decode-vlan.h +++ b/src/decode-vlan.h @@ -24,6 +24,7 @@ #ifndef __DECODE_VLAN_H__ #define __DECODE_VLAN_H__ +/* return vlan id in host byte order */ uint16_t DecodeVLANGetId(const struct Packet_ *, uint8_t layer); /** Vlan type */ @@ -35,6 +36,7 @@ uint16_t DecodeVLANGetId(const struct Packet_ *, uint8_t layer); #define GET_VLAN_ID(vlanh) ((uint16_t)(ntohs((vlanh)->vlan_cfi) & 0x0FFF)) #define GET_VLAN_PROTO(vlanh) ((ntohs((vlanh)->protocol))) +/* return vlan id in host byte order */ #define VLAN_GET_ID1(p) DecodeVLANGetId((p), 0) #define VLAN_GET_ID2(p) DecodeVLANGetId((p), 1) diff --git a/src/output-json.c b/src/output-json.c index e91f008c60..999cbef1db 100644 --- a/src/output-json.c +++ b/src/output-json.c @@ -225,15 +225,15 @@ json_t *CreateJSONHeader(Packet *p, int direction_sensitive, char *event_type) switch (p->vlan_idx) { case 1: json_object_set_new(js, "vlan", - json_integer(ntohs(VLAN_GET_ID1(p)))); + json_integer(VLAN_GET_ID1(p))); break; case 2: js_vlan = json_array(); if (unlikely(js != NULL)) { json_array_append_new(js_vlan, - json_integer(ntohs(VLAN_GET_ID1(p)))); + json_integer(VLAN_GET_ID1(p))); json_array_append_new(js_vlan, - json_integer(ntohs(VLAN_GET_ID2(p)))); + json_integer(VLAN_GET_ID2(p))); json_object_set_new(js, "vlan", js_vlan); } break;