diff options
Diffstat (limited to 'epan/dissectors')
24 files changed, 155 insertions, 175 deletions
diff --git a/epan/dissectors/packet-aodv.c b/epan/dissectors/packet-aodv.c index a3bc0f5ad5..8d9762baa7 100644 --- a/epan/dissectors/packet-aodv.c +++ b/epan/dissectors/packet-aodv.c @@ -203,10 +203,10 @@ dissect_aodv_rreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, guint8 hop_count; guint32 rreq_id; const gchar *dest_addr_v4; - struct e_in6_addr dest_addr_v6; + const gchar *dest_addr_v6; guint32 dest_seqno; const gchar *orig_addr_v4; - struct e_in6_addr orig_addr_v6; + const gchar *orig_addr_v6; guint32 orig_seqno; int extlen; static const int * aodv_flags[] = { @@ -244,15 +244,13 @@ dissect_aodv_rreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, offset += 4; if (is_ipv6) { - tvb_get_ipv6(tvb, offset, &dest_addr_v6); + dest_addr_v6 = tvb_ip6_to_str(tvb, offset); if (aodv_tree) { - proto_tree_add_ipv6(aodv_tree, hf_aodv_dest_ipv6, tvb, offset, - INET6_ADDRLEN, (guint8 *)&dest_addr_v6); - proto_item_append_text(ti, ", Dest IP: %s", - ip6_to_str(&dest_addr_v6)); + proto_tree_add_item(aodv_tree, hf_aodv_dest_ipv6, tvb, offset, + INET6_ADDRLEN, ENC_NA); + proto_item_append_text(ti, ", Dest IP: %s", dest_addr_v6); } - col_append_fstr(pinfo->cinfo, COL_INFO, ", D: %s", - ip6_to_str(&dest_addr_v6)); + col_append_fstr(pinfo->cinfo, COL_INFO, ", D: %s", dest_addr_v6); offset += INET6_ADDRLEN; } else { dest_addr_v4 = tvb_ip_to_str(tvb, offset); @@ -271,15 +269,13 @@ dissect_aodv_rreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, offset += 4; if (is_ipv6) { - tvb_get_ipv6(tvb, offset, &orig_addr_v6); + orig_addr_v6 = tvb_ip6_to_str(tvb, offset); if (aodv_tree) { - proto_tree_add_ipv6(aodv_tree, hf_aodv_orig_ipv6, tvb, offset, - INET6_ADDRLEN, (guint8 *)&orig_addr_v6); - proto_item_append_text(ti, ", Orig IP: %s", - ip6_to_str(&orig_addr_v6)); + proto_tree_add_item(aodv_tree, hf_aodv_orig_ipv6, tvb, offset, + INET6_ADDRLEN, ENC_NA); + proto_item_append_text(ti, ", Orig IP: %s", orig_addr_v6); } - col_append_fstr(pinfo->cinfo, COL_INFO, ", O: %s", - ip6_to_str(&orig_addr_v6)); + col_append_fstr(pinfo->cinfo, COL_INFO, ", O: %s", orig_addr_v6); offset += INET6_ADDRLEN; } else { orig_addr_v4 = tvb_ip_to_str(tvb, offset); @@ -317,10 +313,10 @@ dissect_aodv_rrep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, guint8 prefix_sz; guint8 hop_count; const gchar *dest_addr_v4; - struct e_in6_addr dest_addr_v6; + const gchar *dest_addr_v6; guint32 dest_seqno; const gchar *orig_addr_v4; - struct e_in6_addr orig_addr_v6; + const gchar *orig_addr_v6; guint32 lifetime; int extlen; static const int * aodv_flags[] = { @@ -351,16 +347,14 @@ dissect_aodv_rrep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, offset += 1; if (is_ipv6) { - tvb_get_ipv6(tvb, offset, &dest_addr_v6); + dest_addr_v6 = tvb_ip6_to_str(tvb, offset); if (aodv_tree) { - proto_tree_add_ipv6(aodv_tree, hf_aodv_dest_ipv6, tvb, offset, - INET6_ADDRLEN, (guint8 *)&dest_addr_v6); - proto_item_append_text(ti, ", Dest IP: %s", - ip6_to_str(&dest_addr_v6)); + proto_tree_add_item(aodv_tree, hf_aodv_dest_ipv6, tvb, offset, + INET6_ADDRLEN, ENC_NA); + proto_item_append_text(ti, ", Dest IP: %s", dest_addr_v6); } - col_append_fstr(pinfo->cinfo, COL_INFO, ", D: %s", - ip6_to_str(&dest_addr_v6)); + col_append_fstr(pinfo->cinfo, COL_INFO, ", D: %s", dest_addr_v6); offset += INET6_ADDRLEN; } else { dest_addr_v4 = tvb_ip_to_str(tvb, offset); @@ -380,15 +374,13 @@ dissect_aodv_rrep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, offset += 4; if (is_ipv6) { - tvb_get_ipv6(tvb, offset, &orig_addr_v6); + orig_addr_v6 = tvb_ip6_to_str(tvb, offset); if (aodv_tree) { - proto_tree_add_ipv6(aodv_tree, hf_aodv_orig_ipv6, tvb, offset, - INET6_ADDRLEN, (guint8 *)&orig_addr_v6); - proto_item_append_text(ti, ", Orig IP: %s", - ip6_to_str(&orig_addr_v6)); + proto_tree_add_item(aodv_tree, hf_aodv_orig_ipv6, tvb, offset, + INET6_ADDRLEN, ENC_NA); + proto_item_append_text(ti, ", Orig IP: %s", orig_addr_v6); } - col_append_fstr(pinfo->cinfo, COL_INFO, ", O: %s", - ip6_to_str(&orig_addr_v6)); + col_append_fstr(pinfo->cinfo, COL_INFO, ", O: %s", orig_addr_v6); offset += INET6_ADDRLEN; } else { orig_addr_v4 = tvb_ip_to_str(tvb, offset); @@ -487,8 +479,8 @@ dissect_aodv_draft_01_v6_rreq(tvbuff_t *tvb, packet_info *pinfo, guint32 rreq_id; guint32 dest_seqno; guint32 orig_seqno; - struct e_in6_addr dest_addr_v6; - struct e_in6_addr orig_addr_v6; + const gchar *dest_addr_v6; + const gchar *orig_addr_v6; int extlen; static const int * aodv_flags[] = { &hf_aodv_flags_rreq_join, @@ -534,29 +526,26 @@ dissect_aodv_draft_01_v6_rreq(tvbuff_t *tvb, packet_info *pinfo, orig_seqno); offset += 4; - tvb_get_ipv6(tvb, offset, &dest_addr_v6); + dest_addr_v6 = tvb_ip6_to_str(tvb, offset); if (aodv_tree) { - proto_tree_add_ipv6(aodv_tree, hf_aodv_dest_ipv6, tvb, offset, - INET6_ADDRLEN, (guint8 *)&dest_addr_v6); - proto_item_append_text(ti, ", Dest IP: %s", - ip6_to_str(&dest_addr_v6)); + proto_tree_add_item(aodv_tree, hf_aodv_dest_ipv6, tvb, offset, + INET6_ADDRLEN, ENC_NA); + proto_item_append_text(ti, ", Dest IP: %s", dest_addr_v6); } - col_append_fstr(pinfo->cinfo, COL_INFO, ", D: %s", - ip6_to_str(&dest_addr_v6)); + col_append_fstr(pinfo->cinfo, COL_INFO, ", D: %s", dest_addr_v6); offset += INET6_ADDRLEN; - tvb_get_ipv6(tvb, offset, &orig_addr_v6); + orig_addr_v6 = tvb_ip6_to_str(tvb, offset); if (aodv_tree) { - proto_tree_add_ipv6(aodv_tree, hf_aodv_orig_ipv6, tvb, offset, - INET6_ADDRLEN, (guint8 *)&orig_addr_v6); - proto_item_append_text(ti, ", Orig IP: %s", - ip6_to_str(&orig_addr_v6)); + proto_tree_add_item(aodv_tree, hf_aodv_orig_ipv6, tvb, offset, + INET6_ADDRLEN, ENC_NA); + proto_item_append_text(ti, ", Orig IP: %s", orig_addr_v6); } col_append_fstr(pinfo->cinfo, COL_INFO, ", O: %s Id=%u Hcnt=%u DSN=%u OSN=%u", - ip6_to_str(&orig_addr_v6), + orig_addr_v6, rreq_id, hop_count, dest_seqno, @@ -578,8 +567,8 @@ dissect_aodv_draft_01_v6_rrep(tvbuff_t *tvb, packet_info *pinfo, guint8 prefix_sz; guint8 hop_count; guint32 dest_seqno; - struct e_in6_addr dest_addr_v6; - struct e_in6_addr orig_addr_v6; + const gchar *dest_addr_v6; + const gchar *orig_addr_v6; guint32 lifetime; int extlen; static const int * aodv_flags[] = { @@ -612,28 +601,24 @@ dissect_aodv_draft_01_v6_rrep(tvbuff_t *tvb, packet_info *pinfo, dest_seqno); offset += 4; - tvb_get_ipv6(tvb, offset, &dest_addr_v6); + dest_addr_v6 = tvb_ip6_to_str(tvb, offset); if (aodv_tree) { - proto_tree_add_ipv6(aodv_tree, hf_aodv_dest_ipv6, tvb, offset, - INET6_ADDRLEN, (guint8 *)&dest_addr_v6); - proto_item_append_text(ti, ", Dest IP: %s", - ip6_to_str(&dest_addr_v6)); + proto_tree_add_item(aodv_tree, hf_aodv_dest_ipv6, tvb, offset, + INET6_ADDRLEN, ENC_NA); + proto_item_append_text(ti, ", Dest IP: %s", dest_addr_v6); } - col_append_fstr(pinfo->cinfo, COL_INFO, ", D: %s", - ip6_to_str(&dest_addr_v6)); + col_append_fstr(pinfo->cinfo, COL_INFO, ", D: %s", dest_addr_v6); offset += INET6_ADDRLEN; - tvb_get_ipv6(tvb, offset, &orig_addr_v6); + orig_addr_v6 = tvb_ip6_to_str(tvb, offset); if (aodv_tree) { - proto_tree_add_ipv6(aodv_tree, hf_aodv_orig_ipv6, tvb, offset, - INET6_ADDRLEN, (guint8 *)&orig_addr_v6); - proto_item_append_text(ti, ", Orig IP: %s", - ip6_to_str(&orig_addr_v6)); + proto_tree_add_item(aodv_tree, hf_aodv_orig_ipv6, tvb, offset, + INET6_ADDRLEN, ENC_NA); + proto_item_append_text(ti, ", Orig IP: %s", orig_addr_v6); } - col_append_fstr(pinfo->cinfo, COL_INFO, ", O: %s", - ip6_to_str(&orig_addr_v6)); + col_append_fstr(pinfo->cinfo, COL_INFO, ", O: %s", orig_addr_v6); offset += INET6_ADDRLEN; lifetime = tvb_get_ntohl(tvb, offset); @@ -643,7 +628,7 @@ dissect_aodv_draft_01_v6_rrep(tvbuff_t *tvb, packet_info *pinfo, proto_item_append_text(ti, ", Lifetime=%u", lifetime); } - col_append_fstr(pinfo->cinfo, COL_INFO, " Hcnt=%u DSN=%u Lifetime=%u", + col_append_fstr(pinfo->cinfo, COL_INFO, " Hcnt=%u DSN=%u Lifetime=%u", hop_count, dest_seqno, lifetime); diff --git a/epan/dissectors/packet-babel.c b/epan/dissectors/packet-babel.c index 298007bb20..1f1f91c2b6 100644 --- a/epan/dissectors/packet-babel.c +++ b/epan/dissectors/packet-babel.c @@ -117,7 +117,13 @@ format_address(const unsigned char *prefix) return address_to_str(wmem_packet_scope(), &addr); } else - return ip6_to_str((const struct e_in6_addr*)prefix); + { + addr.type = AT_IPv6; + addr.len = 16; + addr.data = prefix; + + return address_to_str(wmem_packet_scope(), &addr); + } } static const char * diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c index 0911eda681..0475c3dfde 100644 --- a/epan/dissectors/packet-bgp.c +++ b/epan/dissectors/packet-bgp.c @@ -1788,6 +1788,7 @@ decode_prefix6(proto_tree *tree, packet_info *pinfo, int hf_addr, tvbuff_t *tvb, { proto_tree *prefix_tree; struct e_in6_addr addr; /* IPv6 address */ + address addr_str; int plen; /* prefix length */ int length; /* number of octets needed for prefix */ @@ -1801,9 +1802,10 @@ decode_prefix6(proto_tree *tree, packet_info *pinfo, int hf_addr, tvbuff_t *tvb, } /* put prefix into protocol tree */ + SET_ADDRESS(&addr_str, AT_IPv6, 16, addr.bytes); prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset, tlen != 0 ? tlen : 1 + length, ett_bgp_prefix, NULL, "%s/%u", - ip6_to_str(&addr), plen); + address_to_str(wmem_packet_scope(), &addr_str), plen); proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, offset, 1, plen, "%s prefix length: %u", tag, plen); proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 1, length, @@ -1817,6 +1819,7 @@ decode_fspec_match_prefix6(proto_tree *tree, proto_item *parent_item, int hf_add { proto_tree *prefix_tree; struct e_in6_addr addr; /* IPv6 address */ + address addr_str; int plen; /* prefix length */ int length; /* number of octets needed for prefix */ int poffset_place = 1; @@ -1837,16 +1840,17 @@ decode_fspec_match_prefix6(proto_tree *tree, proto_item *parent_item, int hf_add } /* put prefix into protocol tree */ + SET_ADDRESS(&addr_str, AT_IPv6, 16, addr.bytes); prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset, tlen != 0 ? tlen : 1 + length, ett_bgp_prefix, NULL, "%s/%u", - ip6_to_str(&addr), plen); + address_to_str(wmem_packet_scope(), &addr_str), plen); proto_tree_add_item(prefix_tree, hf_bgp_flowspec_nlri_ipv6_pref_len, tvb, offset + plength_place, 1, ENC_BIG_ENDIAN); proto_tree_add_item(prefix_tree, hf_bgp_flowspec_nlri_ipv6_pref_offset, tvb, offset + poffset_place, 1, ENC_BIG_ENDIAN); proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 2, length, addr.bytes); if (parent_item != NULL) proto_item_append_text(parent_item, " (%s/%u)", - ip6_to_str(&addr), plen); + address_to_str(wmem_packet_scope(), &addr_str), plen); return(2 + length); } @@ -2620,7 +2624,6 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, wmem_strbu { int length; /* length of the address in byte */ guint16 rd_type; /* Route Distinguisher type */ - struct e_in6_addr ip6addr; /* IPv6 address */ switch (afi) { case AFNUM_INET: @@ -2695,9 +2698,8 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, wmem_strbu case SAFNUM_MPLS_LABEL: case SAFNUM_ENCAPSULATION: case SAFNUM_TUNNEL: - length = 16 ; - tvb_get_ipv6(tvb, offset, &ip6addr); - wmem_strbuf_append_printf(strbuf, "%s", ip6_to_str(&ip6addr)); + length = 16; + wmem_strbuf_append_printf(strbuf, "%s", tvb_ip6_to_str(tvb, offset)); break; case SAFNUM_LAB_VPNUNICAST: case SAFNUM_LAB_VPNMULCAST: @@ -2706,27 +2708,24 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, wmem_strbu switch (rd_type) { case FORMAT_AS2_LOC: length = 8 + 16; - tvb_get_ipv6(tvb, offset + 8, &ip6addr); /* Next Hop */ wmem_strbuf_append_printf(strbuf, "Empty Label Stack RD=%u:%u IPv6=%s", tvb_get_ntohs(tvb, offset + 2), tvb_get_ntohl(tvb, offset + 4), - ip6_to_str(&ip6addr)); + tvb_ip6_to_str(tvb, offset + 8)); /* Next Hop */ break; case FORMAT_IP_LOC: length = 8 + 16; - tvb_get_ipv6(tvb, offset + 8, &ip6addr); /* Next Hop */ wmem_strbuf_append_printf(strbuf, "Empty Label Stack RD=%s:%u IPv6=%s", tvb_ip_to_str(tvb, offset + 2), /* IP part of the RD */ tvb_get_ntohs(tvb, offset + 6), - ip6_to_str(&ip6addr)); + tvb_ip6_to_str(tvb, offset + 8)); /* Next Hop */ break ; case FORMAT_AS4_LOC: length = 8 + 16; - tvb_get_ipv6(tvb, offset + 8, &ip6addr); /* Next Hop */ wmem_strbuf_append_printf(strbuf, "Empty Label Stack RD=%u:%u IPv6=%s", tvb_get_ntohl(tvb, offset + 2), tvb_get_ntohs(tvb, offset + 6), - ip6_to_str(&ip6addr)); + tvb_ip6_to_str(tvb, offset + 8)); /* Next Hop */ break ; default: length = 0 ; @@ -4118,8 +4117,6 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6, break; case FORMAT_IP_LOC: /* Code borrowed from the decode_prefix4 function */ - tvb_memcpy(tvb, ip4addr.addr_bytes, offset + 2, 4); - length = ipv4_addr_and_mask(tvb, offset + 8, ip4addr2.addr_bytes, plen); if (length < 0) { proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1, @@ -4238,11 +4235,12 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6, } /* XXX - break off IPv6 into its own field */ + SET_ADDRESS(&addr, AT_IPv6, 16, ip6addr.bytes); proto_tree_add_string_format(tree, hf_bgp_label_stack, tvb, start_offset, (offset + length) - start_offset, wmem_strbuf_get_str(stack_strbuf), "Label Stack=%s, IPv6=%s/%u", wmem_strbuf_get_str(stack_strbuf), - ip6_to_str(&ip6addr), plen); + address_to_str(wmem_packet_scope(), &addr), plen); total_length = (1 + labnum * 3) + length; break; case SAFNUM_ENCAPSULATION: @@ -4254,12 +4252,11 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6, return -1; } offset += 1; - tvb_get_ipv6(tvb, offset, &ip6addr); proto_tree_add_text(tree, tvb, offset, offset + 16, "Endpoint Address: %s", - ip6_to_str(&ip6addr)); + tvb_ip6_to_str(tvb, offset)); total_length = 17; /* length(1 octet) + address(16 octets) */ break; @@ -4281,10 +4278,11 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6, tag, plen + 16); return -1; } + SET_ADDRESS(&addr, AT_IPv6, 16, ip6addr.bytes); proto_tree_add_text(tree, tvb, start_offset, (offset + length) - start_offset, "Tunnel Identifier=0x%x IPv6=%s/%u", - tnl_id, ip6_to_str(&ip6addr), plen); + tnl_id, address_to_str(wmem_packet_scope(), &addr), plen); total_length = (1 + 2) + length; /* length field + Tunnel Id + IPv4 len */ break; @@ -4324,19 +4322,18 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6, } /* XXX - break up into multiple fields */ + SET_ADDRESS(&addr, AT_IPv6, 16, ip6addr.bytes); proto_tree_add_string_format(tree, hf_bgp_label_stack, tvb, start_offset, (offset + 8 + length) - start_offset, wmem_strbuf_get_str(stack_strbuf), "Label Stack=%s RD=%u:%u, IPv6=%s/%u", wmem_strbuf_get_str(stack_strbuf), tvb_get_ntohs(tvb, offset + 2), tvb_get_ntohl(tvb, offset + 4), - ip6_to_str(&ip6addr), plen); + address_to_str(wmem_packet_scope(), &addr), plen); total_length = (1 + labnum * 3 + 8) + length; break; case FORMAT_IP_LOC: - tvb_memcpy(tvb, ip4addr.addr_bytes, offset + 2, 4); - length = ipv6_addr_and_mask(tvb, offset + 8, &ip6addr, plen); if (length < 0) { proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1, @@ -4346,14 +4343,14 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6, } /* XXX - break up into multiple fields */ - SET_ADDRESS(&addr, AT_IPv4, 4, ip4addr.addr_bytes); + SET_ADDRESS(&addr, AT_IPv6, 16, &ip6addr); proto_tree_add_string_format(tree, hf_bgp_label_stack, tvb, start_offset, (offset + 8 + length) - start_offset, wmem_strbuf_get_str(stack_strbuf), "Label Stack=%s RD=%s:%u, IPv6=%s/%u", wmem_strbuf_get_str(stack_strbuf), - address_to_str(wmem_packet_scope(), &addr), + tvb_ip_to_str(tvb, offset + 2), tvb_get_ntohs(tvb, offset + 6), - ip6_to_str(&ip6addr), plen); + address_to_str(wmem_packet_scope(), &addr), plen); total_length = (1 + labnum * 3 + 8) + length; break; @@ -4367,6 +4364,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6, } /* XXX - break up into multiple fields */ + SET_ADDRESS(&addr, AT_IPv6, 16, ip6addr.bytes); proto_tree_add_string_format(tree, hf_bgp_label_stack, tvb, start_offset, (offset + 8 + length) - start_offset, "Label Stack=%s RD=%u.%u:%u, IPv6=%s/%u", @@ -4374,7 +4372,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6, tvb_get_ntohs(tvb, offset + 2), tvb_get_ntohs(tvb, offset + 4), tvb_get_ntohs(tvb, offset + 6), - ip6_to_str(&ip6addr), plen); + address_to_str(wmem_packet_scope(), &addr), plen); total_length = (1 + labnum * 3 + 8) + length; break; default: diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c index 5f52751df9..5565846174 100644 --- a/epan/dissectors/packet-dhcpv6.c +++ b/epan/dissectors/packet-dhcpv6.c @@ -1923,7 +1923,6 @@ dissect_dhcpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *ti; guint8 msgtype; gboolean at_end; - struct e_in6_addr in6; msgtype = tvb_get_guint8(tvb, off); @@ -1955,8 +1954,7 @@ dissect_dhcpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, expert_add_info_format(pinfo, previous_pi, &ei_dhcpv6_error_hopcount, "hopcount is not correctly incremented by 1 (expected : %d, actual : %d)", hpi.hopcount + 1, previous_hopcount); } hpi.relay_message_previously_detected = TRUE; - tvb_get_ipv6(tvb, off + 2, &in6); - col_append_fstr(pinfo->cinfo, COL_INFO, "L: %s ", ip6_to_str(&in6)); + col_append_fstr(pinfo->cinfo, COL_INFO, "L: %s ", tvb_ip6_to_str(tvb, off + 2)); off += 34; } else { /* Check the inner hopcount equals 0 */ diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index 00174eeea7..8e39a3559f 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -442,12 +442,14 @@ dissect_diameter_base_framed_ipv6_prefix(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree_add_item(tree, hf_framed_ipv6_prefix_ipv6, tvb, 2, prefix_len_bytes, ENC_NA); } else { struct e_in6_addr value; + address addr; memset(&value.bytes, 0, sizeof(value)); tvb_memcpy(tvb, (guint8 *)&value.bytes, 2, prefix_len_bytes); value.bytes[prefix_len_bytes] = value.bytes[prefix_len_bytes] & (0xff<<(prefix_len % 8)); proto_tree_add_ipv6(tree, hf_framed_ipv6_prefix_ipv6, tvb, 2, prefix_len_bytes, value.bytes); - diam_sub_dis->avp_str = wmem_strdup_printf(wmem_packet_scope(), "%s/%u", ip6_to_str((const struct e_in6_addr *)&value), prefix_len); + SET_ADDRESS(&addr, AT_IPv6, 16, value.bytes); + diam_sub_dis->avp_str = wmem_strdup_printf(wmem_packet_scope(), "%s/%u", address_to_str(wmem_packet_scope(), &addr), prefix_len); } return(prefix_len_bytes+2); diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index 7828282361..8660515271 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -2559,6 +2559,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, int a6_offset; int suf_offset; struct e_in6_addr suffix; + address suffix_addr; a6_offset = cur_offset; pre_len = tvb_get_guint8(tvb, cur_offset); @@ -2585,9 +2586,10 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, name_out = format_text(pname, strlen(pname)); if (cinfo != NULL) { + SET_ADDRESS(&suffix_addr, AT_IPv6, 16, suffix.bytes); col_append_fstr(cinfo, COL_INFO, " %d %s %s", pre_len, - ip6_to_str(&suffix), + address_to_str(wmem_packet_scope(), &suffix_addr), name_out); } @@ -2602,7 +2604,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, } proto_item_append_text(trr, ", addr %d %s %s", pre_len, - ip6_to_str(&suffix), + address_to_str(wmem_packet_scope(), &suffix_addr), name_out); } diff --git a/epan/dissectors/packet-eigrp.c b/epan/dissectors/packet-eigrp.c index 282a1948a8..f9d7044567 100644 --- a/epan/dissectors/packet-eigrp.c +++ b/epan/dissectors/packet-eigrp.c @@ -1115,6 +1115,7 @@ dissect_eigrp_ipv6_addr (proto_item *ti, proto_tree *tree, tvbuff_t *tvb, guint8 length; int addr_len; struct e_in6_addr addr; + address addr_str; proto_item *ti_prefixlen, *ti_dst; int first = TRUE; @@ -1136,12 +1137,13 @@ dissect_eigrp_ipv6_addr (proto_item *ti, proto_tree *tree, tvbuff_t *tvb, addr_len++; } + SET_ADDRESS(&addr_str, AT_IPv6, 16, addr.bytes); ti_dst = proto_tree_add_text(tree, tvb, offset, addr_len, - "Destination: %s", ip6_to_str(&addr)); + "Destination: %s", address_to_str(wmem_packet_scope(), &addr_str)); /* add it to the top level line */ proto_item_append_text(ti," %c %s/%u", first ? '=':',', - ip6_to_str(&addr), length); + address_to_str(wmem_packet_scope(), &addr_str), length); if (unreachable) { expert_add_info(pinfo, ti_dst, &ei_eigrp_unreachable); diff --git a/epan/dissectors/packet-gsm_a_gm.c b/epan/dissectors/packet-gsm_a_gm.c index 338db917b6..65351a9ad8 100644 --- a/epan/dissectors/packet-gsm_a_gm.c +++ b/epan/dissectors/packet-gsm_a_gm.c @@ -4159,7 +4159,6 @@ de_sm_pco(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, g guint32 curr_offset; guint curr_len; guchar oct; - struct e_in6_addr ipv6_addrx; int link_dir; proto_item *pco_item; proto_tree *pco_tree; @@ -4222,8 +4221,7 @@ de_sm_pco(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, g case 0x0003: case 0x0007: if ((link_dir == P2P_DIR_DL) && (e_len > 0)) { - tvb_get_ipv6(tvb, curr_offset, &ipv6_addrx); - proto_tree_add_text(pco_tree, tvb, curr_offset, 16, "IPv6: %s", ip6_to_str(&ipv6_addrx)); + proto_tree_add_text(pco_tree, tvb, curr_offset, 16, "IPv6: %s", tvb_ip6_to_str(tvb, curr_offset)); } break; case 0x0002: @@ -4248,8 +4246,7 @@ de_sm_pco(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, g break; case 0x0008: if ((link_dir == P2P_DIR_DL) && (e_len > 0)) { - tvb_get_ipv6(tvb, curr_offset, &ipv6_addrx); - proto_tree_add_text(pco_tree, tvb, curr_offset, 16, "IPv6: %s", ip6_to_str(&ipv6_addrx)); + proto_tree_add_text(pco_tree, tvb, curr_offset, 16, "IPv6: %s", tvb_ip6_to_str(tvb, curr_offset)); oct = tvb_get_guint8(tvb, curr_offset+16); proto_tree_add_text(pco_tree, tvb, curr_offset+16, 1, "Prefix length: %u", oct); } diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c index e26638df11..78254f1353 100644 --- a/epan/dissectors/packet-gtp.c +++ b/epan/dissectors/packet-gtp.c @@ -3906,7 +3906,6 @@ decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_ guint16 length; guint8 pdp_typ, pdp_org; - struct e_in6_addr addr_ipv6; proto_tree *ext_tree_user; proto_item *te; @@ -3937,16 +3936,14 @@ decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_ proto_item_append_text(te, " : %s", tvb_ip_to_str(tvb, offset + 5)); break; case 0x57: - tvb_get_ipv6(tvb, offset + 5, &addr_ipv6); - proto_tree_add_ipv6(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 16, (guint8 *) & addr_ipv6); - proto_item_append_text(te, " : %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6)); + proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 16, ENC_NA); + proto_item_append_text(te, " : %s", tvb_ip6_to_str(tvb, offset + 5)); break; case 0x8d: proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, ENC_BIG_ENDIAN); - tvb_get_ipv6(tvb, offset + 9, &addr_ipv6); - proto_tree_add_ipv6(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 9, 16, (guint8 *) & addr_ipv6); + proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 9, 16, ENC_NA); proto_item_append_text(te, " : %s / %s", tvb_ip_to_str(tvb, offset + 5), - ip6_to_str((struct e_in6_addr *) &addr_ipv6)); + tvb_ip6_to_str(tvb, offset + 9)); break; } } else @@ -5003,7 +5000,6 @@ decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_t guint8 addr_type, addr_len; guint16 length; - struct e_in6_addr addr_ipv6; proto_tree *ext_tree_gsn_addr; proto_item *te; @@ -5028,9 +5024,8 @@ decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_t break; case 16: proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN); - tvb_get_ipv6(tvb, offset + 3, &addr_ipv6); - proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6)); - proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6); + proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 3, 16, ENC_NA); + proto_item_append_text(te, "%s", tvb_ip6_to_str(tvb, offset + 3)); break; case 17: proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_information_element_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN); @@ -5038,9 +5033,8 @@ decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_t proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type); addr_len = tvb_get_guint8(tvb, offset + 3) & 0x3F; proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len); - tvb_get_ipv6(tvb, offset + 4, &addr_ipv6); - proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6)); - proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 4, 16, (guint8 *) & addr_ipv6); + proto_item_append_text(te, "%s", tvb_ip6_to_str(tvb, offset + 4)); + proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 4, 16, ENC_NA); break; default: proto_item_append_text(te, "unknown type or wrong length"); @@ -5141,7 +5135,6 @@ decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * guint8 tft_flags, tft_code, no_packet_filters, i, pf_eval, pf_len, pf_content_id, proto; guint pf_offset; guint32 ipsec_id, label; - struct e_in6_addr addr_ipv6, mask_ipv6; proto_tree *ext_tree_tft, *ext_tree_tft_pf, *ext_tree_tft_flags; proto_item *tee, *pf_item; @@ -5194,10 +5187,8 @@ decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * break; /* address IPv6 and mask = 32 bytes */ case 0x20: - tvb_get_ipv6(tvb, offset + pf_offset + 1, &addr_ipv6); - tvb_get_ipv6(tvb, offset + pf_offset + 17, &mask_ipv6); proto_item_set_text(pf_item, "ID 0x20: IPv6/mask: %s/%s", - ip6_to_str((struct e_in6_addr *) &addr_ipv6), ip6_to_str((struct e_in6_addr *) &mask_ipv6)); + tvb_ip6_to_str(tvb, offset + pf_offset + 1), tvb_ip6_to_str(tvb, offset + pf_offset + 17)); proto_item_set_len(pf_item, 33); pf_offset += 33; break; @@ -5460,7 +5451,6 @@ decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_ { guint16 length; - struct e_in6_addr addr_ipv6; proto_tree *ext_tree_chrg_addr; proto_item *te; @@ -5477,9 +5467,8 @@ decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_ proto_item_append_text(te, "%s", tvb_ip_to_str(tvb, offset + 3)); break; case 16: - tvb_get_ipv6(tvb, offset + 3, &addr_ipv6); - proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6)); - proto_tree_add_ipv6(ext_tree_chrg_addr, hf_gtp_chrg_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6); + proto_tree_add_item(ext_tree_chrg_addr, hf_gtp_chrg_ipv6, tvb, offset + 3, 16, ENC_NA); + proto_item_append_text(te, "%s", tvb_ip6_to_str(tvb, offset + 3)); break; default: proto_item_append_text(te, "unknown type or wrong length"); @@ -7784,7 +7773,6 @@ decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_ { guint16 length; - struct e_in6_addr addr_ipv6; proto_tree *ext_tree_node_addr; proto_item *te; @@ -7801,9 +7789,8 @@ decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_ proto_item_append_text(te, "%s", tvb_ip_to_str(tvb, offset + 3)); break; case 16: - tvb_get_ipv6(tvb, offset + 3, &addr_ipv6); - proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6)); - proto_tree_add_ipv6(ext_tree_node_addr, hf_gtp_node_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6); + proto_tree_add_item(ext_tree_node_addr, hf_gtp_node_ipv6, tvb, offset + 3, 16, ENC_NA); + proto_item_append_text(te, "%s", tvb_ip6_to_str(tvb, offset + 3)); break; default: proto_item_append_text(te, "unknown type or wrong length"); diff --git a/epan/dissectors/packet-gtpv2.c b/epan/dissectors/packet-gtpv2.c index 193c7cb2b9..2503c152c3 100644 --- a/epan/dissectors/packet-gtpv2.c +++ b/epan/dissectors/packet-gtpv2.c @@ -1633,7 +1633,6 @@ static void dissect_gtpv2_ip_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_) { int offset = 0; - struct e_in6_addr ipv6_address; if (length == 4) { @@ -1643,8 +1642,7 @@ dissect_gtpv2_ip_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree else if (length == 16) { proto_tree_add_item(tree, hf_gtpv2_ip_address_ipv6, tvb, offset, length, ENC_NA); - tvb_get_ipv6(tvb, offset, &ipv6_address); - proto_item_append_text(item, "IPv6 %s", ip6_to_str(&ipv6_address)); + proto_item_append_text(item, "IPv6 %s", tvb_ip6_to_str(tvb, offset)); } } /* diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c index 80676c6309..7d82f0d8d7 100644 --- a/epan/dissectors/packet-icmpv6.c +++ b/epan/dissectors/packet-icmpv6.c @@ -1832,6 +1832,7 @@ dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree guint8 prefix_len; guint8 route_preference; struct e_in6_addr prefix; + address prefix_addr; /* Prefix Len */ proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_prefix_len, tvb, opt_offset, 1, ENC_BIG_ENDIAN); @@ -1871,7 +1872,8 @@ dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree memset(&prefix, 0, sizeof(prefix)); tvb_memcpy(tvb, (guint8 *)&prefix.bytes, opt_offset, 8); proto_tree_add_ipv6(icmp6opt_tree, hf_icmpv6_opt_prefix, tvb, opt_offset, 8, prefix.bytes); - proto_item_append_text(ti, " %s/%d", ip6_to_str(&prefix), prefix_len); + SET_ADDRESS(&prefix_addr, AT_IPv6, 16, prefix.bytes); + proto_item_append_text(ti, " %s/%d", address_to_str(wmem_packet_scope(), &prefix_addr), prefix_len); opt_offset += 8; break; case 24: @@ -2136,6 +2138,7 @@ dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree guint8 context_id; guint8 context_len; struct e_in6_addr context_prefix; + address context_prefix_addr; /* Context Length */ proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_6co_context_length, tvb, opt_offset, 1, ENC_BIG_ENDIAN); @@ -2168,7 +2171,8 @@ dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree case 16: tvb_memcpy(tvb, (guint8 *)&context_prefix.bytes, opt_offset, 8); proto_tree_add_ipv6(icmp6opt_tree, hf_icmpv6_opt_6co_context_prefix, tvb, opt_offset, 8, context_prefix.bytes); - proto_item_append_text(ti, " %s/%d", ip6_to_str(&context_prefix), context_len); + SET_ADDRESS(&context_prefix_addr, AT_IPv6, 16, context_prefix.bytes); + proto_item_append_text(ti, " %s/%d", address_to_str(wmem_packet_scope(), &context_prefix_addr), context_len); opt_offset += 8; break; case 24: @@ -2295,6 +2299,7 @@ dissect_icmpv6_rpl_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree case RPL_OPT_ROUTING: { guint8 prefix_len; struct e_in6_addr prefix; + address prefix_addr; /* Prefix length */ prefix_len = tvb_get_guint8(tvb, opt_offset); @@ -2329,7 +2334,8 @@ dissect_icmpv6_rpl_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree memset(&prefix, 0, sizeof(prefix)); tvb_memcpy(tvb, (guint8 *)&prefix.bytes, opt_offset, 8); proto_tree_add_ipv6(icmp6opt_tree, hf_icmpv6_rpl_opt_route_prefix, tvb, opt_offset, 8, prefix.bytes); - proto_item_append_text(ti, " %s/%d", ip6_to_str(&prefix), prefix_len); + SET_ADDRESS(&prefix_addr, AT_IPv6, 16, prefix.bytes); + proto_item_append_text(ti, " %s/%d", address_to_str(wmem_packet_scope(), &prefix_addr), prefix_len); opt_offset += 8; break; case 22: @@ -2394,6 +2400,7 @@ dissect_icmpv6_rpl_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree case RPL_OPT_TARGET: { guint8 prefix_len; struct e_in6_addr target_prefix; + address target_prefix_addr; /* Flag */ proto_tree_add_item(icmp6opt_tree, hf_icmpv6_rpl_opt_target_flag, tvb, opt_offset, 1, ENC_NA); @@ -2414,7 +2421,8 @@ dissect_icmpv6_rpl_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree memset(&target_prefix, 0, sizeof(target_prefix)); tvb_memcpy(tvb, (guint8 *)&target_prefix.bytes, opt_offset, 8); proto_tree_add_ipv6(icmp6opt_tree, hf_icmpv6_rpl_opt_target_prefix, tvb, opt_offset, 8, target_prefix.bytes); - proto_item_append_text(ti, " %s/%d", ip6_to_str(&target_prefix), prefix_len); + SET_ADDRESS(&target_prefix_addr, AT_IPv6, 16, target_prefix.bytes); + proto_item_append_text(ti, " %s/%d", address_to_str(wmem_packet_scope(), &target_prefix_addr), prefix_len); opt_offset += 8; break; case 18: @@ -3145,7 +3153,6 @@ dissect_mldrv2( tvbuff_t *tvb, guint32 offset, packet_info *pinfo _U_, proto_tre while(mldr_offset < (int)tvb_reported_length(tvb) ) { guint8 aux_data_len, record_type; guint16 i, nb_sources; - struct e_in6_addr multicast_address; ti_mar = proto_tree_add_item(tree, hf_icmpv6_mldr_mar, tvb, mldr_offset, -1, ENC_NA); mar_tree = proto_item_add_subtree(ti_mar, ett_icmpv6_mar); @@ -3167,7 +3174,7 @@ dissect_mldrv2( tvbuff_t *tvb, guint32 offset, packet_info *pinfo _U_, proto_tre /* Multicast Address */ proto_tree_add_item(mar_tree, hf_icmpv6_mldr_mar_multicast_address, tvb, mldr_offset, 16, ENC_NA); - tvb_get_ipv6(tvb, mldr_offset, &multicast_address); + proto_item_append_text(ti_mar, " %s: %s", val_to_str(record_type, mldr_record_type_val,"Unknown Record Type (%d)"), tvb_ip6_to_str(tvb, mldr_offset)); mldr_offset += 16; /* Source Address */ @@ -3185,7 +3192,6 @@ dissect_mldrv2( tvbuff_t *tvb, guint32 offset, packet_info *pinfo _U_, proto_tre /* Multicast Address Record Length */ proto_item_set_len(ti_mar, 4 + 16 + (16 * nb_sources) + (aux_data_len * 4)); - proto_item_append_text(ti_mar, " %s: %s", val_to_str(record_type, mldr_record_type_val,"Unknown Record Type (%d)"), ip6_to_str(&multicast_address)); } return mldr_offset; diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index ac803f10bd..08db4cb5c5 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -432,8 +432,8 @@ static gchar* ipv6_build_color_filter(packet_info *pinfo) { return g_strdup_printf("ipv6.addr eq %s and ipv6.addr eq %s", - ip6_to_str((const struct e_in6_addr *)pinfo->net_src.data), - ip6_to_str((const struct e_in6_addr *)pinfo->net_dst.data)); + address_to_str(pinfo->pool, &pinfo->net_src), + address_to_str(pinfo->pool, &pinfo->net_dst)); } static const fragment_items ipv6_frag_items = { @@ -1847,6 +1847,7 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 *mac_addr; const char *name; dissector_handle_t nxt_handle; + address addr; /* Provide as much IPv4 header information as possible as some dissectors in the ip.proto dissector table may need it */ @@ -1926,7 +1927,8 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) PROTO_ITEM_SET_HIDDEN(ti); name = ep_address_to_display(&pinfo->src); if (ipv6_summary_in_tree) { - proto_item_append_text(ipv6_item, ", Src: %s (%s)", name, ip6_to_str(&ipv6.ip6_src)); + SET_ADDRESS(&addr, AT_IPv6, 16, ipv6.ip6_src.bytes); + proto_item_append_text(ipv6_item, ", Src: %s (%s)", name, address_to_str(wmem_packet_scope(), &addr)); } ti = proto_tree_add_string(ipv6_tree, hf_ipv6_src_host, tvb, offset + (int)offsetof(struct ip6_hdr, ip6_src), @@ -2013,7 +2015,8 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) PROTO_ITEM_SET_HIDDEN(ti); name = ep_address_to_display(&pinfo->dst); if (ipv6_summary_in_tree) { - proto_item_append_text(ipv6_item, ", Dst: %s (%s)", name, ip6_to_str(&ipv6.ip6_dst)); + SET_ADDRESS(&addr, AT_IPv6, 16, ipv6.ip6_dst.bytes); + proto_item_append_text(ipv6_item, ", Dst: %s (%s)", name, address_to_str(wmem_packet_scope(), &addr)); } ti = proto_tree_add_string(ipv6_tree, hf_ipv6_dst_host, tvb, offset + (int)offsetof(struct ip6_hdr, ip6_dst), diff --git a/epan/dissectors/packet-isis-lsp.c b/epan/dissectors/packet-isis-lsp.c index f16c1ab5b7..cf67ccfeb6 100644 --- a/epan/dissectors/packet-isis-lsp.c +++ b/epan/dissectors/packet-isis-lsp.c @@ -1215,6 +1215,7 @@ dissect_lsp_ipv6_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree guint bit_length; int byte_length; struct e_in6_addr prefix; + address prefix_addr; guint len,i; guint subclvs_len; guint clv_code, clv_len; @@ -1237,8 +1238,9 @@ dissect_lsp_ipv6_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree subtree = proto_tree_add_subtree(tree, tvb, offset, 6+byte_length+subclvs_len, ett_isis_lsp_part_of_clv_ipv6_reachability, NULL, "IPv6 Reachability"); + SET_ADDRESS(&prefix_addr, AT_IPv6, 16, prefix.bytes); proto_tree_add_ipv6_format_value(subtree, hf_isis_lsp_ipv6_reachability_ipv6_prefix, tvb, offset+6, byte_length, - (guint8*)&prefix, "IPv6 prefix: %s/%u", ip6_to_str (&prefix), bit_length); + (guint8*)&prefix, "IPv6 prefix: %s/%u", address_to_str(wmem_packet_scope(), &prefix_addr), bit_length); proto_tree_add_item(subtree, hf_isis_lsp_ipv6_reachability_metric, tvb, offset, 4, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_isis_lsp_ipv6_reachability_distribution, tvb, offset+4, 1, ENC_NA); diff --git a/epan/dissectors/packet-lisp.c b/epan/dissectors/packet-lisp.c index 7f68a35b3e..30ae2055e7 100644 --- a/epan/dissectors/packet-lisp.c +++ b/epan/dissectors/packet-lisp.c @@ -515,7 +515,6 @@ get_addr_str(tvbuff_t *tvb, gint offset, guint16 afi, guint16 *addr_len) { const gchar *notset_str = "not set"; const gchar *addr_str; - struct e_in6_addr locator_v6; guint8 lcaf_type; guint32 iid, asn; guint16 cur_len; @@ -529,9 +528,8 @@ get_addr_str(tvbuff_t *tvb, gint offset, guint16 afi, guint16 *addr_len) addr_str = tvb_ip_to_str(tvb, offset); return addr_str; case AFNUM_INET6: - tvb_get_ipv6(tvb, offset, &locator_v6); *addr_len = INET6_ADDRLEN; - addr_str = ip6_to_str(&locator_v6); + addr_str = tvb_ip6_to_str(tvb, offset); return addr_str; case AFNUM_LCAF: get_lcaf_data(tvb, offset, &lcaf_type, addr_len); diff --git a/epan/dissectors/packet-lldp.c b/epan/dissectors/packet-lldp.c index 6efcf1c5d6..d470aa0de3 100644 --- a/epan/dissectors/packet-lldp.c +++ b/epan/dissectors/packet-lldp.c @@ -1104,7 +1104,6 @@ dissect_lldp_chassis_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui guint16 tempShort; guint32 dataLen = 0; const char *strPtr=NULL; - struct e_in6_addr ip6_addr; guint8 addr_family = 0; proto_tree *chassis_tree = NULL; @@ -1188,15 +1187,14 @@ dissect_lldp_chassis_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui break; case AFNUM_INET6: if (dataLen == 18){ - tvb_get_ipv6(tvb, offset, &ip6_addr); - strPtr = ip6_to_str(&ip6_addr); + strPtr = tvb_ip6_to_str(tvb, offset); }else{ expert_add_info_format(pinfo, lf, &ei_lldp_bad_length, "Invalid Chassis ID Length (%u) for Type (%s, %s), expected (18)", dataLen, val_to_str_const(tlvsubType, chassis_id_subtypes, ""), val_to_str_const(addr_family, afn_vals, "")); return -1; } - proto_tree_add_ipv6(chassis_tree, hf_chassis_id_ip6, tvb, offset, 16, ip6_addr.bytes); + proto_tree_add_item(chassis_tree, hf_chassis_id_ip6, tvb, offset, 16, ENC_NA); break; default: @@ -1262,7 +1260,6 @@ dissect_lldp_port_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint3 guint16 tempShort; guint32 dataLen = 0; const char *strPtr=NULL; - struct e_in6_addr ip6_addr; guint8 addr_family = 0; proto_tree *port_tree = NULL; @@ -1342,15 +1339,14 @@ dissect_lldp_port_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint3 break; case AFNUM_INET6: if (dataLen == 18){ - tvb_get_ipv6(tvb, offset, &ip6_addr); - strPtr = ip6_to_str(&ip6_addr); + strPtr = tvb_ip6_to_str(tvb, offset); }else{ expert_add_info_format(pinfo, lf, &ei_lldp_bad_length, "Invalid Port ID Length (%u) for Type (%s, %s), expected (18)", dataLen, val_to_str_const(tlvsubType, port_id_subtypes, ""), val_to_str_const(addr_family, afn_vals, "")); return -1; } - proto_tree_add_ipv6(port_tree, hf_port_id_ip6, tvb, offset, 16, ip6_addr.bytes); + proto_tree_add_item(port_tree, hf_port_id_ip6, tvb, offset, 16, ENC_NA); break; default: diff --git a/epan/dissectors/packet-nsip.c b/epan/dissectors/packet-nsip.c index e08b819e7a..9022c74d23 100644 --- a/epan/dissectors/packet-nsip.c +++ b/epan/dissectors/packet-nsip.c @@ -383,7 +383,6 @@ decode_iei_bvci(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) { static proto_item * decode_ip_element(nsip_ip_element_info_t *element, build_info_t *bi, proto_tree * element_tree) { guint16 udp_port; - struct e_in6_addr ip6_addr; proto_item *tf; proto_tree *field_tree; @@ -402,12 +401,11 @@ decode_ip_element(nsip_ip_element_info_t *element, build_info_t *bi, proto_tree break; case NSIP_IP_VERSION_6: - tvb_get_ipv6(bi->tvb, bi->offset, &ip6_addr); proto_tree_add_item(field_tree, hf_nsip_ip_address_ipv6, bi->tvb, bi->offset, element->address_length, ENC_NA); proto_item_append_text(tf, ": IP address: %s", - ip6_to_str((struct e_in6_addr *)&ip6_addr)); + tvb_ip6_to_str(bi->tvb, bi->offset)); break; default: ; diff --git a/epan/dissectors/packet-ospf.c b/epan/dissectors/packet-ospf.c index 954b6800be..0fc5c348f1 100644 --- a/epan/dissectors/packet-ospf.c +++ b/epan/dissectors/packet-ospf.c @@ -3037,6 +3037,7 @@ static void dissect_ospf_v3_address_prefix(tvbuff_t *tvb, int offset, int prefix int bytes_to_process; struct e_in6_addr prefix; + address addr; bytes_to_process=((prefix_length+31)/32)*4; @@ -3056,8 +3057,9 @@ static void dissect_ospf_v3_address_prefix(tvbuff_t *tvb, int offset, int prefix } } if (address_family == OSPF_AF_6) { + SET_ADDRESS(&addr, AT_IPv6, 16, prefix.bytes); proto_tree_add_text(tree, tvb, offset, bytes_to_process, - "Address Prefix: %s", ip6_to_str(&prefix)); + "Address Prefix: %s", address_to_str(wmem_packet_scope(), &addr)); } else { proto_tree_add_text(tree, tvb, offset, bytes_to_process, "Address Prefix: %s", tvb_ip_to_str(tvb, offset)); diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c index 54e39ee018..b132b7de2a 100644 --- a/epan/dissectors/packet-ppp.c +++ b/epan/dissectors/packet-ppp.c @@ -3593,22 +3593,26 @@ dissect_vsncp_pdnaddress_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset, case 2: { struct e_in6_addr *ad = wmem_new0(wmem_packet_scope(),struct e_in6_addr); + address addr; tvb_memcpy(tvb, &ad->bytes[8], offset + 3, 8); + SET_ADDRESS(&addr, AT_IPv6, 16, ad->bytes); proto_tree_add_ipv6_format(field_tree, hf_vsncp_pdn_ipv6, tvb, offset + 3, length - 3, ad->bytes, "%s: %s", val_to_str_const(pdnaddtype, vsncp_pdntype_vals, "Unknown"), - ip6_to_str(ad)); + address_to_str(wmem_packet_scope(), &addr)); break; } case 3: { struct e_in6_addr *ad = wmem_new0(wmem_packet_scope(), struct e_in6_addr); + address addr; tvb_memcpy(tvb, &ad->bytes[8], offset + 3, 8); + SET_ADDRESS(&addr, AT_IPv6, 16, ad->bytes); proto_tree_add_ipv6_format(field_tree, hf_vsncp_pdn_ipv6, tvb, offset + 3, length - 3, ad->bytes, "%s: %s", val_to_str_const(pdnaddtype, vsncp_pdntype_vals, "Unknown"), - ip6_to_str(ad)); + address_to_str(wmem_packet_scope(), &addr)); proto_tree_add_ipv4_format(field_tree, hf_vsncp_pdn_ipv4, tvb, offset + 11, length - 11, tvb_get_ntohl(tvb, offset + 11), "%s: %s", val_to_str_const(pdnaddtype, vsncp_pdntype_vals, "Unknown"), tvb_ip_to_str(tvb, offset + 11)); diff --git a/epan/dissectors/packet-rsip.c b/epan/dissectors/packet-rsip.c index 138d9fb485..3dd9479d7c 100644 --- a/epan/dissectors/packet-rsip.c +++ b/epan/dissectors/packet-rsip.c @@ -256,7 +256,6 @@ rsip_parameter(tvbuff_t *tvb, proto_tree *rsip_tree, int off, int eoff) guint32 bid, cid, leasetm, msgc; proto_tree *p_tree, *v_tree; proto_item *pti, *vti; - struct e_in6_addr in6; /* XXX */ if (off >= eoff) @@ -316,12 +315,11 @@ rsip_parameter(tvbuff_t *tvb, proto_tree *rsip_tree, int off, int eoff) break; case 3: /* IPv6 */ if (paramlen - 1 > 0) { - tvb_get_ipv6(tvb, off + 4, &in6); proto_tree_add_item(v_tree, hf_rsip_parameter_address_ipv6, tvb, off + 4, paramlen - 1, ENC_NA); proto_item_append_text(pti, ": %s", - ip6_to_str(&in6)); + tvb_ip6_to_str(tvb, off + 4)); } else proto_item_append_text(pti, ": Any IPv6 Address"); diff --git a/epan/dissectors/packet-sasp.c b/epan/dissectors/packet-sasp.c index db2155fae0..55bb3fca53 100644 --- a/epan/dissectors/packet-sasp.c +++ b/epan/dissectors/packet-sasp.c @@ -653,7 +653,7 @@ static guint32 dissect_memdatacomp(tvbuff_t *tvb, proto_tree *pay_load, guint32 struct e_in6_addr ipv6_address; tvb_get_ipv6(tvb, offset+7, &ipv6_address); - ip_str = ip6_to_str(&ipv6_address); + ip_str = tvb_ip6_to_str(tvb, offset+7); lab_len = tvb_get_guint8(tvb, offset+23); diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index a1396b96c1..72056a0abb 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -994,9 +994,9 @@ const gchar *tree_ip_str(packet_info *pinfo, guint16 cmd) { if ( cmd == SMB_COM_READ_ANDX || cmd == SMB_COM_READ || cmd == SMB2_COM_READ) { - buf = ip6_to_str((const struct e_in6_addr *)pinfo->src.data); + buf = address_to_str(wmem_packet_scope(), &pinfo->src); } else { - buf = ip6_to_str((const struct e_in6_addr *)pinfo->dst.data); + buf = address_to_str(wmem_packet_scope(), &pinfo->dst); } } diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index c73ddaccb4..def33dbe81 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -651,8 +651,8 @@ tcp_build_color_filter(packet_info *pinfo) if( pinfo->net_src.type == AT_IPv6 && pinfo->net_dst.type == AT_IPv6 ) { /* TCP over IPv6 */ return g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)", - ip6_to_str((const struct e_in6_addr *)pinfo->net_src.data), - ip6_to_str((const struct e_in6_addr *)pinfo->net_dst.data), + address_to_str(pinfo->pool, &pinfo->net_src), + address_to_str(pinfo->pool, &pinfo->net_dst), pinfo->srcport, pinfo->destport ); } diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c index a85bd7180b..693e009d35 100644 --- a/epan/dissectors/packet-udp.c +++ b/epan/dissectors/packet-udp.c @@ -397,8 +397,8 @@ udp_build_color_filter(packet_info *pinfo) if( pinfo->net_src.type == AT_IPv6 && pinfo->net_dst.type == AT_IPv6 ) { /* UDP over IPv6 */ return g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (udp.port eq %d and udp.port eq %d)", - ip6_to_str((const struct e_in6_addr *)pinfo->net_src.data), - ip6_to_str((const struct e_in6_addr *)pinfo->net_dst.data), + address_to_str(pinfo->pool, &pinfo->net_src), + address_to_str(pinfo->pool, &pinfo->net_dst), pinfo->srcport, pinfo->destport ); } diff --git a/epan/dissectors/packet-xmcp.c b/epan/dissectors/packet-xmcp.c index 66b0f1dc8d..57cf6d98d8 100644 --- a/epan/dissectors/packet-xmcp.c +++ b/epan/dissectors/packet-xmcp.c @@ -647,11 +647,9 @@ decode_xmcp_attr_value (proto_tree *attr_tree, guint16 attr_type, if (attr_length != 20) { expert_add_info_format(pinfo, attr_tree, &ei_xmcp_attr_length_bad, "Malformed IPv6 address"); } else { - struct e_in6_addr ipv6; proto_tree_add_item(attr_tree, xmcp_attr_servtrans_ipv6, tvb, (offset+4), 16, ENC_NA); - tvb_get_ipv6(tvb, (offset+4), &ipv6); - proto_item_append_text(attr_tree, ": [%s]:%u", ip6_to_str(&ipv6), + proto_item_append_text(attr_tree, ": [%s]:%u", tvb_ip6_to_str(tvb, (offset+4)), tvb_get_ntohs(tvb, (offset+2))); } break; |