osi: avoid global memory scopes
Add scope arguments to the OSI helper methods which allocate buffers to avoid the use of the global wmem_packet_scope().
This commit is contained in:
parent
b39fc2aafc
commit
8b194a924f
|
@ -362,7 +362,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
proto_tree_add_bytes_format_value(clnp_tree, hf_clnp_dest, tvb, offset, dst_len,
|
||||
NULL,
|
||||
"%s",
|
||||
print_nsap_net(tvb, offset, dst_len));
|
||||
print_nsap_net(pinfo->pool, tvb, offset, dst_len));
|
||||
offset += dst_len;
|
||||
opt_len -= dst_len;
|
||||
|
||||
|
@ -398,7 +398,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
proto_tree_add_bytes_format_value(clnp_tree, hf_clnp_src, tvb, offset, src_len,
|
||||
NULL,
|
||||
"%s",
|
||||
print_nsap_net(tvb, offset, src_len));
|
||||
print_nsap_net(pinfo->pool, tvb, offset, src_len));
|
||||
offset += src_len;
|
||||
opt_len -= src_len;
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ esis_dissect_esh_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree, packet_info *
|
|||
while ( no_sa-- > 0 ) {
|
||||
proto_tree_add_item_ret_uint(esis_area_tree, hf_esis_sal, tvb, offset, 1, ENC_NA, &sal);
|
||||
offset++;
|
||||
proto_tree_add_string(esis_area_tree, hf_esis_sa, tvb, offset, sal, print_nsap_net(tvb, offset, sal ) );
|
||||
proto_tree_add_string(esis_area_tree, hf_esis_sa, tvb, offset, sal, print_nsap_net( pinfo->pool, tvb, offset, sal ) );
|
||||
offset += sal;
|
||||
len -= ( sal + 1 );
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ esis_dissect_ish_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree, packet_info *
|
|||
network_tree = proto_tree_add_subtree( tree, tvb, offset, netl + 1, ett_esis_network, NULL,
|
||||
"### Network Entity Title Section ###");
|
||||
proto_tree_add_uint(network_tree, hf_esis_netl, tvb, offset++, 1, netl);
|
||||
proto_tree_add_string(network_tree, hf_esis_net, tvb, offset, netl, print_nsap_net( tvb, offset, netl ) );
|
||||
proto_tree_add_string(network_tree, hf_esis_net, tvb, offset, netl, print_nsap_net( pinfo->pool, tvb, offset, netl ) );
|
||||
offset += netl;
|
||||
len -= ( netl + 1 );
|
||||
|
||||
|
@ -184,7 +184,7 @@ esis_dissect_redirect_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree, packet_i
|
|||
"### Destination Address Section ###" );
|
||||
proto_tree_add_uint(dest_tree, hf_esis_dal, tvb, offset++, 1, tmpl);
|
||||
proto_tree_add_string( dest_tree, hf_esis_da, tvb, offset, tmpl,
|
||||
print_nsap_net( tvb, offset, tmpl ) );
|
||||
print_nsap_net( pinfo->pool, tvb, offset, tmpl ) );
|
||||
offset += tmpl;
|
||||
len -= ( tmpl + 1 );
|
||||
tmpl = (int) tvb_get_guint8(tvb, offset);
|
||||
|
@ -208,7 +208,7 @@ esis_dissect_redirect_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree, packet_i
|
|||
"### Network Entity Title Section ###" );
|
||||
proto_tree_add_uint(network_tree, hf_esis_netl, tvb, offset++, 1, tmpl);
|
||||
proto_tree_add_string( network_tree, hf_esis_net, tvb, offset, tmpl,
|
||||
print_nsap_net( tvb, offset, tmpl ) );
|
||||
print_nsap_net( pinfo->pool, tvb, offset, tmpl ) );
|
||||
offset += tmpl;
|
||||
len -= ( tmpl + 1 );
|
||||
}
|
||||
|
|
|
@ -1360,7 +1360,7 @@ dissect_isis_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offs
|
|||
return;
|
||||
}
|
||||
proto_tree_add_item(hello_tree, hf_isis_hello_source_id, tvb, offset, isis->system_id_len, ENC_NA);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", System-ID: %s", tvb_print_system_id( tvb, offset, isis->system_id_len ));
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", System-ID: %s", tvb_print_system_id( pinfo->pool, tvb, offset, isis->system_id_len ));
|
||||
offset += isis->system_id_len;
|
||||
|
||||
if (isis->header_length < 8 + 1 + isis->system_id_len + 2) {
|
||||
|
|
|
@ -2809,7 +2809,7 @@ dissect_lsp_eis_neighbors_clv_inner(tvbuff_t *tvb, packet_info *pinfo, proto_tre
|
|||
proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_error_metric_ie, tvb, offset+3, 1, ENC_NA);
|
||||
proto_tree_add_item(ntree, is_eis ? hf_isis_lsp_eis_neighbors_es_neighbor_id : hf_isis_lsp_eis_neighbors_is_neighbor_id,
|
||||
tvb, offset+4, id_length, ENC_NA);
|
||||
proto_item_append_text(ti, ": %s", tvb_print_system_id(tvb, offset+4, id_length));
|
||||
proto_item_append_text(ti, ": %s", tvb_print_system_id(pinfo->pool, tvb, offset+4, id_length));
|
||||
}
|
||||
offset += tlen;
|
||||
length -= tlen;
|
||||
|
@ -3536,7 +3536,7 @@ dissect_lsp_ext_is_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tre
|
|||
ett_isis_lsp_part_of_clv_ext_is_reachability, &ti, "IS Neighbor");
|
||||
|
||||
proto_tree_add_item(ntree, hf_isis_lsp_ext_is_reachability_is_neighbor_id, tvb, offset, 7, ENC_NA);
|
||||
proto_item_append_text(ti, ": %s", tvb_print_system_id(tvb, offset, 7));
|
||||
proto_item_append_text(ti, ": %s", tvb_print_system_id(pinfo->pool, tvb, offset, 7));
|
||||
|
||||
proto_tree_add_item(ntree, hf_isis_lsp_ext_is_reachability_metric, tvb, offset+7, 3, ENC_BIG_ENDIAN);
|
||||
|
||||
|
@ -3793,7 +3793,7 @@ dissect_lsp_prefix_neighbors_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *
|
|||
* Lets turn the area address into "standard" 0000.0000.etc
|
||||
* format string.
|
||||
*/
|
||||
sbuf = print_address_prefix( tvb, offset+1, mylen );
|
||||
sbuf = print_address_prefix( pinfo->pool, tvb, offset+1, mylen );
|
||||
/* and spit it out */
|
||||
proto_tree_add_string( tree, hf_isis_lsp_area_address_str, tvb, offset, (mylen+1)/2 + 1, sbuf);
|
||||
|
||||
|
@ -4665,7 +4665,7 @@ dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset
|
|||
return;
|
||||
}
|
||||
proto_tree_add_item(lsp_tree, hf_isis_lsp_lsp_id, tvb, offset, isis->system_id_len + 2, ENC_NA);
|
||||
system_id = tvb_print_system_id( tvb, offset, isis->system_id_len+2 );
|
||||
system_id = tvb_print_system_id( pinfo->pool, tvb, offset, isis->system_id_len+2 );
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", LSP-ID: %s", system_id);
|
||||
offset += (isis->system_id_len + 2);
|
||||
|
||||
|
|
|
@ -398,7 +398,7 @@ dissect_isis_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offse
|
|||
}
|
||||
/* ISO 10589:2002 9.10 "Source ID – the system ID of Intermediate System (with zero Circuit ID)" */
|
||||
proto_tree_add_item(csnp_tree, hf_isis_csnp_source_id, tvb, offset, isis->system_id_len, ENC_NA);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", tvb_print_system_id( tvb, offset, isis->system_id_len+1 ));
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", tvb_print_system_id( pinfo->pool, tvb, offset, isis->system_id_len+1 ));
|
||||
offset += isis->system_id_len;
|
||||
proto_tree_add_item(csnp_tree, hf_isis_csnp_source_circuit, tvb, offset, 1, ENC_NA);
|
||||
offset++;
|
||||
|
@ -411,12 +411,12 @@ dissect_isis_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offse
|
|||
}
|
||||
proto_tree_add_item(csnp_tree, hf_isis_csnp_start_lsp_id, tvb, offset, isis->system_id_len + 2, ENC_NA);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Start LSP-ID: %s",
|
||||
tvb_print_system_id( tvb, offset, isis->system_id_len+2 ));
|
||||
tvb_print_system_id( pinfo->pool, tvb, offset, isis->system_id_len+2 ));
|
||||
offset += isis->system_id_len + 2;
|
||||
|
||||
proto_tree_add_item(csnp_tree, hf_isis_csnp_end_lsp_id, tvb, offset, isis->system_id_len + 2, ENC_NA);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", End LSP-ID: %s",
|
||||
tvb_print_system_id( tvb, offset, isis->system_id_len+2 ));
|
||||
tvb_print_system_id( pinfo->pool, tvb, offset, isis->system_id_len+2 ));
|
||||
offset += isis->system_id_len + 2;
|
||||
|
||||
if (pdu_length_too_short) {
|
||||
|
@ -493,7 +493,7 @@ dissect_isis_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offse
|
|||
}
|
||||
/* ISO 10589:2002 9.10 "Source ID – the system ID of Intermediate System (with zero Circuit ID)" */
|
||||
proto_tree_add_item(psnp_tree, hf_isis_psnp_source_id, tvb, offset, isis->system_id_len, ENC_NA);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", tvb_print_system_id( tvb, offset, isis->system_id_len+1 ));
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", tvb_print_system_id( pinfo->pool, tvb, offset, isis->system_id_len+1 ));
|
||||
offset += isis->system_id_len;
|
||||
proto_tree_add_item(psnp_tree, hf_isis_psnp_source_circuit, tvb, offset, 1, ENC_NA);
|
||||
offset++;
|
||||
|
|
|
@ -341,7 +341,7 @@ dissect_option_route(guchar parm_type, int offset, guchar parm_len,
|
|||
|
||||
while ( this_hop < offset + last_hop -2 ) { /* -2 for crr and last_hop */
|
||||
netl = tvb_get_guint8(tvb, this_hop);
|
||||
str = print_nsap_net(tvb, this_hop + 1, netl);
|
||||
str = print_nsap_net(wmem_packet_scope(), tvb, this_hop + 1, netl);
|
||||
proto_tree_add_string_format(osi_route_tree, hf_osi_options_route, tvb, this_hop, netl + 1, str,
|
||||
"Hop #%3u NETL: %2u, NET: %s", cnt_hops++, netl, str);
|
||||
this_hop += 1 + netl;
|
||||
|
@ -539,7 +539,7 @@ dissect_osi_options(guchar opt_len, tvbuff_t *tvb, int offset, proto_tree *tree,
|
|||
case OSI_OPT_ADDRESS_MASK:
|
||||
proto_tree_add_bytes_format_value(osi_option_tree, hf_osi_options_address_mask, tvb, offset, parm_len,
|
||||
NULL, "%s",
|
||||
print_area(tvb, offset, parm_len));
|
||||
print_area(pinfo->pool, tvb, offset, parm_len));
|
||||
break;
|
||||
|
||||
case OSI_OPT_SNPA_MASK:
|
||||
|
|
|
@ -3086,7 +3086,7 @@ dissect_rsvp_ifid_tlv(proto_tree *ti, packet_info* pinfo, proto_tree *rsvp_objec
|
|||
"%sISIS-Area TLV - Invalid Length field", tlv_name);
|
||||
break;
|
||||
}
|
||||
ip_str = print_nsap_net(tvb, offset+tlv_off+5, isis_len);
|
||||
ip_str = print_nsap_net(pinfo->pool, tvb, offset+tlv_off+5, isis_len);
|
||||
rsvp_ifid_subtree = proto_tree_add_subtree_format(rsvp_object_tree, tvb,
|
||||
offset+tlv_off, tlv_len,
|
||||
subtree_type, NULL, "%sISIS-Area TLV - %s", tlv_name,
|
||||
|
@ -6117,10 +6117,10 @@ dissect_rsvp_gen_uni(proto_tree *ti, packet_info* pinfo, proto_tree *rsvp_object
|
|||
proto_tree_add_uint(rsvp_gen_uni_subtree, hf_rsvp_class_length, tvb, offset2+l, 2, sobj_len);
|
||||
proto_tree_add_item(rsvp_gen_uni_subtree, hf_rsvp_nsap_length, tvb, offset2+l+4, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_string(rsvp_gen_uni_subtree, hf_rsvp_nsap_address, tvb, offset2+l+5, sobj_len-4,
|
||||
print_nsap_net(tvb, offset2+l+5, nsap_len));
|
||||
print_nsap_net(pinfo->pool, tvb, offset2+l+5, nsap_len));
|
||||
if (i < 4) {
|
||||
proto_item_append_text(ti, "%s NSAP TNA: %s", c,
|
||||
print_nsap_net(tvb, offset2+l+5, nsap_len));
|
||||
print_nsap_net(pinfo->pool, tvb, offset2+l+5, nsap_len));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -6366,7 +6366,7 @@ dissect_rsvp_call_id(proto_tree *ti, packet_info* pinfo, proto_tree *rsvp_object
|
|||
|
||||
case 3:
|
||||
offset4 = offset3 + 20;
|
||||
str = print_nsap_net(tvb, offset3, 20);
|
||||
str = print_nsap_net(pinfo->pool, tvb, offset3, 20);
|
||||
proto_tree_add_string(rsvp_object_tree, hf_rsvp_source_transport_network_addr, tvb, offset3, 20, str);
|
||||
break;
|
||||
|
||||
|
|
|
@ -33,11 +33,11 @@ static void print_address_prefix_buf ( const guint8 *, int, gchar *, int);
|
|||
* "dissect_nsap()" in epan/dissectors/packet-isup.c.
|
||||
*/
|
||||
gchar *
|
||||
print_nsap_net( tvbuff_t *tvb, const gint offset, int length )
|
||||
print_nsap_net( wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, int length )
|
||||
{
|
||||
gchar *cur;
|
||||
|
||||
cur = (gchar *)wmem_alloc(wmem_packet_scope(), MAX_NSAP_LEN * 3 + 50);
|
||||
cur = (gchar *)wmem_alloc(scope, MAX_NSAP_LEN * 3 + 50);
|
||||
print_nsap_net_buf( tvb_get_ptr(tvb, offset, length), length, cur, MAX_NSAP_LEN * 3 + 50);
|
||||
return( cur );
|
||||
}
|
||||
|
@ -82,9 +82,9 @@ print_system_id(wmem_allocator_t* scope, const guint8 *ad, int length )
|
|||
}
|
||||
|
||||
gchar *
|
||||
tvb_print_system_id( tvbuff_t *tvb, const gint offset, int length )
|
||||
tvb_print_system_id( wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, int length )
|
||||
{
|
||||
return( print_system_id(wmem_packet_scope(), tvb_get_ptr(tvb, offset, length), length) );
|
||||
return( print_system_id(scope, tvb_get_ptr(tvb, offset, length), length) );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -133,11 +133,11 @@ print_system_id_buf( const guint8 *ad, int length, gchar *buf, int buf_len)
|
|||
}
|
||||
|
||||
gchar *
|
||||
print_area(tvbuff_t *tvb, const gint offset, int length)
|
||||
print_area(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, int length)
|
||||
{
|
||||
gchar *cur;
|
||||
|
||||
cur = (gchar *)wmem_alloc(wmem_packet_scope(), MAX_AREA_LEN * 3 + 20);
|
||||
cur = (gchar *)wmem_alloc(scope, MAX_AREA_LEN * 3 + 20);
|
||||
print_area_buf(tvb_get_ptr(tvb, offset, length), length, cur, MAX_AREA_LEN * 3 + 20);
|
||||
return cur;
|
||||
}
|
||||
|
@ -146,11 +146,11 @@ print_area(tvbuff_t *tvb, const gint offset, int length)
|
|||
* Note: length is in units of half-octets.
|
||||
*/
|
||||
gchar *
|
||||
print_address_prefix(tvbuff_t *tvb, const gint offset, int length)
|
||||
print_address_prefix(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, int length)
|
||||
{
|
||||
gchar *cur;
|
||||
|
||||
cur = (gchar *)wmem_alloc(wmem_packet_scope(), MAX_AREA_LEN * 3 + 20);
|
||||
cur = (gchar *)wmem_alloc(scope, MAX_AREA_LEN * 3 + 20);
|
||||
print_address_prefix_buf(tvb_get_ptr(tvb, offset, (length+1)/2), length, cur, MAX_AREA_LEN * 3 + 20);
|
||||
return cur;
|
||||
}
|
||||
|
|
|
@ -98,12 +98,12 @@
|
|||
#define NSAP_IDI_ITU_T_IND_DEC_GROUP 0xE2 /* ITU-T IND, decimal */
|
||||
#define NSAP_IDI_ITU_T_IND_BIN_GROUP 0xE3 /* ITU-T IND, binary */
|
||||
|
||||
gchar* print_nsap_net ( tvbuff_t *, const gint, int );
|
||||
gchar* print_area ( tvbuff_t *, const gint, int );
|
||||
gchar* print_nsap_net ( wmem_allocator_t *, tvbuff_t *, const gint, int );
|
||||
gchar* print_area ( wmem_allocator_t *, tvbuff_t *, const gint, int );
|
||||
gchar* print_system_id(wmem_allocator_t *, const guint8 *, int );
|
||||
gchar* tvb_print_system_id( tvbuff_t *, const gint, int );
|
||||
gchar* tvb_print_system_id( wmem_allocator_t *, tvbuff_t *, const gint, int );
|
||||
void print_system_id_buf( const guint8 *, int, gchar *, int);
|
||||
gchar* print_address_prefix( tvbuff_t *, const gint, int );
|
||||
gchar* print_address_prefix( wmem_allocator_t *, tvbuff_t *, const gint, int );
|
||||
|
||||
int get_osi_address_type(void);
|
||||
void register_osi_address_type(void);
|
||||
|
|
Loading…
Reference in New Issue