aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss.ws@gmail.com>2012-12-02 04:49:13 +0000
committerJeff Morriss <jeff.morriss.ws@gmail.com>2012-12-02 04:49:13 +0000
commit49466f95bc1fe3cc139f3750fcc934ffc210faef (patch)
tree14c72b7db9d4fe0af875d373d6023c92bae0463a
parentda4442d6384b15530fd740295080a8ad3a145ca6 (diff)
Introduce, and start using, TVB_SET_ADDRESS() and TVB_SET_ADDRESS_HF(). They
are like the non-TVB versions except that they take a TVB and an offset instead of (frequently) a pointer into the TVB. Calling tvb_get_ptr() before modifying the rest of the fields should help fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7960 (though I can't reproduce that problem). Replace a bunch of calls like: SET_ADDRESS(..., AT_XXX, length, tvb_get_ptr(tvb, offset, length)); with: TVB_SET_ADDRESS(..., AT_XXX, tvb, offset, length); svn path=/trunk/; revision=46324
-rw-r--r--epan/address.h32
-rw-r--r--epan/dissectors/packet-arcnet.c8
-rw-r--r--epan/dissectors/packet-bt-dht.c4
-rw-r--r--epan/dissectors/packet-catapult-dct2000.c30
-rw-r--r--epan/dissectors/packet-fc.c4
-rw-r--r--epan/dissectors/packet-iax2.c2
-rw-r--r--epan/dissectors/packet-ieee80211.c2
-rw-r--r--epan/dissectors/packet-ieee802154.c8
-rw-r--r--epan/dissectors/packet-ipv6.c17
-rw-r--r--epan/dissectors/packet-mstp.c8
-rw-r--r--epan/dissectors/packet-netflow.c8
-rw-r--r--epan/dissectors/packet-rsvp.c21
-rw-r--r--epan/dissectors/packet-slimp3.c2
-rw-r--r--epan/dissectors/packet-tr.c4
-rw-r--r--epan/dissectors/packet-vuze-dht.c4
15 files changed, 85 insertions, 69 deletions
diff --git a/epan/address.h b/epan/address.h
index e650699647..cf20d3c48c 100644
--- a/epan/address.h
+++ b/epan/address.h
@@ -70,17 +70,45 @@ typedef struct _address {
} address;
#define SET_ADDRESS(addr, addr_type, addr_len, addr_data) { \
+ (addr)->data = (addr_data); \
+ (addr)->type = (addr_type); \
+ (addr)->hf = -1; \
+ (addr)->len = (addr_len); \
+ }
+
+/* Same as SET_ADDRESS but it takes a TVB and an offset instead of
+ * (frequently) a pointer into a TVB. This allow us to get the tvb_get_ptr()
+ * call out of the dissectors.
+ *
+ * Call tvb_get_ptr() first in case it throws an exception: then we won't
+ * modify the address at all.
+ */
+#define TVB_SET_ADDRESS(addr, addr_type, tvb, offset, addr_len) { \
+ (addr)->data = tvb_get_ptr(tvb, offset, addr_len); \
(addr)->type = (addr_type); \
(addr)->hf = -1; \
(addr)->len = (addr_len); \
- (addr)->data = (addr_data); \
}
#define SET_ADDRESS_HF(addr, addr_type, addr_len, addr_data, addr_hf) { \
+ (addr)->data = (addr_data); \
+ (addr)->type = (addr_type); \
+ (addr)->hf = (addr_hf); \
+ (addr)->len = (addr_len); \
+ }
+
+/* Same as SET_ADDRESS_HF but it takes a TVB and an offset instead of
+ * (frequently) a pointer into a TVB. This allow us to get the tvb_get_ptr()
+ * call out of the dissectors.
+ *
+ * Call tvb_get_ptr() first in case it throws an exception: then we won't
+ * modify the address at all.
+ */
+#define TVB_SET_ADDRESS_HF(addr, addr_type, tvb, offset, addr_len, addr_hf) { \
+ (addr)->data = tvb_get_ptr(tvb, offset, addr_len); \
(addr)->type = (addr_type); \
(addr)->hf = (addr_hf); \
(addr)->len = (addr_len); \
- (addr)->data = (addr_data); \
}
/*
diff --git a/epan/dissectors/packet-arcnet.c b/epan/dissectors/packet-arcnet.c
index 348833b25c..156661e72e 100644
--- a/epan/dissectors/packet-arcnet.c
+++ b/epan/dissectors/packet-arcnet.c
@@ -142,10 +142,10 @@ dissect_arcnet_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
src = tvb_get_guint8 (tvb, 0);
dst = tvb_get_guint8 (tvb, 1);
- SET_ADDRESS(&pinfo->dl_src, AT_ARCNET, 1, tvb_get_ptr(tvb, 0, 1));
- SET_ADDRESS(&pinfo->src, AT_ARCNET, 1, tvb_get_ptr(tvb, 0, 1));
- SET_ADDRESS(&pinfo->dl_dst, AT_ARCNET, 1, tvb_get_ptr(tvb, 1, 1));
- SET_ADDRESS(&pinfo->dst, AT_ARCNET, 1, tvb_get_ptr(tvb, 1, 1));
+ TVB_SET_ADDRESS(&pinfo->dl_src, AT_ARCNET, tvb, 0, 1);
+ TVB_SET_ADDRESS(&pinfo->src, AT_ARCNET, tvb, 0, 1);
+ TVB_SET_ADDRESS(&pinfo->dl_dst, AT_ARCNET, tvb, 1, 1);
+ TVB_SET_ADDRESS(&pinfo->dst, AT_ARCNET, tvb, 1, 1);
ti = proto_tree_add_item (tree, proto_arcnet, tvb, 0, -1, ENC_NA);
diff --git a/epan/dissectors/packet-bt-dht.c b/epan/dissectors/packet-bt-dht.c
index cce92d23fb..ebdce25df1 100644
--- a/epan/dissectors/packet-bt-dht.c
+++ b/epan/dissectors/packet-bt-dht.c
@@ -254,7 +254,7 @@ dissect_bt_dht_values(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint
for( ; string_len>=6; string_len-=6, offset+=6 )
{
peer_index += 1;
- SET_ADDRESS( &addr, AT_IPv4, 4, tvb_get_ptr( tvb, offset, 4) );
+ TVB_SET_ADDRESS( &addr, AT_IPv4, tvb, offset, 4);
port = tvb_get_letohl( tvb, offset+4 );
value_ti = proto_tree_add_none_format( sub_tree, hf_bt_dht_peer, tvb, offset, 6,
@@ -311,7 +311,7 @@ dissect_bt_dht_nodes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint
node_index += 1;
id = tvb_bytes_to_str(tvb, offset, 20 );
- SET_ADDRESS( &addr, AT_IPv4, 4, tvb_get_ptr( tvb, offset, 4) );
+ TVB_SET_ADDRESS( &addr, AT_IPv4, tvb, offset, 4);
port = tvb_get_letohl( tvb, offset+24 );
node_ti = proto_tree_add_none_format( sub_tree, hf_bt_dht_node, tvb, offset, 26,
diff --git a/epan/dissectors/packet-catapult-dct2000.c b/epan/dissectors/packet-catapult-dct2000.c
index 4099e95017..8086fd19d0 100644
--- a/epan/dissectors/packet-catapult-dct2000.c
+++ b/epan/dissectors/packet-catapult-dct2000.c
@@ -2589,14 +2589,12 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (source_addr_offset != 0) {
proto_item *addr_ti;
- SET_ADDRESS(&pinfo->net_src,
+ TVB_SET_ADDRESS(&pinfo->net_src,
(source_addr_length == 4) ? AT_IPv4 : AT_IPv6,
- source_addr_length,
- (tvb_get_ptr(tvb, source_addr_offset, source_addr_length)));
- SET_ADDRESS(&pinfo->src,
+ tvb, source_addr_offset, source_addr_length);
+ TVB_SET_ADDRESS(&pinfo->src,
(source_addr_length == 4) ? AT_IPv4 : AT_IPv6,
- source_addr_length,
- (tvb_get_ptr(tvb, source_addr_offset, source_addr_length)));
+ tvb, source_addr_offset, source_addr_length);
proto_tree_add_item(ipprim_tree,
(source_addr_length == 4) ?
@@ -2634,14 +2632,12 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (dest_addr_offset != 0) {
proto_item *addr_ti;
- SET_ADDRESS(&pinfo->net_dst,
+ TVB_SET_ADDRESS(&pinfo->net_dst,
(dest_addr_length == 4) ? AT_IPv4 : AT_IPv6,
- dest_addr_length,
- (tvb_get_ptr(tvb, dest_addr_offset, dest_addr_length)));
- SET_ADDRESS(&pinfo->dst,
+ tvb, dest_addr_offset, dest_addr_length);
+ TVB_SET_ADDRESS(&pinfo->dst,
(dest_addr_length == 4) ? AT_IPv4 : AT_IPv6,
- dest_addr_length,
- (tvb_get_ptr(tvb, dest_addr_offset, dest_addr_length)));
+ tvb, dest_addr_offset, dest_addr_length);
proto_tree_add_item(ipprim_tree,
(dest_addr_length == 4) ?
hf_catapult_dct2000_ipprim_dst_addr_v4 :
@@ -2749,14 +2745,12 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (dest_addr_offset != 0) {
proto_item *addr_ti;
- SET_ADDRESS(&pinfo->net_dst,
+ TVB_SET_ADDRESS(&pinfo->net_dst,
(dest_addr_length == 4) ? AT_IPv4 : AT_IPv6,
- dest_addr_length,
- (tvb_get_ptr(tvb, dest_addr_offset, dest_addr_length)));
- SET_ADDRESS(&pinfo->dst,
+ tvb, dest_addr_offset, dest_addr_length);
+ TVB_SET_ADDRESS(&pinfo->dst,
(dest_addr_length == 4) ? AT_IPv4 : AT_IPv6,
- dest_addr_length,
- (tvb_get_ptr(tvb, dest_addr_offset, dest_addr_length)));
+ tvb, dest_addr_offset, dest_addr_length);
proto_tree_add_item(sctpprim_tree,
(dest_addr_length == 4) ?
hf_catapult_dct2000_sctpprim_dst_addr_v4 :
diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c
index c0f17d2371..7298f51a37 100644
--- a/epan/dissectors/packet-fc.c
+++ b/epan/dissectors/packet-fc.c
@@ -735,8 +735,8 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
* will use ip addresses instead and still work.
*/
if(!is_ifcp){
- SET_ADDRESS (&pinfo->dst, AT_FC, 3, tvb_get_ptr(tvb,offset+1,3));
- SET_ADDRESS (&pinfo->src, AT_FC, 3, tvb_get_ptr(tvb,offset+5,3));
+ TVB_SET_ADDRESS (&pinfo->dst, AT_FC, tvb, offset+1, 3);
+ TVB_SET_ADDRESS (&pinfo->src, AT_FC, tvb, offset+5, 3);
pinfo->srcport=0;
pinfo->destport=0;
}
diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c
index dfc1ac4fb6..7372f469b1 100644
--- a/epan/dissectors/packet-iax2.c
+++ b/epan/dissectors/packet-iax2.c
@@ -1219,7 +1219,7 @@ static guint32 dissect_ies(tvbuff_t *tvb, guint32 offset,
ie_data->peer_port = tvb_get_ntohs(tvb, offset+4);
/* the ip address is big-endian, but then so is peer_address.data */
- SET_ADDRESS(&ie_data->peer_address, AT_IPv4, 4, tvb_get_ptr(tvb, offset+6, 4));
+ TVB_SET_ADDRESS(&ie_data->peer_address, AT_IPv4, tvb, offset+6, 4);
break;
default:
diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c
index 86b37770cf..44340341d4 100644
--- a/epan/dissectors/packet-ieee80211.c
+++ b/epan/dissectors/packet-ieee80211.c
@@ -11405,7 +11405,7 @@ dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo,
SET_ADDRESS_HF(&pinfo->dst, AT_ETHER, 6, dst, hf_ieee80211_addr_da);
/* for tap */
- SET_ADDRESS_HF(&whdr->bssid, AT_ETHER, 6, tvb_get_ptr(tvb, 16,6), hf_ieee80211_addr_bssid);
+ TVB_SET_ADDRESS_HF(&whdr->bssid, AT_ETHER, tvb, 16, 6, hf_ieee80211_addr_bssid);
SET_ADDRESS_HF(&whdr->src, AT_ETHER, 6, src, hf_ieee80211_addr_sa);
SET_ADDRESS_HF(&whdr->dst, AT_ETHER, 6, dst, hf_ieee80211_addr_da);
whdr->type = frame_type_subtype;
diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c
index 2d4ba0f56b..a8fe89bd50 100644
--- a/epan/dissectors/packet-ieee802154.c
+++ b/epan/dissectors/packet-ieee802154.c
@@ -714,8 +714,8 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
ieee_hints->dst16 = packet->dst16;
}
- SET_ADDRESS(&pinfo->dl_dst, AT_IEEE_802_15_4_SHORT, 2, tvb_get_ptr(tvb, offset, 2));
- SET_ADDRESS(&pinfo->dst, AT_IEEE_802_15_4_SHORT, 2, tvb_get_ptr(tvb, offset, 2));
+ TVB_SET_ADDRESS(&pinfo->dl_dst, AT_IEEE_802_15_4_SHORT, tvb, offset, 2);
+ TVB_SET_ADDRESS(&pinfo->dst, AT_IEEE_802_15_4_SHORT, tvb, offset, 2);
if (tree) {
proto_tree_add_uint(ieee802154_tree, hf_ieee802154_dst16, tvb, offset, 2, packet->dst16);
@@ -809,8 +809,8 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
}
}
- SET_ADDRESS(&pinfo->dl_src, AT_IEEE_802_15_4_SHORT, 2, tvb_get_ptr(tvb, offset, 2));
- SET_ADDRESS(&pinfo->src, AT_IEEE_802_15_4_SHORT, 2, tvb_get_ptr(tvb, offset, 2));
+ TVB_SET_ADDRESS(&pinfo->dl_src, AT_IEEE_802_15_4_SHORT, tvb, offset, 2);
+ TVB_SET_ADDRESS(&pinfo->src, AT_IEEE_802_15_4_SHORT, tvb, offset, 2);
/* Add the addressing info to the tree. */
if (tree) {
diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c
index c91d138680..5532863d6c 100644
--- a/epan/dissectors/packet-ipv6.c
+++ b/epan/dissectors/packet-ipv6.c
@@ -631,16 +631,15 @@ dissect_routing6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo
+ n * sizeof(struct e_in6_addr),
sizeof(struct e_in6_addr), ENC_NA);
if (seg_left)
- SET_ADDRESS(&pinfo->dst, AT_IPv6, 16, tvb_get_ptr(tvb,
- offset + offsetof(struct ip6_rthdr0, ip6r0_addr)
- + n * sizeof(struct e_in6_addr), 16));
+ TVB_SET_ADDRESS(&pinfo->dst, AT_IPv6, tvb,
+ offset + offsetof(struct ip6_rthdr0, ip6r0_addr) + n * sizeof(struct e_in6_addr), 16);
}
}
if (rt.ip6r_type == IPv6_RT_HEADER_MobileIP) {
proto_tree_add_item(rthdr_tree, hf_ipv6_mipv6_home_address, tvb,
offset + 8, 16, ENC_NA);
if (seg_left)
- SET_ADDRESS(&pinfo->dst, AT_IPv6, 16, tvb_get_ptr(tvb, offset + 8, 16));
+ TVB_SET_ADDRESS(&pinfo->dst, AT_IPv6, tvb, offset + 8, 16);
}
if (rt.ip6r_type == IPv6_RT_HEADER_RPL) {
guint8 cmprI;
@@ -975,7 +974,7 @@ dissect_opts(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info * pinfo, c
}
proto_tree_add_item(opt_tree, hf_ipv6_mipv6_home_address, tvb,
offset, 16, ENC_NA);
- SET_ADDRESS(&pinfo->src, AT_IPv6, 16, tvb_get_ptr(tvb, offset, 16));
+ TVB_SET_ADDRESS(&pinfo->src, AT_IPv6, tvb, offset, 16);
offset += 16;
break;
case IP6OPT_CALIPSO:
@@ -1690,10 +1689,10 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Adjust the length of this tvbuff to include only the IPv6 datagram. */
set_actual_length(tvb, plen + sizeof (struct ip6_hdr));
- SET_ADDRESS(&pinfo->net_src, AT_IPv6, 16, tvb_get_ptr(tvb, offset + IP6H_SRC, 16));
- SET_ADDRESS(&pinfo->src, AT_IPv6, 16, tvb_get_ptr(tvb, offset + IP6H_SRC, 16));
- SET_ADDRESS(&pinfo->net_dst, AT_IPv6, 16, tvb_get_ptr(tvb, offset + IP6H_DST, 16));
- SET_ADDRESS(&pinfo->dst, AT_IPv6, 16, tvb_get_ptr(tvb, offset + IP6H_DST, 16));
+ TVB_SET_ADDRESS(&pinfo->net_src, AT_IPv6, tvb, offset + IP6H_SRC, 16);
+ TVB_SET_ADDRESS(&pinfo->src, AT_IPv6, tvb, offset + IP6H_SRC, 16);
+ TVB_SET_ADDRESS(&pinfo->net_dst, AT_IPv6, tvb, offset + IP6H_DST, 16);
+ TVB_SET_ADDRESS(&pinfo->dst, AT_IPv6, tvb, offset + IP6H_DST, 16);
if (tree) {
proto_tree* pt;
diff --git a/epan/dissectors/packet-mstp.c b/epan/dissectors/packet-mstp.c
index e5bb2fd91b..829a589bf5 100644
--- a/epan/dissectors/packet-mstp.c
+++ b/epan/dissectors/packet-mstp.c
@@ -327,10 +327,10 @@ dissect_mstp_wtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* set the MS/TP MAC address in the source/destination */
/* Use AT_ARCNET since it is similar to BACnet MS/TP */
- SET_ADDRESS(&pinfo->dl_dst, AT_ARCNET, 1, tvb_get_ptr(tvb, offset+3, 1));
- SET_ADDRESS(&pinfo->dst, AT_ARCNET, 1, tvb_get_ptr(tvb, offset+3, 1));
- SET_ADDRESS(&pinfo->dl_src, AT_ARCNET, 1, tvb_get_ptr(tvb, offset+4, 1));
- SET_ADDRESS(&pinfo->src, AT_ARCNET, 1, tvb_get_ptr(tvb, offset+4, 1));
+ TVB_SET_ADDRESS(&pinfo->dl_dst, AT_ARCNET, tvb, offset+3, 1);
+ TVB_SET_ADDRESS(&pinfo->dst, AT_ARCNET, tvb, offset+3, 1);
+ TVB_SET_ADDRESS(&pinfo->dl_src, AT_ARCNET, tvb, offset+4, 1);
+ TVB_SET_ADDRESS(&pinfo->src, AT_ARCNET, tvb, offset+4, 1);
#ifdef BACNET_MSTP_SUMMARY_IN_TREE
mstp_frame_type = tvb_get_guint8(tvb, offset+2);
diff --git a/epan/dissectors/packet-netflow.c b/epan/dissectors/packet-netflow.c
index 9d98515a56..70ac1172c3 100644
--- a/epan/dissectors/packet-netflow.c
+++ b/epan/dissectors/packet-netflow.c
@@ -4521,28 +4521,28 @@ dissect_v9_v10_pdu_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pdutree,
case VENDOR_CACE << 16 | 0: /* caceLocalIPv4Address */
ti = proto_tree_add_item(pdutree, hf_pie_cace_local_ipv4_address,
tvb, offset, length, ENC_NA);
- SET_ADDRESS(&local_addr, AT_IPv4, 4, tvb_get_ptr(tvb, offset, 4));
+ TVB_SET_ADDRESS(&local_addr, AT_IPv4, tvb, offset, 4);
got_flags |= GOT_LOCAL_ADDR;
break;
case VENDOR_CACE << 16 | 1: /* caceRemoteIPv4Address */
ti = proto_tree_add_item(pdutree, hf_pie_cace_remote_ipv4_address,
tvb, offset, length, ENC_NA);
- SET_ADDRESS(&remote_addr, AT_IPv4, 4, tvb_get_ptr(tvb, offset, 4));
+ TVB_SET_ADDRESS(&remote_addr, AT_IPv4, tvb, offset, 4);
got_flags |= GOT_REMOTE_ADDR;
break;
case VENDOR_CACE << 16 | 2: /* caceLocalIPv6Address */
ti = proto_tree_add_item(pdutree, hf_pie_cace_local_ipv6_address,
tvb, offset, length, ENC_NA);
- SET_ADDRESS(&local_addr, AT_IPv6, 16, tvb_get_ptr(tvb, offset, 16));
+ TVB_SET_ADDRESS(&local_addr, AT_IPv6, tvb, offset, 16);
got_flags |= GOT_LOCAL_ADDR;
break;
case VENDOR_CACE << 16 | 3: /* caceRemoteIPv6Address */
ti = proto_tree_add_item(pdutree, hf_pie_cace_remote_ipv6_address,
tvb, offset, length, ENC_NA);
- SET_ADDRESS(&remote_addr, AT_IPv6, 16, tvb_get_ptr(tvb, offset, 16));
+ TVB_SET_ADDRESS(&remote_addr, AT_IPv6, tvb, offset, 16);
got_flags |= GOT_REMOTE_ADDR;
break;
diff --git a/epan/dissectors/packet-rsvp.c b/epan/dissectors/packet-rsvp.c
index 0e9c6ed604..c40d888477 100644
--- a/epan/dissectors/packet-rsvp.c
+++ b/epan/dissectors/packet-rsvp.c
@@ -1825,8 +1825,7 @@ dissect_rsvp_session(proto_item *ti, proto_tree *rsvp_object_tree,
* later.
*/
rsvph->session_type = RSVP_SESSION_TYPE_IPV4;
- SET_ADDRESS(&rsvph->destination, AT_IPv4, 4,
- tvb_get_ptr(tvb, offset2, 4));
+ TVB_SET_ADDRESS(&rsvph->destination, AT_IPv4, tvb, offset2, 4);
rsvph->protocol = tvb_get_guint8(tvb, offset2+4);
rsvph->udp_dest_port = tvb_get_ntohs(tvb, offset2+6);
@@ -1881,8 +1880,7 @@ dissect_rsvp_session(proto_item *ti, proto_tree *rsvp_object_tree,
* later.
*/
rsvph->session_type = RSVP_SESSION_TYPE_IPV4_LSP;
- SET_ADDRESS(&rsvph->destination, AT_IPv4, 4,
- tvb_get_ptr(tvb, offset2, 4));
+ TVB_SET_ADDRESS(&rsvph->destination, AT_IPv4, tvb, offset2, 4);
rsvph->udp_dest_port = tvb_get_ntohs(tvb, offset2+6);
rsvph->ext_tunnel_id = tvb_get_ntohl(tvb, offset2 + 8);
break;
@@ -1904,8 +1902,7 @@ dissect_rsvp_session(proto_item *ti, proto_tree *rsvp_object_tree,
* later.
*/
rsvph->session_type = RSVP_SESSION_TYPE_AGGREGATE_IPV4;
- SET_ADDRESS(&rsvph->destination, AT_IPv4, 4,
- tvb_get_ptr(tvb, offset2, 4));
+ TVB_SET_ADDRESS(&rsvph->destination, AT_IPv4, tvb, offset2, 4);
rsvph->dscp = tvb_get_guint8(tvb, offset2+7);
rsvph->ext_tunnel_id = tvb_get_ntohl(tvb, offset2 + 8);
break;
@@ -1934,8 +1931,7 @@ dissect_rsvp_session(proto_item *ti, proto_tree *rsvp_object_tree,
* later.
*/
rsvph->session_type = RSVP_SESSION_TYPE_IPV4_UNI;
- SET_ADDRESS(&rsvph->destination, AT_IPv4, 4,
- tvb_get_ptr(tvb, offset2, 4));
+ TVB_SET_ADDRESS(&rsvph->destination, AT_IPv4, tvb, offset2, 4);
rsvph->udp_dest_port = tvb_get_ntohs(tvb, offset2+6);
rsvph->ext_tunnel_id = tvb_get_ntohl(tvb, offset2 + 8);
@@ -1965,8 +1961,7 @@ dissect_rsvp_session(proto_item *ti, proto_tree *rsvp_object_tree,
* later.
*/
rsvph->session_type = RSVP_SESSION_TYPE_IPV4_E_NNI;
- SET_ADDRESS(&rsvph->destination, AT_IPv4, 4,
- tvb_get_ptr(tvb, offset2, 4));
+ TVB_SET_ADDRESS(&rsvph->destination, AT_IPv4, tvb, offset2, 4);
rsvph->udp_dest_port = tvb_get_ntohs(tvb, offset2+6);
rsvph->ext_tunnel_id = tvb_get_ntohl(tvb, offset2 + 8);
@@ -2729,7 +2724,7 @@ dissect_rsvp_template_filter(proto_item *ti, proto_tree *rsvp_object_tree,
/*
* Save this information to build the conversation request key later.
*/
- SET_ADDRESS(&rsvph->source, AT_IPv4, 4, tvb_get_ptr(tvb, offset2, 4));
+ TVB_SET_ADDRESS(&rsvph->source, AT_IPv4, tvb, offset2, 4);
rsvph->udp_source_port = tvb_get_ntohs(tvb, offset2+6);
break;
@@ -2757,7 +2752,7 @@ dissect_rsvp_template_filter(proto_item *ti, proto_tree *rsvp_object_tree,
/*
* Save this information to build the conversation request key later.
*/
- SET_ADDRESS(&rsvph->source, AT_IPv4, 4, tvb_get_ptr(tvb, offset2, 4));
+ TVB_SET_ADDRESS(&rsvph->source, AT_IPv4, tvb, offset2, 4);
rsvph->udp_source_port = tvb_get_ntohs(tvb, offset2+6);
break;
@@ -2771,7 +2766,7 @@ dissect_rsvp_template_filter(proto_item *ti, proto_tree *rsvp_object_tree,
/*
* Save this information to build the conversation request key later.
*/
- SET_ADDRESS(&rsvph->source, AT_IPv4, 4, tvb_get_ptr(tvb, offset2, 4));
+ TVB_SET_ADDRESS(&rsvph->source, AT_IPv4, tvb, offset2, 4);
break;
default:
diff --git a/epan/dissectors/packet-slimp3.c b/epan/dissectors/packet-slimp3.c
index 4580c3248d..cbea147ec6 100644
--- a/epan/dissectors/packet-slimp3.c
+++ b/epan/dissectors/packet-slimp3.c
@@ -272,7 +272,7 @@ dissect_slimp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
* is used to identify packets originating at the client.
*/
if ((pinfo->destport == UDP_PORT_SLIMP3_V2) && (pinfo->srcport == UDP_PORT_SLIMP3_V2)) {
- SET_ADDRESS(&tmp_addr, AT_ETHER, 6, tvb_get_ptr(tvb, offset+12, 6));
+ TVB_SET_ADDRESS(&tmp_addr, AT_ETHER, tvb, offset+12, 6);
to_server = ADDRESSES_EQUAL(&tmp_addr, &pinfo->dl_src);
}
else if (pinfo->destport == UDP_PORT_SLIMP3_V2) {
diff --git a/epan/dissectors/packet-tr.c b/epan/dissectors/packet-tr.c
index 70075eca9d..2149585651 100644
--- a/epan/dissectors/packet-tr.c
+++ b/epan/dissectors/packet-tr.c
@@ -370,8 +370,8 @@ dissect_tr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Get the data */
trh->fc = tvb_get_guint8(tr_tvb, 1);
- SET_ADDRESS(&trh->src, AT_ETHER, 6, tvb_get_ptr(tr_tvb, 8, 6));
- SET_ADDRESS(&trh->dst, AT_ETHER, 6, tvb_get_ptr(tr_tvb, 2, 6));
+ TVB_SET_ADDRESS(&trh->src, AT_ETHER, tr_tvb, 8, 6);
+ TVB_SET_ADDRESS(&trh->dst, AT_ETHER, tr_tvb, 2, 6);
/* if the high bit on the first byte of src hwaddr is 1, then
this packet is source-routed */
diff --git a/epan/dissectors/packet-vuze-dht.c b/epan/dissectors/packet-vuze-dht.c
index a8857485bd..c0ee58c2fb 100644
--- a/epan/dissectors/packet-vuze-dht.c
+++ b/epan/dissectors/packet-vuze-dht.c
@@ -300,11 +300,11 @@ dissect_vuze_dht_address(tvbuff_t *tvb, packet_info _U_*pinfo, proto_tree *tree,
{
case TL_IPv4:
proto_tree_add_item(sub_tree, hf_vuze_dht_address_v4, tvb, offset, ip_length, ENC_BIG_ENDIAN);
- SET_ADDRESS( &addr, AT_IPv4, ip_length, tvb_get_ptr( tvb, offset, ip_length) );
+ TVB_SET_ADDRESS( &addr, AT_IPv4, tvb, offset, ip_length);
break;
case TL_IPv6:
proto_tree_add_item(sub_tree, hf_vuze_dht_address_v6, tvb, offset, ip_length, ENC_NA);
- SET_ADDRESS( &addr, AT_IPv6, ip_length, tvb_get_ptr( tvb, offset, ip_length) );
+ TVB_SET_ADDRESS( &addr, AT_IPv6, tvb, offset, ip_length);
break;
default:
addr.type = AT_NONE;