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
pull/14000/head
Jeff Lucovsky 2 months ago committed by Victor Julien
parent f0121d8bc2
commit 0af7793410

@ -761,7 +761,7 @@ static int CreateJSONEther(
if (PacketIsEthernet(p)) {
const EthernetHdr *ethh = PacketGetEthernet(p);
SCJbOpenObject(js, "ether");
SCJbSetUint(js, "ether_type", ethh->eth_type);
SCJbSetUint(js, "ether_type", SCNtohs(ethh->eth_type));
const uint8_t *src;
const uint8_t *dst;
switch (dir) {

Loading…
Cancel
Save