From 828bb24226fe8b6b6b98e37c11bf03097b383d4f Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Sun, 6 Apr 2014 12:10:30 +0200 Subject: Partly revert fdeed480bf89a1f43f7b3d4be67fa0e4333f7120 wmem_packet_scope() cannot be used outside of a packet treatment Change-Id: I6e545bbb51f325b366288f17358f9d2347a7d7c4 Reviewed-on: https://code.wireshark.org/review/977 Reviewed-by: Pascal Quantin --- epan/dissectors/packet-bacapp.c | 16 ++++++++-------- epan/dissectors/packet-hpteam.c | 2 +- epan/dissectors/packet-http.c | 4 ++-- epan/dissectors/packet-iax2.c | 10 +++++++--- epan/dissectors/packet-isup.c | 2 +- epan/dissectors/packet-rtcp.c | 2 +- epan/dissectors/packet-ssl-utils.c | 4 ++-- epan/dissectors/packet-tacacs.c | 8 ++++---- 8 files changed, 26 insertions(+), 22 deletions(-) diff --git a/epan/dissectors/packet-bacapp.c b/epan/dissectors/packet-bacapp.c index 7e90dfd9f9..20fe7d7fe7 100644 --- a/epan/dissectors/packet-bacapp.c +++ b/epan/dissectors/packet-bacapp.c @@ -4838,8 +4838,8 @@ bacapp_stats_tree_packet(stats_tree* st, packet_info* pinfo, epan_dissect_t* edt gchar *srcstr; const bacapp_info_value_t *binfo = (const bacapp_info_value_t *)p; - srcstr = wmem_strconcat(wmem_packet_scope(), "Src: ", address_to_str(wmem_packet_scope(), &pinfo->src), NULL); - dststr = wmem_strconcat(wmem_packet_scope(), "Dst: ", address_to_str(wmem_packet_scope(), &pinfo->dst), NULL); + srcstr = wmem_strconcat(wmem_packet_scope(), "Src: ", ep_address_to_str(&pinfo->src), NULL); + dststr = wmem_strconcat(wmem_packet_scope(), "Dst: ", ep_address_to_str(&pinfo->dst), NULL); tick_stat_node(st, st_str_packets_by_ip, 0, TRUE); packets_for_this_dst = tick_stat_node(st, st_str_packets_by_ip_dst, st_node_packets_by_ip, TRUE); @@ -4884,8 +4884,8 @@ bacapp_stats_tree_service(stats_tree* st, packet_info* pinfo, epan_dissect_t* ed const bacapp_info_value_t *binfo = (const bacapp_info_value_t *)p; - srcstr = wmem_strconcat(wmem_packet_scope(), "Src: ", address_to_str(wmem_packet_scope(), &pinfo->src), NULL); - dststr = wmem_strconcat(wmem_packet_scope(), "Dst: ", address_to_str(wmem_packet_scope(), &pinfo->dst), NULL); + srcstr = wmem_strconcat(wmem_packet_scope(), "Src: ", ep_address_to_str(&pinfo->src), NULL); + dststr = wmem_strconcat(wmem_packet_scope(), "Dst: ", ep_address_to_str(&pinfo->dst), NULL); tick_stat_node(st, st_str_packets_by_service, 0, TRUE); if (binfo->service_type) { @@ -4922,8 +4922,8 @@ bacapp_stats_tree_objectid(stats_tree* st, packet_info* pinfo, epan_dissect_t* e gchar *srcstr; const bacapp_info_value_t *binfo = (const bacapp_info_value_t *)p; - srcstr = wmem_strconcat(wmem_packet_scope(), "Src: ", address_to_str(wmem_packet_scope(), &pinfo->src), NULL); - dststr = wmem_strconcat(wmem_packet_scope(), "Dst: ", address_to_str(wmem_packet_scope(), &pinfo->dst), NULL); + srcstr = wmem_strconcat(wmem_packet_scope(), "Src: ", ep_address_to_str(&pinfo->src), NULL); + dststr = wmem_strconcat(wmem_packet_scope(), "Dst: ", ep_address_to_str(&pinfo->dst), NULL); tick_stat_node(st, st_str_packets_by_objectid, 0, TRUE); if (binfo->object_ident) { @@ -4960,8 +4960,8 @@ bacapp_stats_tree_instanceid(stats_tree* st, packet_info* pinfo, epan_dissect_t* gchar *srcstr; const bacapp_info_value_t *binfo = (const bacapp_info_value_t *)p; - srcstr = wmem_strconcat(wmem_packet_scope(), "Src: ", address_to_str(wmem_packet_scope(), &pinfo->src), NULL); - dststr = wmem_strconcat(wmem_packet_scope(), "Dst: ", address_to_str(wmem_packet_scope(), &pinfo->dst), NULL); + srcstr = wmem_strconcat(wmem_packet_scope(), "Src: ", ep_address_to_str(&pinfo->src), NULL); + dststr = wmem_strconcat(wmem_packet_scope(), "Dst: ", ep_address_to_str(&pinfo->dst), NULL); tick_stat_node(st, st_str_packets_by_instanceid, 0, TRUE); if (binfo->object_ident) { diff --git a/epan/dissectors/packet-hpteam.c b/epan/dissectors/packet-hpteam.c index 219e5cb0f2..8ce21effed 100644 --- a/epan/dissectors/packet-hpteam.c +++ b/epan/dissectors/packet-hpteam.c @@ -91,7 +91,7 @@ dissect_hpteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "HP NIC Team"); col_add_fstr(pinfo->cinfo, COL_INFO, "HP NIC Teaming Heartbeat; Port MAC = %s", - address_to_str(wmem_packet_scope(), &pinfo->dl_src)); + ep_address_to_str(&pinfo->dl_src)); if (tree) { /* we are being asked for details */ proto_item *hpteam_item; diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index 44cc406bb5..5463d22bac 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -414,7 +414,7 @@ http_reqs_stats_tree_packet(stats_tree* st, packet_info* pinfo, epan_dissect_t* if (v->request_method) { - ip_str = address_to_str(wmem_packet_scope(), &pinfo->dst); + ip_str = ep_address_to_str(&pinfo->dst); tick_stat_node(st, st_str_reqs, 0, FALSE); tick_stat_node(st, st_str_reqs_by_srv_addr, st_node_reqs, TRUE); @@ -431,7 +431,7 @@ http_reqs_stats_tree_packet(stats_tree* st, packet_info* pinfo, epan_dissect_t* return 1; } else if (i != 0) { - ip_str = address_to_str(wmem_packet_scope(), &pinfo->src); + ip_str = ep_address_to_str(&pinfo->src); tick_stat_node(st, st_str_resps_by_srv_addr, 0, FALSE); resps_by_this_addr = tick_stat_node(st, ip_str, st_node_resps_by_srv_addr, TRUE); diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c index e47768898d..9813e75e3d 100644 --- a/epan/dissectors/packet-iax2.c +++ b/epan/dissectors/packet-iax2.c @@ -580,8 +580,12 @@ static gchar *key_to_str( const iax_circuit_key *key ) } strp = str[i]; + /* why doesn't ep_address_to_str take a const pointer? + cast the warnings into oblivion. */ + + /* XXX - is this a case for wmem_packet_scope()? */ g_snprintf(strp, 80, "{%s:%i,%i}", - address_to_str(wmem_packet_scope(), &key->addr), + ep_address_to_str((address *)&key->addr), key->port, key->callno); return strp; @@ -900,8 +904,8 @@ static iax_call_data *iax_lookup_call( packet_info *pinfo, #ifdef DEBUG_HASHING g_debug("++ iax_lookup_circuit_details: Looking up circuit for frame %u, " "from {%s:%u:%u} to {%s:%u:%u}", pinfo->fd->num, - address_to_str(wmem_packet_scope(), &pinfo->src), pinfo->srcport, scallno, - address_to_str(wmem_packet_scope(), &pinfo->dst), pinfo->destport, dcallno); + ep_address_to_str(&pinfo->src), pinfo->srcport, scallno, + ep_address_to_str(&pinfo->dst), pinfo->destport, dcallno); #endif diff --git a/epan/dissectors/packet-isup.c b/epan/dissectors/packet-isup.c index 1c2ccb5253..ecc5caf407 100644 --- a/epan/dissectors/packet-isup.c +++ b/epan/dissectors/packet-isup.c @@ -10873,7 +10873,7 @@ msg_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U int msg_node; int dir_node; - dir = wmem_strdup_printf(wmem_packet_scope(), "%s->%s", address_to_str(wmem_packet_scope(), &pinfo->src), address_to_str(wmem_packet_scope(), &pinfo->dst)); + dir = wmem_strdup_printf(wmem_packet_scope(), "%s->%s", ep_address_to_str(&pinfo->src), ep_address_to_str(&pinfo->dst)); msg_node = tick_stat_node(st, msg, st_node_msg, TRUE); tick_stat_node(st, dir, msg_node, FALSE); diff --git a/epan/dissectors/packet-rtcp.c b/epan/dissectors/packet-rtcp.c index 6c868c6d71..3397e1f14f 100644 --- a/epan/dissectors/packet-rtcp.c +++ b/epan/dissectors/packet-rtcp.c @@ -2850,7 +2850,7 @@ static void add_roundtrip_delay_info(tvbuff_t *tvb, packet_info *pinfo, proto_tr /* Report delay in INFO column */ col_append_fstr(pinfo->cinfo, COL_INFO, " (roundtrip delay <-> %s = %dms, using frame %u) ", - address_to_str(wmem_packet_scope(), &pinfo->net_src), delay, frame); + ep_address_to_str(&pinfo->net_src), delay, frame); } static int diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index 796e0845b0..25e252efec 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -3679,7 +3679,7 @@ ssl_find_private_key(SslDecryptSession *ssl_session, GHashTable *key_hash, GTree dummy.port = port = pinfo->destport; } ssl_debug_printf("ssl_find_private_key server %s:%u\n", - address_to_str(wmem_packet_scope(), &dummy.addr),dummy.port); + ep_address_to_str(&dummy.addr),dummy.port); /* try to retrieve private key for this service. Do it now 'cause pinfo * is not always available @@ -4212,7 +4212,7 @@ ssl_parse_key_list(const ssldecrypt_assoc_t * uats, GHashTable *key_hash, GTree* } ssl_debug_printf("ssl_init %s addr '%s' (%s) port '%d' filename '%s' password(only for p12 file) '%s'\n", - (addr_type[at] == AT_IPv4) ? "IPv4" : "IPv6", uats->ipaddr, address_to_str(wmem_packet_scope(), &service->addr), + (addr_type[at] == AT_IPv4) ? "IPv4" : "IPv6", uats->ipaddr, ep_address_to_str(&service->addr), service->port, uats->keyfile, uats->password); ssl_debug_printf("ssl_init private key file %s successfully loaded.\n", uats->keyfile); diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c index b4c18715af..29339e7f6e 100644 --- a/epan/dissectors/packet-tacacs.c +++ b/epan/dissectors/packet-tacacs.c @@ -748,11 +748,11 @@ tacplus_print_key_entry( gpointer data, gpointer user_data ) { tacplus_key_entry *tacplus_data=(tacplus_key_entry *)data; if( user_data ) { - printf("%s:%s=%s\n", address_to_str(wmem_packet_scope(), tacplus_data->s ), - address_to_str(wmem_packet_scope(), tacplus_data->c ), tacplus_data->k ); + printf("%s:%s=%s\n", ep_address_to_str( tacplus_data->s ), + ep_address_to_str( tacplus_data->c ), tacplus_data->k ); } else { - printf("%s:%s\n", address_to_str(wmem_packet_scope(), tacplus_data->s ), - address_to_str(wmem_packet_scope(), tacplus_data->c ) ); + printf("%s:%s\n", ep_address_to_str( tacplus_data->s ), + ep_address_to_str( tacplus_data->c ) ); } } #endif -- cgit v1.2.3