diff options
author | Gerald Combs <gerald@wireshark.org> | 2003-08-29 01:57:37 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2003-08-29 01:57:37 +0000 |
commit | 9685960b403e8faeb70a54ae177dab4d727f5f4a (patch) | |
tree | 3e824dff37f6f30a6213d4553252cb19769ad10d /packet-ip.c | |
parent | 2af677041047c460d86cbed47626378b0c991a0d (diff) |
Copy the source and destination addresses into a guint32, so that we don't
bus error on RISC systems.
svn path=/trunk/; revision=8304
Diffstat (limited to 'packet-ip.c')
-rw-r--r-- | packet-ip.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/packet-ip.c b/packet-ip.c index 93d04aa161..e682940193 100644 --- a/packet-ip.c +++ b/packet-ip.c @@ -1,7 +1,7 @@ /* packet-ip.c * Routines for IP and miscellaneous IP protocol packet disassembly * - * $Id: packet-ip.c,v 1.197 2003/08/28 04:19:28 guy Exp $ + * $Id: packet-ip.c,v 1.198 2003/08/29 01:57:37 gerald Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -812,6 +812,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *ip_tree = NULL, *field_tree; proto_item *ti = NULL, *tf; + guint32 addr; int offset = 0; guint hlen, optlen; guint16 flags; @@ -970,11 +971,12 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) SET_ADDRESS(&iph->ip_src, AT_IPv4, 4, tvb_get_ptr(tvb, offset + IPH_SRC, 4)); if (tree) { if (ip_summary_in_tree) { + memcpy(&addr, iph->ip_src.data, 4); proto_item_append_text(ti, ", Src Addr: %s (%s)", - get_hostname((guint)(*((guint *)iph->ip_src.data))), ip_to_str((guint8 *) iph->ip_src.data)); + get_hostname(addr), ip_to_str((guint8 *) iph->ip_src.data)); } - proto_tree_add_ipv4(ip_tree, hf_ip_src, tvb, offset + 12, 4, (guint)(*((guint *)iph->ip_src.data))); - proto_tree_add_ipv4_hidden(ip_tree, hf_ip_addr, tvb, offset + 12, 4, (guint)(*((guint *)iph->ip_src.data))); + proto_tree_add_ipv4(ip_tree, hf_ip_src, tvb, offset + 12, 4, addr); + proto_tree_add_ipv4_hidden(ip_tree, hf_ip_addr, tvb, offset + 12, 4, addr); } SET_ADDRESS(&pinfo->net_dst, AT_IPv4, 4, tvb_get_ptr(tvb, offset + IPH_DST, 4)); @@ -983,11 +985,12 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { if (ip_summary_in_tree) { + memcpy(&addr, iph->ip_src.data, 4); proto_item_append_text(ti, ", Dst Addr: %s (%s)", - get_hostname((guint)(*((guint *)iph->ip_dst.data))), ip_to_str((guint8 *) iph->ip_dst.data)); + get_hostname(addr), ip_to_str((guint8 *) iph->ip_dst.data)); } - proto_tree_add_ipv4(ip_tree, hf_ip_dst, tvb, offset + 16, 4, (guint)(*((guint *)iph->ip_dst.data))); - proto_tree_add_ipv4_hidden(ip_tree, hf_ip_addr, tvb, offset + 16, 4, (guint)(*((guint *)iph->ip_dst.data))); + proto_tree_add_ipv4(ip_tree, hf_ip_dst, tvb, offset + 16, 4, addr); + proto_tree_add_ipv4_hidden(ip_tree, hf_ip_addr, tvb, offset + 16, 4, addr); } if (tree) { |