wiretap: Remove some redundant debug information

It is not necessary to include the function name and/or locations,
ws_debug() includes that information,
This commit is contained in:
João Valverde 2021-06-06 17:18:33 +01:00 committed by Wireshark GitLab Utility
parent c015257c9f
commit 4e4bef09f9
3 changed files with 192 additions and 197 deletions

View File

@ -128,7 +128,7 @@ ipfix_read_message_header(ipfix_message_header_t *pfx_hdr, FILE_T fh, int *err,
/* go back to before header */
if (file_seek(fh, 0 - IPFIX_MSG_HDR_SIZE, SEEK_CUR, err) == -1) {
ws_debug("ipfix_read: couldn't go back in file before header");
ws_debug("couldn't go back in file before header");
return FALSE;
}
@ -179,7 +179,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
ipfix_message_header_t msg_hdr;
ipfix_set_header_t set_hdr;
ws_debug("ipfix_open: opening file");
ws_debug("opening file");
/* number of records to scan before deciding if this really is IPFIX */
if ((s = getenv("IPFIX_RECORDS_TO_CHECK")) != NULL) {
@ -196,7 +196,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
for (i = 0; i < records_for_ipfix_check; i++) {
/* read first message header to check version */
if (!ipfix_read_message_header(&msg_hdr, wth->fh, err, err_info)) {
ws_debug("ipfix_open: couldn't read message header #%d with err code #%d (%s)",
ws_debug("couldn't read message header #%d with err code #%d (%s)",
i, *err, *err_info);
if (*err == WTAP_ERR_BAD_FILE) {
*err = 0; /* not actually an error in this case */
@ -220,7 +220,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
break;
}
if (file_seek(wth->fh, IPFIX_MSG_HDR_SIZE, SEEK_CUR, err) == -1) {
ws_debug("ipfix_open: failed seek to next message in file, %d bytes away",
ws_debug("failed seek to next message in file, %d bytes away",
msg_hdr.message_length);
return WTAP_OPEN_NOT_MINE;
}
@ -232,7 +232,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
err, err_info)) {
if (*err == WTAP_ERR_SHORT_READ) {
/* Not a valid IPFIX Set, so not an IPFIX file. */
ws_debug("ipfix_open: error %d reading set", *err);
ws_debug("error %d reading set", *err);
return WTAP_OPEN_NOT_MINE;
}
@ -242,7 +242,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
set_hdr.set_length = g_ntohs(set_hdr.set_length);
if ((set_hdr.set_length < IPFIX_SET_HDR_SIZE) ||
((set_hdr.set_length + checked_len) > msg_hdr.message_length)) {
ws_debug("ipfix_open: found invalid set_length of %d",
ws_debug("found invalid set_length of %d",
set_hdr.set_length);
return WTAP_OPEN_NOT_MINE;
}
@ -250,7 +250,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
if (file_seek(wth->fh, set_hdr.set_length - IPFIX_SET_HDR_SIZE,
SEEK_CUR, err) == -1)
{
ws_debug("ipfix_open: failed seek to next set in file, %d bytes away",
ws_debug("failed seek to next set in file, %d bytes away",
set_hdr.set_length - IPFIX_SET_HDR_SIZE);
return WTAP_OPEN_ERROR;
}
@ -290,10 +290,10 @@ ipfix_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err,
gchar **err_info, gint64 *data_offset)
{
*data_offset = file_tell(wth->fh);
ws_debug("ipfix_read: offset is initially %" G_GINT64_MODIFIER "d", *data_offset);
ws_debug("offset is initially %" G_GINT64_MODIFIER "d", *data_offset);
if (!ipfix_read_message(wth->fh, rec, buf, err, err_info)) {
ws_debug("ipfix_read: couldn't read message header with code: %d\n, and error '%s'",
ws_debug("couldn't read message header with code: %d\n, and error '%s'",
*err, *err_info);
return FALSE;
}
@ -309,15 +309,15 @@ ipfix_seek_read(wtap *wth, gint64 seek_off, wtap_rec *rec,
{
/* seek to the right file position */
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) {
ws_debug("ipfix_seek_read: couldn't read message header with code: %d\n, and error '%s'",
ws_debug("couldn't read message header with code: %d\n, and error '%s'",
*err, *err_info);
return FALSE; /* Seek error */
}
ws_debug("ipfix_seek_read: reading at offset %" G_GINT64_MODIFIER "u", seek_off);
ws_debug("reading at offset %" G_GINT64_MODIFIER "u", seek_off);
if (!ipfix_read_message(wth->random_fh, rec, buf, err, err_info)) {
ws_debug("ipfix_seek_read: couldn't read message header");
ws_debug("couldn't read message header");
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return FALSE;

View File

@ -474,7 +474,7 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
(idb1_mand->wtap_encap == idb2_mand->wtap_encap) ? "TRUE":"FALSE");
if (idb1_mand->wtap_encap != idb2_mand->wtap_encap) {
/* Clearly not the same interface. */
ws_debug("merge::is_duplicate_idb() returning FALSE");
ws_debug("returning FALSE");
return FALSE;
}
@ -485,7 +485,7 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
* Probably not the same interface, and we can't combine them
* in any case.
*/
ws_debug("merge::is_duplicate_idb() returning FALSE");
ws_debug("returning FALSE");
return FALSE;
}
@ -496,7 +496,7 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
* Probably not the same interface, and we can't combine them
* in any case.
*/
ws_debug("merge::is_duplicate_idb() returning FALSE");
ws_debug("returning FALSE");
return FALSE;
}
@ -504,7 +504,7 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
ws_debug("idb1_mand->snap_len == idb2_mand->snap_len: %s",
(idb1_mand->snap_len == idb2_mand->snap_len) ? "TRUE":"FALSE");
if (idb1_mand->snap_len != idb2_mand->snap_len) {
ws_debug("merge::is_duplicate_idb() returning FALSE");
ws_debug("returning FALSE");
return FALSE;
}
@ -515,7 +515,7 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
ws_debug("idb1_if_speed == idb2_if_speed: %s",
(idb1_if_speed == idb2_if_speed) ? "TRUE":"FALSE");
if (idb1_if_speed != idb2_if_speed) {
ws_debug("merge::is_duplicate_idb() returning FALSE");
ws_debug("returning FALSE");
return FALSE;
}
}
@ -527,7 +527,7 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
ws_debug("idb1_if_tsresol == idb2_if_tsresol: %s",
(idb1_if_tsresol == idb2_if_tsresol) ? "TRUE":"FALSE");
if (idb1_if_tsresol != idb2_if_tsresol) {
ws_debug("merge::is_duplicate_idb() returning FALSE");
ws_debug("returning FALSE");
return FALSE;
}
}
@ -539,7 +539,7 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
ws_debug("idb1_if_fcslen == idb2_if_fcslen: %s",
(idb1_if_fcslen == idb2_if_fcslen) ? "TRUE":"FALSE");
if (idb1_if_fcslen == idb2_if_fcslen) {
ws_debug("merge::is_duplicate_idb() returning FALSE");
ws_debug("returning FALSE");
return FALSE;
}
}
@ -557,7 +557,7 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
ws_debug("g_strcmp0(idb1_opt_comment, idb2_opt_comment) == 0: %s",
(g_strcmp0(idb1_opt_comment, idb2_opt_comment) == 0) ? "TRUE":"FALSE");
if (g_strcmp0(idb1_opt_comment, idb2_opt_comment) != 0) {
ws_debug("merge::is_duplicate_idb() returning FALSE");
ws_debug("returning FALSE");
return FALSE;
}
}
@ -569,7 +569,7 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
ws_debug("g_strcmp0(idb1_if_name, idb2_if_name) == 0: %s",
(g_strcmp0(idb1_if_name, idb2_if_name) == 0) ? "TRUE":"FALSE");
if (g_strcmp0(idb1_if_name, idb2_if_name) != 0) {
ws_debug("merge::is_duplicate_idb() returning FALSE");
ws_debug("returning FALSE");
return FALSE;
}
}
@ -581,7 +581,7 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
ws_debug("g_strcmp0(idb1_if_description, idb2_if_description) == 0: %s",
(g_strcmp0(idb1_if_description, idb2_if_description) == 0) ? "TRUE":"FALSE");
if (g_strcmp0(idb1_if_description, idb2_if_description) != 0) {
ws_debug("merge::is_duplicate_idb() returning FALSE");
ws_debug("returning FALSE");
return FALSE;
}
}
@ -593,7 +593,7 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
ws_debug("g_strcmp0(idb1_if_hardware, idb2_if_hardware) == 0: %s",
(g_strcmp0(idb1_if_hardware, idb2_if_hardware) == 0) ? "TRUE":"FALSE");
if (g_strcmp0(idb1_if_hardware, idb2_if_hardware) != 0) {
ws_debug("merge::is_duplicate_idb() returning FALSE");
ws_debug("returning FALSE");
return FALSE;
}
}
@ -605,13 +605,13 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
ws_debug("g_strcmp0(idb1_if_os, idb2_if_os) == 0: %s",
(g_strcmp0(idb1_if_os, idb2_if_os) == 0) ? "TRUE":"FALSE");
if (g_strcmp0(idb1_if_os, idb2_if_os) != 0) {
ws_debug("merge::is_duplicate_idb() returning FALSE");
ws_debug("returning FALSE");
return FALSE;
}
}
/* does not compare filters nor interface statistics */
ws_debug("merge::is_duplicate_idb() returning TRUE");
ws_debug("returning TRUE");
return TRUE;
}
@ -642,7 +642,7 @@ all_idbs_are_duplicates(const merge_in_file_t *in_files, const guint in_file_cou
other_idb_list_size = other_idb_list->interface_data->len;
if (other_idb_list_size != first_idb_list_size) {
ws_debug("merge::all_idbs_are_duplicates: sizes of IDB lists don't match: first=%u, other=%u",
ws_debug("sizes of IDB lists don't match: first=%u, other=%u",
first_idb_list_size, other_idb_list_size);
g_free(other_idb_list);
g_free(first_idb_list);
@ -654,7 +654,7 @@ all_idbs_are_duplicates(const merge_in_file_t *in_files, const guint in_file_cou
other_file_idb = g_array_index(other_idb_list->interface_data, wtap_block_t, j);
if (!is_duplicate_idb(first_file_idb, other_file_idb)) {
ws_debug("merge::all_idbs_are_duplicates: IDBs at index %d do not match, returning FALSE", j);
ws_debug("IDBs at index %d do not match, returning FALSE", j);
g_free(other_idb_list);
g_free(first_idb_list);
return FALSE;
@ -663,7 +663,7 @@ all_idbs_are_duplicates(const merge_in_file_t *in_files, const guint in_file_cou
g_free(other_idb_list);
}
ws_debug("merge::all_idbs_are_duplicates: returning TRUE");
ws_debug("returning TRUE");
g_free(first_idb_list);
@ -747,7 +747,7 @@ generate_merged_idbs(merge_in_file_t *in_files, const guint in_file_count, const
if (mode == IDB_MERGE_MODE_ALL_SAME && all_idbs_are_duplicates(in_files, in_file_count)) {
guint num_idbs;
ws_debug("merge::generate_merged_idbs: mode ALL set and all IDBs are duplicates");
ws_debug("mode ALL set and all IDBs are duplicates");
/* they're all the same, so just get the first file's IDBs */
input_file_idb_list = wtap_file_get_idb_info(in_files[0].wth);
@ -782,7 +782,7 @@ generate_merged_idbs(merge_in_file_t *in_files, const guint in_file_count, const
if (mode == IDB_MERGE_MODE_ANY_SAME &&
find_duplicate_idb(input_file_idb, merged_idb_list, &merged_index))
{
ws_debug("merge::generate_merged_idbs: mode ANY set and found a duplicate");
ws_debug("mode ANY set and found a duplicate");
/*
* It's the same as a previous IDB, so we're going to "merge"
* them into one by adding a map from its old IDB index to the new
@ -791,7 +791,7 @@ generate_merged_idbs(merge_in_file_t *in_files, const guint in_file_count, const
add_idb_index_map(&in_files[i], itf_count, merged_index);
}
else {
ws_debug("merge::generate_merged_idbs: mode NONE set or did not find a duplicate");
ws_debug("mode NONE set or did not find a duplicate");
/*
* This IDB does not match a previous (or we want to save all IDBs),
* so add the IDB to the merge file, and add a map of the indices.
@ -822,7 +822,7 @@ map_rec_interface_id(wtap_rec *rec, const merge_in_file_t *in_file)
if (current_interface_id >= in_file->idb_index_map->len) {
/* this shouldn't happen, but in a malformed input file it could */
ws_debug("merge::map_rec_interface_id: current_interface_id (%u) >= in_file->idb_index_map->len (%u) (ERROR?)",
ws_debug("current_interface_id (%u) >= in_file->idb_index_map->len (%u) (ERROR?)",
current_interface_id, in_file->idb_index_map->len);
return FALSE;
}
@ -1015,7 +1015,7 @@ merge_files_common(const gchar* out_filename, /* normal output mode */
/* open the input files */
if (!merge_open_in_files(in_file_count, in_filenames, &in_files, cb,
err, err_info, err_fileno)) {
ws_debug("merge_files: merge_open_in_files() failed with err=%d", *err);
ws_debug("merge_open_in_files() failed with err=%d", *err);
*err_framenum = 0;
return MERGE_ERR_CANT_OPEN_INFILE;
}
@ -1033,7 +1033,7 @@ merge_files_common(const gchar* out_filename, /* normal output mode */
* whether we can merge IDBs into one or not.
*/
frame_type = merge_select_frame_type(in_file_count, in_files);
ws_debug("merge_files: got frame_type=%d", frame_type);
ws_debug("got frame_type=%d", frame_type);
if (cb)
cb->callback_func(MERGE_EVENT_FRAME_TYPE_SELECTED, frame_type, in_files, in_file_count, cb->data);
@ -1052,10 +1052,10 @@ merge_files_common(const gchar* out_filename, /* normal output mode */
if (wtap_file_type_subtype_supports_block(file_type,
WTAP_BLOCK_IF_ID_AND_INFO) != BLOCK_NOT_SUPPORTED) {
shb_hdrs = create_shb_header(in_files, in_file_count, app_name);
ws_debug("merge_files: SHB created");
ws_debug("SHB created");
idb_inf = generate_merged_idbs(in_files, in_file_count, mode);
ws_debug("merge_files: IDB merge operation complete, got %u IDBs", idb_inf ? idb_inf->interface_data->len : 0);
ws_debug("IDB merge operation complete, got %u IDBs", idb_inf ? idb_inf->interface_data->len : 0);
/* XXX other blocks like NRB are now discarded. */
params.shb_hdrs = shb_hdrs;

File diff suppressed because it is too large Load Diff