ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] [Patch] native little endian ipv4 decoding function for the

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 11 Apr 2007 12:18:54 -0700
Luis Ontanon wrote:

Please verify this assumption:

I should not do any processing on the bytes of an IPv4 address because
regardless of endianity it is always interpreted as a guint8[4] where
[0] contains the first byte. so that 10.11.12.13 would always be
stored regardless of the endianity as 0a:0b:0c:0d.

Is that correct?

At least for IPv4 addresses handed to SET_ADDRESS() or proto_tree_add_ipv4(), yes, the IPv4 address should be a sequence of 4 bytes in network byte order, so that the first byte (byte[0]) is the topmost byte of the address.

ip_to_str()/ip_to_str_buf(), etc. also expect the address to be in that format. At least as I read the inet_nto* man pages, so do inet_ntoa, inet_ntop, etc..