Replace g_log() calls with ws_log()

This commit is contained in:
João Valverde 2022-03-31 18:27:11 +01:00 committed by A Wireshark GitLab Utility
parent ac7583c065
commit fbd32cf853
4 changed files with 16 additions and 20 deletions

View File

@ -12,6 +12,7 @@
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "config.h"
#define WS_LOG_DOMAIN "packet-bpv7"
#include "packet-bpv7.h"
#include "epan/wscbor.h"
@ -28,8 +29,6 @@
#include <wsutil/utf8_entities.h>
#include <inttypes.h>
/// Glib logging "domain" name
static const char *LOG_DOMAIN = "bpv7";
/// Protocol column name
static const char *const proto_name_bp = "BPv7";
static const char *const proto_name_bp_admin = "BPv7 Admin";
@ -1607,7 +1606,7 @@ static int dissect_status_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
// Back-references to this status
if (!wmem_map_contains(status_set, context->bundle->ident)) {
g_log(LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "status for %p in frame %d", (void*)context->bundle, context->bundle->frame_num);
ws_debug("status for %p in frame %d", (void*)context->bundle, context->bundle->frame_num);
wmem_map_insert(status_set, context->bundle->ident, NULL);
}
}

View File

@ -14,6 +14,7 @@
*/
#include <config.h>
#define WS_LOG_DOMAIN "packet-cose"
#include "packet-cose.h"
#include <epan/wscbor.h>
@ -27,8 +28,6 @@
void proto_register_cose(void);
void proto_reg_handoff_cose(void);
/// Glib logging "domain" name
static const char *LOG_DOMAIN = "COSE";
/// Protocol column name
static const char *const proto_name_cose = "COSE";
@ -706,14 +705,14 @@ static int dissect_cose_msg_tagged(tvbuff_t *tvb, packet_info *pinfo, proto_tree
if (!dissector) {
continue;
}
g_log(LOG_DOMAIN, G_LOG_LEVEL_INFO, "main dissector using tag %" PRIu64, tag->value);
ws_info("main dissector using tag %" PRIu64, tag->value);
int sublen = call_dissector_only(dissector, tvb, pinfo, tree, tag);
if (sublen > 0) {
return sublen;
}
}
g_log(LOG_DOMAIN, G_LOG_LEVEL_WARNING, "main dissector did not match any known tag");
ws_warning("main dissector did not match any known tag");
proto_item *item_msg = proto_tree_add_item(tree, proto_cose, tvb, 0, -1, 0);
expert_add_info(pinfo, item_msg, &ei_invalid_tag);
return -1;

View File

