Skip to content

Commit 0af7793

Browse files
jlucovskyvictorjulien
authored andcommitted
output: Display ethertype properly
Ethertype values are now converted from network format to host format before display occurs. Displayed values are now in hex instead of integers. Without this change, ethertype values such as 0xfbb7 are displayed in decimal as: 47099 (0xb7fb). The actual value is 64439 (0xfbb7); all logged ether_type values will be displayed in host order in decimal format. This example will log the ether type as 64439 Issue: 7855
1 parent f0121d8 commit 0af7793

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/output-json.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ static int CreateJSONEther(
761761
if (PacketIsEthernet(p)) {
762762
const EthernetHdr *ethh = PacketGetEthernet(p);
763763
SCJbOpenObject(js, "ether");
764-
SCJbSetUint(js, "ether_type", ethh->eth_type);
764+
SCJbSetUint(js, "ether_type", SCNtohs(ethh->eth_type));
765765
const uint8_t *src;
766766
const uint8_t *dst;
767767
switch (dir) {

0 commit comments

Comments
 (0)