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: "Luis Ontanon" <luis.ontanon@xxxxxxxxx>
Date: Wed, 11 Apr 2007 21:27:48 +0200
Well I replaced tvb_get_ntohs() with tvb_get_ipv4().

Balint:
 Can you test the changes to tvbrange:get_ipv4() in your code and
verify that this works for you as well.

The revision is:
http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=21385


On 4/11/07, Guy Harris <guy@xxxxxxxxxxxx> wrote:
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..
_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev



--
This information is top security. When you have read it, destroy yourself.
-- Marshall McLuhan