@ -36,9 +36,8 @@
/* "SSH" prefixes are for version 2, whereas "SSH1" is for version 1 */
#include "config.h"
#define WS_LOG_DOMAIN "packet-ssh"
/* Start with G_MESSAGES_DEBUG=ssh to see messages. */
#define G_LOG_DOMAIN "ssh"
// Define this to get hex dumps more similar to what you get in openssh. If not defined, dumps look more like what you get with other dissectors.
#define OPENSSH_STYLE
@ -846,7 +845,7 @@ ssh_dissect_ssh2(tvbuff_t *tvb, packet_info *pinfo,
ssh2_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_ssh2, NULL, wmem_strbuf_get_str(title));
}
g_debug("....ssh_dissect_ssh2[%c]: frame_key_start=%d, pinfo->num=%d, frame_key_end=%d, offset=%d, frame_key_end_offset=%d ", is_response==SERVER_PEER_DATA?'S':'C', peer_data->frame_key_start, pinfo->num, peer_data->frame_key_end, offset, peer_data->frame_key_end_offset);
ws_noisy("....ssh_dissect_ssh2[%c]: frame_key_start=%d, pinfo->num=%d, frame_key_end=%d, offset=%d, frame_key_end_offset=%d ", is_response==SERVER_PEER_DATA?'S':'C', peer_data->frame_key_start, pinfo->num, peer_data->frame_key_end, offset, peer_data->frame_key_end_offset);
if ((peer_data->frame_key_start == 0) ||
((peer_data->frame_key_start <= pinfo->num) &&
((peer_data->frame_key_end == 0) || (pinfo->num < peer_data->frame_key_end) ||
@ -2375,7 +2374,7 @@ ssh_decryption_setup_cipher(struct ssh_peer_data *peer_data,
gcry_cipher_open(hd2, GCRY_CIPHER_CHACHA20, GCRY_CIPHER_MODE_STREAM, 0)) {
gcry_cipher_close(*hd1);
gcry_cipher_close(*hd2);
g_debug("ssh: can't open chacha20 cipher handles");
ws_debug("ssh: can't open chacha20 cipher handles");
return;
}
@ -2395,14 +2394,14 @@ ssh_decryption_setup_cipher(struct ssh_peer_data *peer_data,
if ((err = gcry_cipher_setkey(*hd1, k1, 32))) {
gcry_cipher_close(*hd1);
g_debug("ssh: can't set chacha20 cipher key %s", gcry_strerror(err));
ws_debug("ssh: can't set chacha20 cipher key %s", gcry_strerror(err));
return;
}
if ((err = gcry_cipher_setkey(*hd2, k2, 32))) {
gcry_cipher_close(*hd1);
gcry_cipher_close(*hd2);
g_debug("ssh: can't set chacha20 cipher key %s", gcry_strerror(err));
ws_debug("ssh: can't set chacha20 cipher key %s", gcry_strerror(err));
return;
}
}
@ -2442,7 +2441,6 @@ ssh_decrypt_packet(tvbuff_t *tvb, packet_info *pinfo,
ssh_message_info_t *message = NULL;
ssh_message_info_t **pmessage = &packet->messages;
while(*pmessage){
// g_debug("looking for message %d now %d", record_id, (*pmessage)->id);
if ((*pmessage)->id == record_id) {
message = *pmessage;
break;
@ -2473,7 +2471,7 @@ ssh_decrypt_packet(tvbuff_t *tvb, packet_info *pinfo,
if (!ssh_decrypt_chacha20(peer_data->cipher_2, seqnr, 0, ctext, 4,
plain_length_buf, 4)) {
g_debug("ERROR: could not decrypt packet len");
ws_debug("ERROR: could not decrypt packet len");
return tvb_captured_length(tvb);
}
@ -2483,7 +2481,7 @@ ssh_decrypt_packet(tvbuff_t *tvb, packet_info *pinfo,
ssh_debug_printf("%s plain for seq = %d len = %u\n", is_response?"s2c":"c2s", seqnr, message_length);
if(message_length>32768){
g_debug("ssh: unreasonable message length %u", message_length);
ws_debug("ssh: unreasonable message length %u", message_length);
return tvb_captured_length(tvb);
}
@ -2494,7 +2492,7 @@ ssh_decrypt_packet(tvbuff_t *tvb, packet_info *pinfo,
if (!ssh_decrypt_chacha20(peer_data->cipher, seqnr, 1, ctext2,
message_length, plain+4, message_length)) {
g_debug("ERROR: could not decrypt packet payload");
ws_debug("ERROR: could not decrypt packet payload");
return tvb_captured_length(tvb);
}
@ -2514,7 +2512,7 @@ ssh_decrypt_packet(tvbuff_t *tvb, packet_info *pinfo,
gcry_mac_write(mac_hd, ctext, 4);
gcry_mac_write(mac_hd, ctext2, message_length);
if (gcry_mac_verify(mac_hd, mac, mac_len)) {
g_debug("ssh: MAC does not match");
ws_debug("ssh: MAC does not match");
}
size_t buflen = DIGEST_MAX_SIZE;
gcry_mac_read(mac_hd, message->calc_mac, &buflen);
@ -3090,7 +3088,7 @@ get_subdissector_for_channel(struct ssh_peer_data *peer_data, guint uiNumChannel
if(channel_number==uiNumChannel){return ci->subdissector_handle;}
ci = ci->next;
}
g_debug("Error lookin up channel %d", uiNumChannel);
ws_debug("Error lookin up channel %d", uiNumChannel);
return NULL;
}

View File

@ -21,7 +21,7 @@
#include <wsutil/inet_ipv6.h>
#if 0
#define wtap_debug(...) g_warning(__VA_ARGS__)
#define wtap_debug(...) ws_warning(__VA_ARGS__)
#define DEBUG_COUNT_REFS
#else
#define wtap_debug(...)