Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] Patch: proto.c - FT_IPv4 and little_endian

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Peter Johansson <Peter.xc.Johansson@xxxxxxxxxxxx>
Date: Mon, 06 Sep 2004 10:05:07 +0200
The attached patch corrects the proto_tree_add_item(...) function to handle the little_endian input information when the supplied type is FT_IPv4 by converting the input value to big endian before passing it on to the proto_tree_set_ipv4(...) functions which expects big endian data values only..

/ Peter
--- proto.c	Sun Aug 22 02:31:58 2004
+++ new_proto.c	Mon Sep 06 09:52:57 2004
@@ -725,7 +725,7 @@
 		case FT_IPv4:
 			g_assert(length == 4);
 			tvb_memcpy(tvb, (guint8 *)&value, start, 4);
-			proto_tree_set_ipv4(new_fi, value);
+			proto_tree_set_ipv4(new_fi, little_endian ? GUINT32_TO_BE(value) : value);
 			break;
 
 		case FT_IPXNET: