Replace ip6_to_str and ip6_guint8_to_str with address_to_str and tvb_ip_to_str.

Change-Id: I1d258923a7a63539ec8456d3e306bca5016a1e4b
Reviewed-on: https://code.wireshark.org/review/6060
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2014-12-21 12:38:13 -05:00
parent 9fce4dd4cb
commit 1d598bbff7
38 changed files with 183 additions and 247 deletions

View File

@ -738,8 +738,6 @@ libwireshark.so.0 libwireshark0 #MINVER#
ieee802a_add_oui@Base 1.9.1
in_cksum@Base 1.9.1
incomplete_tcp_stream@Base 1.9.1
ip6_guint8_to_str@Base 1.12.0~rc1
ip6_to_str@Base 1.9.1
ip_checksum@Base 1.99.0
ip_checksum_tvb@Base 1.99.0
ipopt_type_class_vals@Base 1.9.1

View File

@ -94,32 +94,6 @@ tvb_ip_to_str(tvbuff_t *tvb, const gint offset)
return buf;
}
/* XXX FIXME
remove this one later when every call has been converted to ep_address_to_str()
*/
const gchar *
ip6_to_str(const struct e_in6_addr *ad) {
gchar *str;
str=(gchar *)ep_alloc(MAX_IP6_STR_LEN);
ip6_to_str_buf(ad, str);
return str;
}
/* XXX FIXME
This exists solely for a single call from ui/iface_lists.c,
scan_local_interfaces(), and gcc's -fstrict-aliasing. The iface_lists.c
code should be change to used a different type for its ip6 address,
so that this function is no longer needed.
*/
const gchar *
ip6_guint8_to_str(const guint8 *ad) {
gchar *str;
str=(gchar *)ep_alloc(MAX_IP6_STR_LEN);
ip6_to_str_buf_len((const guchar*)ad, str, MAX_IP6_STR_LEN);
return str;
}
#define IPV6_LENGTH 16
const gchar *
tvb_ip6_to_str(tvbuff_t *tvb, const gint offset)

View File

@ -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);

View File

@ -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 *

View File

@ -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:

View File

@ -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 */

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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");

View File

@ -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));
}
}
/*

View File

@ -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;

View File

@ -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),

View File

@ -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);

View File

@ -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);

View File

@ -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:

View File

@ -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:
;

View File

@ -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));

View File

@ -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));

View File

@ -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");

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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 );
}

View File

@ -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 );
}

View File

@ -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;

View File

@ -146,8 +146,8 @@ build_follow_conv_filter( packet_info *pi ) {
/* UDP over IPv6 */
buf = 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 *)pi->net_src.data),
ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
address_to_str(pi->pool, &pi->net_src),
address_to_str(pi->pool, &pi->net_dst),
pi->srcport, pi->destport );
len = 16;
is_ipv6 = TRUE;

View File

@ -6075,9 +6075,14 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
case FT_IPv6:
bytes = (guint8 *)fvalue_get(&fi->value);
addr.type = AT_IPv6;
addr.len = 16;
addr.data = bytes;
label_fill_descr(label_str, 0, hfinfo,
get_hostname6((struct e_in6_addr *)bytes),
ip6_to_str((struct e_in6_addr*)bytes));
ep_address_to_str(&addr));
break;
case FT_GUID:

View File

@ -59,8 +59,6 @@ void ip_to_str_buf(const guint8 *ad, gchar *buf, const int buf_len);
extern gchar* fcwwn_to_str (const guint8 *);
WS_DLL_PUBLIC const gchar* tvb_fc_to_str(tvbuff_t *tvb, const gint offset);
WS_DLL_PUBLIC gchar* tvb_fcwwn_to_str (tvbuff_t *tvb, const gint offset);
WS_DLL_PUBLIC const gchar* ip6_to_str(const struct e_in6_addr *);
WS_DLL_PUBLIC const gchar* ip6_guint8_to_str(const guint8 *ad);
WS_DLL_PUBLIC const gchar* tvb_ip6_to_str(tvbuff_t *tvb, const gint offset);
void ip6_to_str_buf(const struct e_in6_addr *, gchar *);

View File

@ -633,7 +633,7 @@ static void wimaxasncp_proto_tree_add_tlv_ipv6_value(
tvb_get_ipv6(tvb, offset, &ip);
hostname = get_hostname6(&ip);
ip_str = ip6_to_str(&ip);
ip_str = tvb_ip6_to_str(tvb, offset);
proto_tree_add_ipv6_format(
tree, hf_value,
@ -1482,8 +1482,6 @@ static void wimaxasncp_dissect_tlv_value(
while (offset < tvb_length(tvb))
{
proto_tree *ip_address_mask_tree;
struct e_in6_addr ip;
const gchar *s;
ip_address_mask_tree = proto_tree_add_subtree(
ip_address_mask_list_tree, tvb, offset, 32,
@ -1494,8 +1492,6 @@ static void wimaxasncp_dissect_tlv_value(
* --------------------------------------------------------
*/
tvb_get_ipv6(tvb, offset, &ip);
proto_tree_add_item(
ip_address_mask_tree,
tlv_info->hf_ipv6,
@ -1513,16 +1509,10 @@ static void wimaxasncp_dissect_tlv_value(
* mask
* --------------------------------------------------------
*/
tvb_get_ipv6(tvb, offset, &ip);
s = ip6_to_str(&ip);
proto_tree_add_ipv6_format_value(
proto_tree_add_item(
ip_address_mask_tree,
tlv_info->hf_ipv6_mask,
tvb, offset, 16, (const guint8*)&ip,
"%s", s);
tvb, offset, 16, ENC_NA);
/* too long to display ?
proto_item_append_text(

View File

@ -1466,7 +1466,6 @@ my @TvbPtrAPIs = (
'proto_tree_add_bytes_format_value',
'proto_tree_add_ether',
# Use the tvb_* version of these:
'ip6_to_str',
'fcwwn_to_str',
# Use tvb_bytes_to_str[_punct] instead of:
'bytes_to_str',

View File

@ -1294,7 +1294,8 @@ insert_new_rows(GList *list)
g_string_append(ip_str, ep_address_to_str(&addr_str));
break;
case IF_AT_IPv6:
g_string_append(ip_str, ip6_to_str((struct e_in6_addr *)&addr->addr.ip6_addr));
SET_ADDRESS(&addr_str, AT_IPv6, 16, addr->addr.ip6_addr);
g_string_append(ip_str, ep_address_to_str(&addr_str));
break;
default:
/* In case we add non-IP addresses */

View File

@ -482,7 +482,8 @@ set_ip_addr_label(GSList *addr_list, GtkWidget *ip_lb, guint selected_ip_addr)
break;
case IF_AT_IPv6:
addr_str = ip6_to_str((struct e_in6_addr *)&addr->addr.ip6_addr);
SET_ADDRESS(&addr_address, AT_IPv6, 16, addr->addr.ip6_addr);
addr_str = ep_address_to_str(&addr_address);
break;
default:

View File

@ -273,14 +273,11 @@ update_analyse_dlg(struct sctp_analyse *u_data)
store = (address *)(list->data);
if (store->type != AT_NONE) {
if (store->type == AT_IPv4)
if ((store->type == AT_IPv4) || (store->type == AT_IPv6))
{
g_snprintf(field[0], 30, "%s", ep_address_to_str(store));
}
else if (store->type == AT_IPv6)
{
g_snprintf(field[0], 40, "%s", ip6_to_str((const struct e_in6_addr *)(store->data)));
g_snprintf(field[0], 40, "%s", ep_address_to_str(store));
}
list_store = GTK_LIST_STORE(
gtk_tree_view_get_model(GTK_TREE_VIEW(u_data->analyse_nb->page2->clist))); /* Get store */
@ -355,14 +352,11 @@ update_analyse_dlg(struct sctp_analyse *u_data)
store = (address *)(list->data);
if (store->type != AT_NONE) {
if (store->type == AT_IPv4)
if ((store->type == AT_IPv4) || (store->type == AT_IPv6))
{
g_snprintf(field[0], 30, "%s", ep_address_to_str(store));
}
else if (store->type == AT_IPv6)
{
g_snprintf(field[0], 40, "%s", ip6_to_str((const struct e_in6_addr *)(store->data)));
g_snprintf(field[0], 40, "%s", ep_address_to_str(store));
}
list_store = GTK_LIST_STORE(
gtk_tree_view_get_model(GTK_TREE_VIEW(u_data->analyse_nb->page3->clist))); /* Get store */

View File

@ -491,10 +491,8 @@ add_to_clist(sctp_addr_chunk* sac)
list_store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW (clist))); /* Get store */
if (sac->addr->type == AT_IPv4) {
if ((sac->addr->type == AT_IPv4) || (sac->addr->type == AT_IPv6)) {
g_snprintf(field[0], MAX_ADDRESS_LEN, "%s", ep_address_to_str(sac->addr));
} else if (sac->addr->type == AT_IPv6) {
g_snprintf(field[0], MAX_ADDRESS_LEN, "%s", ip6_to_str((const struct e_in6_addr *)(sac->addr->data)));
} else {
g_snprintf(field[0], MAX_ADDRESS_LEN, "%s", "NONE");
}

View File

@ -201,7 +201,8 @@ scan_local_interfaces(void (*update_cb)(void))
break;
case IF_AT_IPv6:
memcpy(temp_addr->addr.ip6_addr, addr->addr.ip6_addr, sizeof(addr->addr));
g_string_append(ip_str, ip6_guint8_to_str(addr->addr.ip6_addr));
SET_ADDRESS(&addr_str, AT_IPv6, 16, addr->addr.ip6_addr);
g_string_append(ip_str, ep_address_to_str(&addr_str));
break;
default:
/* In case we add non-IP addresses */

View File

@ -559,7 +559,8 @@ void ManageInterfacesDialog::addRemoteInterfaces(GList* rlist, remote_options *r
g_string_append(ip_str, ep_address_to_str(&addr_str));
break;
case IF_AT_IPv6:
g_string_append(ip_str, ip6_to_str((struct e_in6_addr *)&addr->addr.ip6_addr));
SET_ADDRESS(&addr_str, AT_IPv6, 16, addr->addr.ip6_addr);
g_string_append(ip_str, ep_address_to_str(&addr_str));
break;
default:
/* In case we add non-IP addresses */

View File

@ -130,10 +130,8 @@ void SCTPAssocAnalyseDialog::fillTabs()
store = (address *)(list->data);
if (store->type != AT_NONE) {
if (store->type == AT_IPv4) {
if ((store->type == AT_IPv4) || (store->type == AT_IPv6)) {
ui->listWidgetEP1->addItem(QString("%1").arg(ep_address_to_str(store)));
} else if (store->type == AT_IPv6) {
ui->listWidgetEP1->addItem(QString("%1").arg(ip6_to_str((const struct e_in6_addr *)(store->data))));
}
}
list = g_list_next(list);
@ -184,10 +182,8 @@ void SCTPAssocAnalyseDialog::fillTabs()
store = (address *)(list->data);
if (store->type != AT_NONE) {
if (store->type == AT_IPv4) {
if ((store->type == AT_IPv4) || (store->type == AT_IPv6)) {
ui->listWidgetEP2->addItem(QString("%1").arg(ep_address_to_str(store)));
} else if (store->type == AT_IPv6) {
ui->listWidgetEP2->addItem(QString("%1").arg(ip6_to_str((const struct e_in6_addr *)(store->data))));
}
}
list = g_list_next(list);