diff options
Diffstat (limited to 'epan')
62 files changed, 419 insertions, 765 deletions
diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c index 8b83708ec7..fa5f332cb9 100644 --- a/epan/dissectors/packet-scsi.c +++ b/epan/dissectors/packet-scsi.c @@ -5048,14 +5048,11 @@ dissect_scsi_rsp(tvbuff_t *tvb, packet_info *pinfo, ti = proto_tree_add_uint(scsi_tree, hf_scsi_status, tvb, 0, 0, scsi_status); PROTO_ITEM_SET_GENERATED(ti); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "SCSI: Response LUN: 0x%02x (%s) (%s)", itlq->lun, + col_add_fstr(pinfo->cinfo, COL_INFO, "SCSI: Response LUN: 0x%02x (%s) (%s)", itlq->lun, val_to_str(itlq->scsi_opcode, csdata->cdb_vals, "CDB:0x%02x"), val_to_str(scsi_status, scsi_status_val, "Unknown (0x%08x)")); - col_set_fence(pinfo->cinfo, COL_INFO); - } - + col_set_fence(pinfo->cinfo, COL_INFO); } void @@ -5086,11 +5083,9 @@ dissect_scsi_snsinfo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ti = proto_tree_add_uint(sns_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun); PROTO_ITEM_SET_GENERATED(ti); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " LUN:0x%02x ", itlq->lun); + col_append_fstr(pinfo->cinfo, COL_INFO, " LUN:0x%02x ", itlq->lun); - col_set_fence(pinfo->cinfo, COL_INFO); - } + col_set_fence(pinfo->cinfo, COL_INFO); dissect_scsi_sense(tvb, sns_tree, offset); @@ -5406,15 +5401,13 @@ dissect_scsi_cdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, valstr = try_val_to_str(opcode, csdata->cdb_vals); } - if (check_col(pinfo->cinfo, COL_INFO)) { - if (valstr != NULL) { - col_add_fstr(pinfo->cinfo, COL_INFO, "SCSI: %s LUN: 0x%02x ", valstr, itlq->lun); - } else { - col_add_fstr(pinfo->cinfo, COL_INFO, "SCSI Command: 0x%02x LUN:0x%02x ", opcode, itlq->lun); - } - /* make sure no one will overwrite this in the info column */ - col_set_fence(pinfo->cinfo, COL_INFO); + if (valstr != NULL) { + col_add_fstr(pinfo->cinfo, COL_INFO, "SCSI: %s LUN: 0x%02x ", valstr, itlq->lun); + } else { + col_add_fstr(pinfo->cinfo, COL_INFO, "SCSI Command: 0x%02x LUN:0x%02x ", opcode, itlq->lun); } + /* make sure no one will overwrite this in the info column */ + col_set_fence(pinfo->cinfo, COL_INFO); cdata = ep_new(scsi_task_data_t); cdata->itl = itl; @@ -5521,17 +5514,14 @@ dissect_scsi_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, scsi_tree = proto_item_add_subtree(ti, ett_scsi); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, - "SCSI: Data %s LUN: 0x%02x (%s %s) ", - isreq ? "Out" : "In", - itlq->lun, - val_to_str(opcode, csdata->cdb_vals, "0x%02x"), - isreq ? "Request Data" : "Response Data"); - - col_set_fence(pinfo->cinfo, COL_INFO); - } + col_add_fstr(pinfo->cinfo, COL_INFO, + "SCSI: Data %s LUN: 0x%02x (%s %s) ", + isreq ? "Out" : "In", + itlq->lun, + val_to_str(opcode, csdata->cdb_vals, "0x%02x"), + isreq ? "Request Data" : "Response Data"); + col_set_fence(pinfo->cinfo, COL_INFO); ti = proto_tree_add_uint(scsi_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun); PROTO_ITEM_SET_GENERATED(ti); @@ -5633,10 +5623,8 @@ dissect_scsi_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, next_tvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled SCSI DATA", ipfd_head, &scsi_frag_items, &update_col_info, tree); if ( ipfd_head && (ipfd_head->reassembled_in != pinfo->fd->num) ) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_prepend_fstr(pinfo->cinfo, COL_INFO, "[Reassembled in #%u] ", + col_prepend_fstr(pinfo->cinfo, COL_INFO, "[Reassembled in #%u] ", ipfd_head->reassembled_in); - } } diff --git a/epan/dissectors/packet-sebek.c b/epan/dissectors/packet-sebek.c index 18184c645d..27efea0da4 100644 --- a/epan/dissectors/packet-sebek.c +++ b/epan/dissectors/packet-sebek.c @@ -129,22 +129,20 @@ dissect_sebek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U col_set_str(pinfo->cinfo, COL_PROTOCOL, "SEBEK"); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_set_str(pinfo->cinfo, COL_INFO, "SEBEK - "); + col_set_str(pinfo->cinfo, COL_INFO, "SEBEK - "); - if (tvb_length(tvb)<6) - sebek_ver = 0; - else - sebek_ver = tvb_get_ntohs(tvb, 4); + if (tvb_length(tvb)<6) + sebek_ver = 0; + else + sebek_ver = tvb_get_ntohs(tvb, 4); - switch (sebek_ver) { - case 2: col_append_fstr(pinfo->cinfo, COL_INFO, " pid(%d)", tvb_get_ntohl(tvb, 20)); + switch (sebek_ver) { + case 2: col_append_fstr(pinfo->cinfo, COL_INFO, " pid(%d)", tvb_get_ntohl(tvb, 20)); col_append_fstr(pinfo->cinfo, COL_INFO, " uid(%d)", tvb_get_ntohl(tvb, 24)); col_append_fstr(pinfo->cinfo, COL_INFO, " fd(%d)", tvb_get_ntohl(tvb, 28)); col_append_fstr(pinfo->cinfo, COL_INFO, " cmd: %s", tvb_format_text(tvb, 32, 12)); break; - case 3: col_append_fstr(pinfo->cinfo, COL_INFO, " pid(%d)", tvb_get_ntohl(tvb, 24)); + case 3: col_append_fstr(pinfo->cinfo, COL_INFO, " pid(%d)", tvb_get_ntohl(tvb, 24)); col_append_fstr(pinfo->cinfo, COL_INFO, " uid(%d)", tvb_get_ntohl(tvb, 28)); col_append_fstr(pinfo->cinfo, COL_INFO, " fd(%d)", tvb_get_ntohl(tvb, 32)); cmd_len = tvb_strnlen(tvb, 40, 12); @@ -152,12 +150,10 @@ dissect_sebek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U cmd_len = 0; col_append_fstr(pinfo->cinfo, COL_INFO, " cmd: %s", tvb_format_text(tvb, 40, cmd_len)); break; - default: - break; - } + default: + break; } - if (tree) { /* Adding Sebek item and subtree */ ti = proto_tree_add_item(tree, proto_sebek, tvb, 0, -1, ENC_NA); diff --git a/epan/dissectors/packet-selfm.c b/epan/dissectors/packet-selfm.c index 14199ee3de..c500de5828 100644 --- a/epan/dissectors/packet-selfm.c +++ b/epan/dissectors/packet-selfm.c @@ -1290,19 +1290,13 @@ dissect_fastop_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int of proto_tree_add_item(fastop_tree, hf_selfm_fastop_rb_code, tvb, offset, 1, ENC_BIG_ENDIAN); /* Append Column Info w/ Control Code Code */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s", val_to_str_const(opcode, selfm_fo_rb_vals, "Unknown Control Code")); - } - + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s", val_to_str_const(opcode, selfm_fo_rb_vals, "Unknown Control Code")); } else if (msg_type == CMD_FASTOP_BR_CTRL) { proto_tree_add_item(fastop_tree, hf_selfm_fastop_br_code, tvb, offset, 1, ENC_BIG_ENDIAN); /* Append Column Info w/ Control Code Code */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s", val_to_str_const(opcode, selfm_fo_br_vals, "Unknown Control Code")); - } - + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s", val_to_str_const(opcode, selfm_fo_br_vals, "Unknown Control Code")); } offset += 1; @@ -1354,9 +1348,7 @@ dissect_fastser_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o proto_tree_add_item(fastser_tree, hf_selfm_fastser_funccode, tvb, offset, 1, ENC_BIG_ENDIAN); /* Append Column Info w/ Function Code */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s", val_to_str_const(funccode, selfm_fastser_func_code_vals, "Unknown Function Code")); - } + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s", val_to_str_const(funccode, selfm_fastser_func_code_vals, "Unknown Function Code")); offset += 1; @@ -1468,10 +1460,8 @@ dissect_fastser_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o fc_enable = tvb_get_guint8(tvb, offset); proto_tree_add_item(fastser_tree, hf_selfm_fastser_uns_en_fc, tvb, offset, 1, ENC_BIG_ENDIAN); - /* Append Column Info w/ "Enable" Function Code */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Function to Enable (%#x)", fc_enable); - } + /* Append Column Info w/ "Enable" Function Code */ + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Function to Enable (%#x)", fc_enable); /* 3-byte Function Code data */ proto_tree_add_item(fastser_tree, hf_selfm_fastser_uns_en_fc_data, tvb, offset+1, 3, ENC_NA); @@ -1486,10 +1476,8 @@ dissect_fastser_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o fc_enable = tvb_get_guint8(tvb, offset); proto_tree_add_item(fastser_tree, hf_selfm_fastser_uns_dis_fc, tvb, offset, 1, ENC_BIG_ENDIAN); - /* Append Column Info w/ "Disable" Function Code */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Function to Disable (%#x)", fc_enable); - } + /* Append Column Info w/ "Disable" Function Code */ + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Function to Disable (%#x)", fc_enable); /* 1-byte Function Code data */ proto_tree_add_item(fastser_tree, hf_selfm_fastser_uns_dis_fc_data, tvb, offset+1, 1, ENC_NA); @@ -1506,9 +1494,7 @@ dissect_fastser_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o base_addr = tvb_get_ntohs(tvb, offset); /* unknown - 16-bit field with base address to read? */ /* Append Column Info w/ Base Address */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%#x", base_addr); - } + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%#x", base_addr); proto_tree_add_item(fastser_tree, hf_selfm_fastser_read_baseaddr, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(fastser_tree, hf_selfm_fastser_read_numaddr, tvb, offset+2, 2, ENC_BIG_ENDIAN); @@ -1523,9 +1509,7 @@ dissect_fastser_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o num_addr = tvb_get_ntohs(tvb, offset+2); /* unknown - 16-bit field with number of 16-bit addresses to read? */ /* Append Column Info w/ Base Address */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%#x", base_addr); - } + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%#x", base_addr); proto_tree_add_item(fastser_tree, hf_selfm_fastser_read_baseaddr, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(fastser_tree, hf_selfm_fastser_read_numaddr, tvb, offset+2, 2, ENC_BIG_ENDIAN); @@ -1616,9 +1600,7 @@ dissect_fastser_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o num_reg = tvb_get_ntohs(tvb, offset+4); /* Append Column Info w/ Address Information */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%#x, %#x", addr1, addr2); - } + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%#x, %#x", addr1, addr2); proto_tree_add_item(fastser_tree, hf_selfm_fastser_unswrite_addr1, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(fastser_tree, hf_selfm_fastser_unswrite_addr2, tvb, offset+2, 2, ENC_BIG_ENDIAN); @@ -1686,9 +1668,7 @@ dissect_fastser_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o offset += 2; /* Append Column Info w/ Base Address */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%#x", base_addr); - } + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%#x", base_addr); break; @@ -1703,9 +1683,7 @@ dissect_fastser_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o offset += 2; /* Append Column Info w/ Base Address */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%#x", base_addr); - } + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%#x", base_addr); /* unknown - 16-bit field with number of tags to follow? */ proto_tree_add_item(fastser_tree, hf_selfm_fastser_datafmt_resp_num_tag, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -1738,9 +1716,7 @@ dissect_fastser_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o offset += 2; /* Append Column Info w/ Base Address */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%#x", base_addr); - } + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%#x", base_addr); break; case FAST_SER_BITLABEL_RESP: /* 0xB3 - Bit Label Response - unknown full structure */ @@ -1832,10 +1808,8 @@ dissect_selfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) selfm_item = proto_tree_add_protocol_format(tree, proto_selfm, selfm_tvb, 0, len, "SEL Fast Message"); selfm_tree = proto_item_add_subtree(selfm_item, ett_selfm); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_clear(pinfo->cinfo, COL_INFO); /* clear out stuff in the info column */ - col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_const(msg_type, selfm_msgtype_vals, "Unknown Message Type")); - } + col_clear(pinfo->cinfo, COL_INFO); /* clear out stuff in the info column */ + col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_const(msg_type, selfm_msgtype_vals, "Unknown Message Type")); /* Add Message Type to Protocol Tree */ proto_tree_add_item(selfm_tree, hf_selfm_msgtype, selfm_tvb, offset, 2, ENC_BIG_ENDIAN); diff --git a/epan/dissectors/packet-sita.c b/epan/dissectors/packet-sita.c index 95eb99899f..46ee19e198 100644 --- a/epan/dissectors/packet-sita.c +++ b/epan/dissectors/packet-sita.c @@ -125,16 +125,13 @@ dissect_sita(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) errors2 = pinfo->pseudo_header->sita.sita_errors2; proto = pinfo->pseudo_header->sita.sita_proto; - if (check_col(pinfo->cinfo, COL_DEF_SRC)) { - if ((flags & SITA_FRAME_DIR) == SITA_FRAME_DIR_TXED) { - col_set_str(pinfo->cinfo, COL_DEF_SRC, IOP); /* set the source (direction) column accordingly */ - } else { - col_set_str(pinfo->cinfo, COL_DEF_SRC, REMOTE); - } + if ((flags & SITA_FRAME_DIR) == SITA_FRAME_DIR_TXED) { + col_set_str(pinfo->cinfo, COL_DEF_SRC, IOP); /* set the source (direction) column accordingly */ + } else { + col_set_str(pinfo->cinfo, COL_DEF_SRC, REMOTE); } - if (check_col(pinfo->cinfo, COL_INFO)) - col_set_str(pinfo->cinfo, COL_INFO, ""); + col_set_str(pinfo->cinfo, COL_INFO, ""); if (tree) { ti = proto_tree_add_protocol_format(tree, proto_sita, tvb, 0, 0, "Link Layer"); @@ -195,10 +192,10 @@ dissect_sita(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* try to find and run an applicable dissector */ if (!dissector_try_uint(sita_dissector_table, pinfo->pseudo_header->sita.sita_proto, tvb, pinfo, tree)) { - if (check_col(pinfo->cinfo, COL_PROTOCOL)) /* if one can't be found... tell them we don't */ - col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN"); /* know how to decode this protocol */ - if (check_col(pinfo->cinfo, COL_INFO)) /* and give them the details then */ - col_add_fstr(pinfo->cinfo, COL_INFO, "IOP protocol number: %u", pinfo->pseudo_header->sita.sita_proto); + /* if one can't be found... tell them we don't know how to decode this protocol + and give them the details then */ + col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN"); + col_add_fstr(pinfo->cinfo, COL_INFO, "IOP protocol number: %u", pinfo->pseudo_header->sita.sita_proto); call_dissector(data_handle, tvb, pinfo, tree); /* call the generic (hex display) decoder instead */ } } diff --git a/epan/dissectors/packet-skinny.c b/epan/dissectors/packet-skinny.c index 25037b2b3c..58a7540e97 100644 --- a/epan/dissectors/packet-skinny.c +++ b/epan/dissectors/packet-skinny.c @@ -1488,14 +1488,10 @@ dissect_skinny_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(skinny_tree, hf_skinny_hdr_version, tvb, offset+4, 4, hdr_version); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO,"%s ", si->messageName); - col_set_fence(pinfo->cinfo, COL_INFO); - } + col_add_fstr(pinfo->cinfo, COL_INFO,"%s ", si->messageName); + col_set_fence(pinfo->cinfo, COL_INFO); - if (tree) { - proto_tree_add_uint(skinny_tree, hf_skinny_messageid, tvb,offset+8, 4, data_messageid ); - } + proto_tree_add_uint(skinny_tree, hf_skinny_messageid, tvb,offset+8, 4, data_messageid ); { switch(data_messageid) { diff --git a/epan/dissectors/packet-sll.c b/epan/dissectors/packet-sll.c index ed2436015d..2987b84dda 100644 --- a/epan/dissectors/packet-sll.c +++ b/epan/dissectors/packet-sll.c @@ -177,8 +177,7 @@ dissect_sll(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(pkttype, packet_type_vals, "Unknown (%u)")); if (tree) { diff --git a/epan/dissectors/packet-slsk.c b/epan/dissectors/packet-slsk.c index 88c7b7ba3c..8e923853df 100644 --- a/epan/dissectors/packet-slsk.c +++ b/epan/dissectors/packet-slsk.c @@ -333,10 +333,7 @@ static void dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree col_set_str(pinfo->cinfo, COL_INFO, "SoulSeek Message"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", message_type); - } - + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", message_type); if (tree) { diff --git a/epan/dissectors/packet-smb-browse.c b/epan/dissectors/packet-smb-browse.c index 5e951dc95a..251bba9f5a 100644 --- a/epan/dissectors/packet-smb-browse.c +++ b/epan/dissectors/packet-smb-browse.c @@ -505,13 +505,11 @@ dissect_smb_server_type_flags(tvbuff_t *tvb, int offset, packet_info *pinfo, if (infoflag) { /* Append the type(s) of the system to the COL_INFO line ... */ - if (check_col(pinfo->cinfo, COL_INFO)) { - for (i = 0; i < 32; i++) { - if (flags & (1<<i)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", - val_to_str(i, server_types, - "Unknown server type:%d")); - } + for (i = 0; i < 32; i++) { + if (flags & (1<<i)) { + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", + val_to_str(i, server_types, + "Unknown server type:%d")); } } } @@ -593,17 +591,12 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr cmd = tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - /* Put in something, and replace it later */ - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(cmd, commands, "Unknown command:0x%02x")); - } + /* Put in something, and replace it later */ + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(cmd, commands, "Unknown command:0x%02x")); - if (parent_tree) { - item = proto_tree_add_item(parent_tree, proto_smb_browse, tvb, offset, -1, ENC_NA); - - tree = proto_item_add_subtree(item, ett_browse); - } + item = proto_tree_add_item(parent_tree, proto_smb_browse, tvb, offset, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_browse); /* command */ proto_tree_add_uint(tree, hf_command, tvb, offset, 1, cmd); @@ -631,9 +624,7 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr "UTF-8", "CP437", NULL, NULL, NULL); if (utf8_host_name == NULL) utf8_host_name = host_name; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", utf8_host_name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", utf8_host_name); proto_tree_add_string_format(tree, hf_server_name, tvb, offset, 16, utf8_host_name, @@ -713,9 +704,7 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr computer_name = tvb_get_ephemeral_stringz(tvb, offset, &namelen); proto_tree_add_string(tree, hf_response_computer_name, tvb, offset, namelen, computer_name); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr( - pinfo->cinfo, COL_INFO, " %s", computer_name); + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", computer_name); break; } @@ -844,10 +833,8 @@ dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr cmd = tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - /* Put in something, and replace it later */ - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(cmd, commands, "Unknown command:0x%02x")); - } + /* Put in something, and replace it later */ + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(cmd, commands, "Unknown command:0x%02x")); if (parent_tree) { @@ -900,9 +887,8 @@ dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr /* server name */ host_name = tvb_get_const_stringz(tvb, offset, &namelen); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", host_name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", host_name); + proto_tree_add_item(tree, hf_server_name, tvb, offset, namelen, ENC_ASCII|ENC_NA); offset += namelen; diff --git a/epan/dissectors/packet-smb-logon.c b/epan/dissectors/packet-smb-logon.c index 854ee790bf..50c1df2982 100644 --- a/epan/dissectors/packet-smb-logon.c +++ b/epan/dissectors/packet-smb-logon.c @@ -334,8 +334,7 @@ dissect_smb_pdc_query(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, i /* computer name */ offset = display_ms_string(tvb, tree, offset, hf_computer_name, &name); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " from %s", name); + col_append_fstr(pinfo->cinfo, COL_INFO, " from %s", name); /* mailslot name */ offset = display_ms_string(tvb, tree, offset, hf_mailslot_name, NULL); @@ -389,7 +388,7 @@ dissect_smb_pdc_startup(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* pdc name */ offset = display_unicode_string(tvb, tree, offset, hf_unicode_pdc_name, &name); - if (name && check_col(pinfo->cinfo, COL_INFO)) { + if (name) { col_append_fstr(pinfo->cinfo, COL_INFO, ": host %s", name); name = NULL; } @@ -399,7 +398,7 @@ dissect_smb_pdc_startup(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* domain name */ offset = display_unicode_string(tvb, tree, offset, hf_domain_name, &name); - if (name && check_col(pinfo->cinfo, COL_INFO)) { + if (name) { col_append_fstr(pinfo->cinfo, COL_INFO, ", domain %s", name); name = NULL; } @@ -926,10 +925,9 @@ dissect_smb_logon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* get the Command field */ cmd = tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(cmd, commands, "Unknown Command:%02x") ); + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(cmd, commands, "Unknown Command:%02x") ); - if (tree) { + if (tree) { item = proto_tree_add_item(tree, proto_smb_logon, tvb, offset, -1, ENC_NA); diff --git a/epan/dissectors/packet-smb-mailslot.c b/epan/dissectors/packet-smb-mailslot.c index dada1e9846..6733a0059b 100644 --- a/epan/dissectors/packet-smb-mailslot.c +++ b/epan/dissectors/packet-smb-mailslot.c @@ -152,10 +152,8 @@ dissect_mailslot_smb(tvbuff_t *mshdr_tvb, tvbuff_t *setup_tvb, /* do the opcode field */ opcode = tvb_get_letohs(setup_tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, opcode_vals, "Unknown opcode: 0x%04x")); - } /* These are in the setup words; use "setup_tvb". */ diff --git a/epan/dissectors/packet-smb-pipe.c b/epan/dissectors/packet-smb-pipe.c index 80c5a87f99..faeade271a 100644 --- a/epan/dissectors/packet-smb-pipe.c +++ b/epan/dissectors/packet-smb-pipe.c @@ -2685,9 +2685,8 @@ dissect_pipe_lanman(tvbuff_t *pd_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb, if (smb_info->request) { /* this is a request */ /* function code */ cmd = tvb_get_letohs(p_tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s Request", val_to_str_ext(cmd, &commands_ext, "Unknown Command (%u)")); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "%s Request", val_to_str_ext(cmd, &commands_ext, "Unknown Command (%u)")); + proto_tree_add_uint(tree, hf_function_code, p_tvb, offset, 2, cmd); offset += 2; @@ -2825,19 +2824,17 @@ dissect_pipe_lanman(tvbuff_t *pd_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb, if( ( (p_tvb==NULL) || (tvb_reported_length(p_tvb)==0) ) && ( (d_tvb==NULL) || (tvb_reported_length(d_tvb)==0) ) ){ /* command */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s Interim Response", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s Interim Response", val_to_str_ext(trp->lanman_cmd, &commands_ext, "Unknown Command (%u)")); - } + proto_tree_add_uint(tree, hf_function_code, p_tvb, 0, 0, trp->lanman_cmd); return TRUE; } /* command */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s Response", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s Response", val_to_str_ext(trp->lanman_cmd, &commands_ext, "Unknown Command (%u)")); - } + proto_tree_add_uint(tree, hf_function_code, p_tvb, 0, 0, trp->lanman_cmd); @@ -3540,10 +3537,8 @@ dissect_pipe_smb(tvbuff_t *sp_tvb, tvbuff_t *s_tvb, tvbuff_t *pd_tvb, * Set the columns. */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMB Pipe"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_set_str(pinfo->cinfo, COL_INFO, + col_set_str(pinfo->cinfo, COL_INFO, smb_info->request ? "Request" : "Response"); - } if (smb_info->sip != NULL && smb_info->sip->extra_info_type == SMB_EI_TRI) tri = (smb_transact_info_t *)smb_info->sip->extra_info; @@ -3576,11 +3571,10 @@ dissect_pipe_smb(tvbuff_t *sp_tvb, tvbuff_t *s_tvb, tvbuff_t *pd_tvb, proto_tree_add_uint(pipe_tree, hf_pipe_function, s_tvb, offset, 2, function); offset += 2; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", val_to_str(function, functions, "Unknown function (0x%04x)"), smb_info->request ? "Request" : "Response"); - } + if (tri != NULL) tri->function = function; @@ -3635,11 +3629,10 @@ dissect_pipe_smb(tvbuff_t *sp_tvb, tvbuff_t *s_tvb, tvbuff_t *pd_tvb, function = tri->function; proto_tree_add_uint(pipe_tree, hf_pipe_function, NULL, 0, 0, function); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", val_to_str(function, functions, "Unknown function (0x%04x)"), smb_info->request ? "Request" : "Response"); - } + fid = tri->fid; if (fid != -1) dissect_smb_fid(d_tvb, pinfo, pipe_tree, 0, 0, (guint16) fid, FALSE, FALSE, TRUE); diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index a4f1539356..6b9b6cc8ab 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -2670,10 +2670,8 @@ dissect_old_dir_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int dn); COUNT_BYTES(dn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Directory: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Directory: %s", format_text(dn, strlen(dn))); - } END_OF_SMB @@ -2814,10 +2812,8 @@ dissect_tree_connect_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree offset, an_len, an); COUNT_BYTES(an_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(an, strlen(an))); - } /* buffer format */ CHECK_BYTE_COUNT(1); @@ -3140,10 +3136,8 @@ dissect_move_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of fn_len, fn, "Old File Name: %s", format_text(fn, strlen(fn))); COUNT_BYTES(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Old Name: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Old Name: %s", format_text(fn, strlen(fn))); - } /* buffer format */ CHECK_BYTE_COUNT(1); @@ -3159,10 +3153,8 @@ dissect_move_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of fn_len, fn, "New File Name: %s", format_text(fn, strlen(fn))); COUNT_BYTES(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", New Name: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", New Name: %s", format_text(fn, strlen(fn))); - } END_OF_SMB @@ -3209,10 +3201,8 @@ dissect_copy_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of fn_len, fn, "Source File Name: %s", format_text(fn, strlen(fn))); COUNT_BYTES(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Source Name: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Source Name: %s", format_text(fn, strlen(fn))); - } /* buffer format */ CHECK_BYTE_COUNT(1); @@ -3229,9 +3219,7 @@ dissect_copy_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of format_text(fn, strlen(fn))); COUNT_BYTES(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Destination Name: %s", format_text(fn, strlen(fn))); - } + col_append_fstr(pinfo->cinfo, COL_INFO, ", Destination Name: %s", format_text(fn, strlen(fn))); END_OF_SMB @@ -3329,10 +3317,8 @@ dissect_open_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i si->sip->extra_info = fsi; } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(fn, strlen(fn))); - } END_OF_SMB @@ -3607,8 +3593,7 @@ dissect_smb_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, PROTO_ITEM_SET_GENERATED(it); } tr = proto_item_add_subtree(it, ett_smb_fid); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", FID: 0x%04x", fid); + col_append_fstr(pinfo->cinfo, COL_INFO, ", FID: 0x%04x", fid); if ((!pinfo->fd->flags.visited) && is_created) { fid_info = (smb_fid_info_t *)se_alloc(sizeof(smb_fid_info_t)); @@ -3954,10 +3939,8 @@ dissect_create_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(fn, strlen(fn))); - } END_OF_SMB @@ -4025,10 +4008,8 @@ dissect_delete_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, fn); COUNT_BYTES(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(fn, strlen(fn))); - } END_OF_SMB @@ -4069,10 +4050,8 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, fn); COUNT_BYTES(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Old Name: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Old Name: %s", format_text(fn, strlen(fn))); - } /* buffer format */ CHECK_BYTE_COUNT(1); @@ -4089,10 +4068,8 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, fn); COUNT_BYTES(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", New Name: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", New Name: %s", format_text(fn, strlen(fn))); - } END_OF_SMB @@ -4147,10 +4124,8 @@ dissect_nt_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr fn); COUNT_BYTES(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Old Name: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Old Name: %s", format_text(fn, strlen(fn))); - } /* buffer format */ CHECK_BYTE_COUNT(1); @@ -4166,10 +4141,8 @@ dissect_nt_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr fn); COUNT_BYTES(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", New Name: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", New Name: %s", format_text(fn, strlen(fn))); - } END_OF_SMB @@ -4206,10 +4179,8 @@ dissect_query_information_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree fn); COUNT_BYTES(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(fn, strlen(fn))); - } END_OF_SMB @@ -4284,10 +4255,8 @@ dissect_set_information_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t fn); COUNT_BYTES(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(fn, strlen(fn))); - } END_OF_SMB @@ -4327,8 +4296,7 @@ dissect_read_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i proto_tree_add_item(tree, hf_smb_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, ", %u byte%s at offset %u", cnt, (cnt == 1) ? "" : "s", ofs); @@ -4572,8 +4540,7 @@ dissect_write_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_item(tree, hf_smb_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, ", %u byte%s at offset %u", cnt, (cnt == 1) ? "" : "s", ofs); @@ -4652,8 +4619,7 @@ dissect_write_file_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_item(tree, hf_smb_count, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, ", %u byte%s", cnt, (cnt == 1) ? "" : "s"); if (si->sip && (si->sip->extra_info_type == SMB_EI_RWINFO)) { @@ -4740,10 +4706,8 @@ dissect_create_temporary_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree * fn); COUNT_BYTES(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(fn, strlen(fn))); - } END_OF_SMB @@ -5582,10 +5546,8 @@ dissect_search_find_request(tvbuff_t *tvb, packet_info *pinfo, fn); COUNT_BYTES(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", format_text(fn, strlen(fn))); - } /* buffer format */ CHECK_BYTE_COUNT(1); @@ -6325,10 +6287,8 @@ dissect_open_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i si->sip->extra_info = fsi; } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(fn, strlen(fn))); - } END_OF_SMB @@ -6630,8 +6590,7 @@ dissect_read_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i ofs = offsethigh; ofs = (ofs<<32) | offsetlow; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, ", %u byte%s at offset %" G_GINT64_MODIFIER "u", maxcnt, (maxcnt == 1) ? "" : "s", ofs); @@ -6772,8 +6731,7 @@ dissect_read_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, datalen = (datalen<<16) | datalen_low; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, ", %u byte%s", datalen, (datalen == 1) ? "" : "s"); @@ -6901,8 +6859,7 @@ dissect_write_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ofs = offsethigh; ofs = (ofs<<32) | offsetlow; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, ", %u byte%s at offset %" G_GINT64_MODIFIER "u", datalen, (datalen == 1) ? "" : "s", ofs); @@ -7051,8 +7008,7 @@ dissect_write_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, count = count_high; count = (count<<16) | count_low; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, ", %u byte%s", count, (count == 1) ? "" : "s"); @@ -7432,18 +7388,15 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree offset, dn_len, dn); COUNT_BYTES(dn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_str(pinfo->cinfo, COL_INFO, ", User: "); - - if (!dn[0] && !an[0]) - col_append_str(pinfo->cinfo, COL_INFO, - "anonymous"); - else - col_append_fstr(pinfo->cinfo, COL_INFO, - "%s\\%s", - format_text(dn, strlen(dn)), - format_text(an, strlen(an))); - } + col_append_str(pinfo->cinfo, COL_INFO, ", User: "); + + if (!dn[0] && !an[0]) + col_append_str(pinfo->cinfo, COL_INFO, "anonymous"); + else + col_append_fstr(pinfo->cinfo, COL_INFO, + "%s\\%s", + format_text(dn, strlen(dn)), + format_text(an, strlen(an))); /* OS */ an = get_unicode_or_ascii_string(tvb, &offset, @@ -7829,10 +7782,8 @@ dissect_tree_connect_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree si->sip->extra_info = se_strdup(an); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(an, strlen(an))); - } /* * NOTE: the Service string is always ASCII, even if the @@ -9125,10 +9076,9 @@ dissect_nt_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* primary request */ subcmd = tvb_get_letohs(tvb, offset); proto_tree_add_uint(tree, hf_smb_nt_trans_subcmd, tvb, offset, 2, subcmd); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_ext_const(subcmd, &nt_cmd_vals_ext, "<unknown>")); - } + ntd.subcmd = subcmd; if (!si->unidir && sip) { if (!pinfo->fd->flags.visited) { @@ -9650,10 +9600,8 @@ dissect_nt_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t /* primary request */ if (nti != NULL) { proto_tree_add_uint(tree, hf_smb_nt_trans_subcmd, tvb, 0, 0, nti->subcmd); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_ext(nti->subcmd, &nt_cmd_vals_ext, "<unknown (%u)>")); - } } else { proto_tree_add_text(tree, tvb, offset, 0, "Function: <unknown function - could not find matching request>"); @@ -10358,10 +10306,8 @@ dissect_nt_create_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr si->sip->extra_info = fsi; } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(fn, strlen(fn))); - } END_OF_SMB @@ -11008,10 +10954,8 @@ dissect_get_dfs_request_data(tvbuff_t *tvb, packet_info *pinfo, fn); COUNT_BYTES_TRANS(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", format_text(fn, strlen(fn))); - } *bcp = bc; return offset; @@ -11097,10 +11041,8 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, fn); COUNT_BYTES_TRANS(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(fn, strlen(fn))); - } break; case 0x0001: /*TRANS2_FIND_FIRST2*/ /* Search Attributes */ @@ -11141,10 +11083,8 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, fn); COUNT_BYTES_TRANS(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Pattern: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Pattern: %s", format_text(fn, strlen(fn))); - } break; case 0x0002: /*TRANS2_FIND_NEXT2*/ @@ -11183,10 +11123,8 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, fn); COUNT_BYTES_TRANS(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Continue: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Continue: %s", format_text(fn, strlen(fn))); - } break; case 0x0003: /*TRANS2_QUERY_FS_INFORMATION*/ @@ -11198,8 +11136,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_uint(tree, hf_smb_qfsi_information_level, tvb, offset, 2, si->info_level); COUNT_BYTES_TRANS(2); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(si->info_level, qfsi_vals, "Unknown (0x%02x)")); @@ -11213,8 +11150,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_uint(tree, hf_smb_sfsi_information_level, tvb, offset+2, 2, si->info_level); COUNT_BYTES_TRANS(4); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(si->info_level, sfsi_vals, "Unknown (0x%02x)")); @@ -11228,12 +11164,10 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_uint(tree, hf_smb_qpi_loi, tvb, offset, 2, si->info_level); COUNT_BYTES_TRANS(2); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr( + col_append_fstr( pinfo->cinfo, COL_INFO, ", %s", val_to_str(si->info_level, qpi_loi_vals, "Unknown (%u)")); - } /* 4 reserved bytes */ CHECK_BYTE_COUNT_TRANS(4); @@ -11254,10 +11188,8 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, t2i->name = se_strdup(fn); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(fn, strlen(fn))); - } break; case 0x0006: /*TRANS2_SET_PATH_INFORMATION*/ @@ -11281,10 +11213,8 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, fn); COUNT_BYTES_TRANS(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(fn, strlen(fn))); - } break; case 0x0007: { /*TRANS2_QUERY_FILE_INFORMATION*/ @@ -11304,12 +11234,10 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_uint(tree, hf_smb_qpi_loi, tvb, offset, 2, si->info_level); COUNT_BYTES_TRANS(2); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr( + col_append_fstr( pinfo->cinfo, COL_INFO, ", %s", val_to_str(si->info_level, qpi_loi_vals, "Unknown (%u)")); - } break; } @@ -11411,10 +11339,8 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, fn); COUNT_BYTES_TRANS(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", format_text(fn, strlen(fn))); - } break; case 0x000c: /*TRANS2_FIND_NOTIFY_NEXT*/ @@ -11443,10 +11369,8 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, fn); COUNT_BYTES_TRANS(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Dir: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Dir: %s", format_text(fn, strlen(fn))); - } break; case 0x000e: /*TRANS2_SESSION_SETUP*/ /* XXX unknown structure*/ @@ -11462,11 +11386,8 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, fn); COUNT_BYTES_TRANS(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", format_text(fn, strlen(fn))); - } - break; } @@ -14107,11 +14028,10 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, subcmd = tvb_get_letohs(tvb, offset); proto_tree_add_uint(tree, hf_smb_trans2_subcmd, tvb, offset, 2, subcmd); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_ext(subcmd, &trans2_cmd_vals_ext, "Unknown (0x%02x)")); - } + if (!si->unidir) { if (!pinfo->fd->flags.visited && si->sip) { /* @@ -14459,10 +14379,8 @@ dissect_4_3_4_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, fn); COUNT_BYTES_SUBR(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", format_text(fn, strlen(fn))); - } proto_item_append_text(item, " File: %s", format_text(fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); @@ -14578,10 +14496,8 @@ dissect_4_3_4_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, fn); COUNT_BYTES_SUBR(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", format_text(fn, strlen(fn))); - } proto_item_append_text(item, " File: %s", format_text(fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); @@ -14699,10 +14615,8 @@ dissect_4_3_4_3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, fn); COUNT_BYTES_SUBR(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", format_text(fn, strlen(fn))); - } proto_item_append_text(item, " File: %s", format_text(fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); @@ -14791,10 +14705,8 @@ dissect_4_3_4_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, fn); COUNT_BYTES_SUBR(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", format_text(fn, strlen(fn))); - } /* skip to next structure */ if (neo) { @@ -14905,10 +14817,8 @@ dissect_4_3_4_5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, fn); COUNT_BYTES_SUBR(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", format_text(fn, strlen(fn))); - } /* skip to next structure */ if (neo) { @@ -15045,10 +14955,8 @@ dissect_4_3_4_6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, fn); COUNT_BYTES_SUBR(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", format_text(fn, strlen(fn))); - } /* skip to next structure */ if (neo) { @@ -15174,10 +15082,8 @@ dissect_4_3_4_6full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, fn); COUNT_BYTES_SUBR(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", format_text(fn, strlen(fn))); - } /* skip to next structure */ if (neo) { @@ -15324,10 +15230,8 @@ dissect_4_3_4_6_id_both(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr fn); COUNT_BYTES_SUBR(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", format_text(fn, strlen(fn))); - } /* skip to next structure */ if (neo) { @@ -15412,10 +15316,8 @@ dissect_4_3_4_7(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, fn); COUNT_BYTES_SUBR(fn_len); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", format_text(fn, strlen(fn))); - } /* skip to next structure */ if (neo) { @@ -16187,7 +16089,7 @@ dissect_transaction2_response_data(tvbuff_t *tvb, packet_info *pinfo, break; } - if (count && check_col(pinfo->cinfo, COL_INFO)) { + if (count) { col_append_str(pinfo->cinfo, COL_INFO, ", Files:"); } @@ -16206,7 +16108,7 @@ dissect_transaction2_response_data(tvbuff_t *tvb, packet_info *pinfo, if (count == -1) { break; } - if (count && check_col(pinfo->cinfo, COL_INFO)) { + if (count) { col_append_str(pinfo->cinfo, COL_INFO, ", Files:"); } @@ -16675,12 +16577,10 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree break; } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_ext(t2i->subcmd, &trans2_cmd_vals_ext, "<unknown (0x%02x)>")); - } } } break; @@ -17289,18 +17189,15 @@ dissect_smb_command(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *s proto_tree *cmd_tree; int (*dissector)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *smb_tree); - if (check_col(pinfo->cinfo, COL_INFO)) { - if (first_pdu) { - col_append_fstr(pinfo->cinfo, COL_INFO, - "%s %s", - decode_smb_name(cmd), - (si->request)? "Request" : "Response"); - } else { - col_append_fstr(pinfo->cinfo, COL_INFO, - "; %s", - decode_smb_name(cmd)); - } - + if (first_pdu) { + col_append_fstr(pinfo->cinfo, COL_INFO, + "%s %s", + decode_smb_name(cmd), + (si->request)? "Request" : "Response"); + } else { + col_append_fstr(pinfo->cinfo, COL_INFO, + "; %s", + decode_smb_name(cmd)); } cmd_item = proto_tree_add_text(smb_tree, tvb, offset, -1, @@ -18466,7 +18363,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) dissect_smb_command(tvb, pinfo, offset, tree, si->cmd, TRUE); /* Append error info from this packet to info string. */ - if (!si->request && check_col(pinfo->cinfo, COL_INFO)) { + if (!si->request) { if (flags2 & 0x4000) { /* * The status is an NT status code; was there diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c index 21acebdd18..7cd4446877 100644 --- a/epan/dissectors/packet-smb2.c +++ b/epan/dissectors/packet-smb2.c @@ -1295,14 +1295,14 @@ dissect_smb2_ioctl_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *paren ioctl_name = NULL; } - if (check_col(pinfo->cinfo, COL_INFO) && ioctl_name != NULL) { + if (ioctl_name != NULL) { col_append_fstr( pinfo->cinfo, COL_INFO, " %s", ioctl_name); } /* device */ proto_tree_add_item(tree, hf_smb2_ioctl_function_device, tvb, offset, 4, ENC_LITTLE_ENDIAN); - if (check_col(pinfo->cinfo, COL_INFO) && ioctl_name == NULL) { + if (ioctl_name == NULL) { col_append_fstr( pinfo->cinfo, COL_INFO, " %s", val_to_str((ioctl_function>>16)&0xffff, smb2_ioctl_device_vals, @@ -1314,7 +1314,7 @@ dissect_smb2_ioctl_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *paren /* function */ proto_tree_add_item(tree, hf_smb2_ioctl_function_function, tvb, offset, 4, ENC_LITTLE_ENDIAN); - if (check_col(pinfo->cinfo, COL_INFO) && ioctl_name == NULL) { + if (ioctl_name == NULL) { col_append_fstr( pinfo->cinfo, COL_INFO, " Function:0x%04x", (ioctl_function>>2)&0x0fff); @@ -1407,9 +1407,7 @@ dissect_smb2_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset if (hnd_item) { proto_item_append_text(hnd_item, " %s", fid_name); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", fid_name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", fid_name); } /* look for the eo_file_info */ @@ -2004,10 +2002,7 @@ dissect_smb2_file_rename_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree offset, length, name); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " NewName:%s", - name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " NewName:%s", name); } offset += length; @@ -2578,10 +2573,7 @@ dissect_smb2_tree_connect_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree g_snprintf((char *)si->saved->extra_info,olb.len+1,"%s",buf); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " Tree: %s", buf); - } - + col_append_fstr(pinfo->cinfo, COL_INFO, " Tree: %s", buf); return offset; } @@ -2847,11 +2839,9 @@ dissect_smb2_find_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i g_snprintf((char *)si->saved->extra_info,olb.len+1,"%s",buf); } - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s Pattern: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s Pattern: %s", val_to_str(il, smb2_find_info_levels, "(Level:0x%02x)"), buf); - } return offset; } @@ -3355,11 +3345,9 @@ dissect_smb2_find_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr } if (!pinfo->fd->flags.visited && si->saved && si->saved->extra_info_type == SMB2_EI_FINDPATTERN) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s Pattern: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s Pattern: %s", val_to_str(si->saved->infolevel, smb2_find_info_levels, "(Level:0x%02x)"), (const char *)si->saved->extra_info); - } g_free(si->saved->extra_info); si->saved->extra_info_type = SMB2_EI_NONE; @@ -3593,11 +3581,9 @@ dissect_smb2_class_infolevel(packet_info *pinfo, tvbuff_t *tvb, int offset, prot * display ab bit too much if we do it for replies * as well. */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " %s/%s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s/%s", val_to_str(cl, smb2_class_vals, "(Class:0x%02x)"), val_to_str(il, vs, "(Level:0x%02x)")); - } } return offset; @@ -4056,9 +4042,7 @@ dissect_smb2_write_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_item(tree, hf_smb2_file_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " Len:%d Off:%" G_GINT64_MODIFIER "u", length, off); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " Len:%d Off:%" G_GINT64_MODIFIER "u", length, off); /* fid */ offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); @@ -4843,9 +4827,7 @@ dissect_smb2_read_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i proto_tree_add_item(tree, hf_smb2_file_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " Len:%d Off:%" G_GINT64_MODIFIER "u", len, off); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " Len:%d Off:%" G_GINT64_MODIFIER "u", len, off); /* fid */ offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_USE); @@ -5568,9 +5550,7 @@ dissect_smb2_create_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* filename string */ fname = dissect_smb2_olb_string(pinfo, tree, tvb, &f_olb, OLB_TYPE_UNICODE_STRING); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " File: %s", fname); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " File: %s", fname); /* save the name if it looks sane */ if (!pinfo->fd->flags.visited) { @@ -6828,13 +6808,11 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolea sti->conv = si->conv; col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMB2"); - if (check_col(pinfo->cinfo, COL_INFO)) { - if (first_in_chain) { - /* first packet */ - col_clear(pinfo->cinfo, COL_INFO); - } else { - col_append_str(pinfo->cinfo, COL_INFO, ";"); - } + if (first_in_chain) { + /* first packet */ + col_clear(pinfo->cinfo, COL_INFO); + } else { + col_append_str(pinfo->cinfo, COL_INFO, ";"); } if (parent_tree) { @@ -6932,16 +6910,14 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolea proto_item_set_len(header_item, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, "%s %s", + col_append_fstr(pinfo->cinfo, COL_INFO, "%s %s", decode_smb2_name(si->opcode), (si->flags & SMB2_FLAGS_RESPONSE)?"Response":"Request"); - if (si->status) { - col_append_fstr( + if (si->status) { + col_append_fstr( pinfo->cinfo, COL_INFO, ", Error: %s", val_to_str(si->status, NT_errors, "Unknown (0x%08X)")); - } } diff --git a/epan/dissectors/packet-smpp.c b/epan/dissectors/packet-smpp.c index a256e8848b..7e78c6afba 100644 --- a/epan/dissectors/packet-smpp.c +++ b/epan/dissectors/packet-smpp.c @@ -2496,27 +2496,25 @@ dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * Make entries in the Info column on the summary display */ - if (check_col(pinfo->cinfo, COL_INFO)) { - if (first == TRUE) { - /* - * First PDU - We already computed the fixed header - */ - col_clear(pinfo->cinfo, COL_INFO); - col_add_fstr(pinfo->cinfo, COL_INFO, "SMPP %s", command_str); - first = FALSE; - } else { - /* - * Subsequent PDUs - */ - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", command_str); - } + if (first == TRUE) { /* - * Display command status of responses in Info column - */ - if (command_id & 0x80000000) { - col_append_fstr(pinfo->cinfo, COL_INFO, ": \"%s\"", - command_status_str); - } + * First PDU - We already computed the fixed header + */ + col_clear(pinfo->cinfo, COL_INFO); + col_add_fstr(pinfo->cinfo, COL_INFO, "SMPP %s", command_str); + first = FALSE; + } else { + /* + * Subsequent PDUs + */ + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", command_str); + } + /* + * Display command status of responses in Info column + */ + if (command_id & 0x80000000) { + col_append_fstr(pinfo->cinfo, COL_INFO, ": \"%s\"", + command_status_str); } /* diff --git a/epan/dissectors/packet-smrse.c b/epan/dissectors/packet-smrse.c index b611b134f7..d74806fe08 100644 --- a/epan/dissectors/packet-smrse.c +++ b/epan/dissectors/packet-smrse.c @@ -523,8 +523,7 @@ dissect_smrse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void * } col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMRSE"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(tag, tag_vals,"Unknown Tag:0x%02x")); + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(tag, tag_vals,"Unknown Tag:0x%02x")); proto_tree_add_item(tree, hf_smrse_reserved, tvb, 0, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_smrse_length, tvb, 1, 2, ENC_BIG_ENDIAN); diff --git a/epan/dissectors/packet-sna.c b/epan/dissectors/packet-sna.c index fdddfea2bb..f73fc48e5a 100644 --- a/epan/dissectors/packet-sna.c +++ b/epan/dissectors/packet-sna.c @@ -1540,8 +1540,7 @@ dissect_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, format = hi_nibble(type); /* Summary information */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "SNA XID Format:%d Type:%s", format, val_to_str_const(lo_nibble(type), sna_xid_type_vals, "Unknown Type")); @@ -2153,8 +2152,7 @@ dissect_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, th_fid = hi_nibble(tvb_get_guint8(tvb, 0)); /* Summary information */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(th_fid, sna_th_fid_vals, "Unknown FID: %01x")); if (tree) { diff --git a/epan/dissectors/packet-sndcp.c b/epan/dissectors/packet-sndcp.c index 1f2d34de30..4846746521 100644 --- a/epan/dissectors/packet-sndcp.c +++ b/epan/dissectors/packet-sndcp.c @@ -275,8 +275,7 @@ dissect_sndcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ if (!unack) { npdu = npdu_field1 = tvb_get_guint8(tvb,offset); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "SN-DATA N-PDU %d", npdu_field1); + col_add_fstr(pinfo->cinfo, COL_INFO, "SN-DATA N-PDU %d", npdu_field1); if (tree) { npdu_field_item = proto_tree_add_text(sndcp_tree, tvb, offset,1, "Acknowledged mode, N-PDU %d", npdu_field1 ); npdu_field_tree = proto_item_add_subtree(npdu_field_item, ett_sndcp_npdu_field); @@ -292,8 +291,7 @@ dissect_sndcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) npdu_field2 = tvb_get_ntohs(tvb, offset); segment = (npdu_field2 & 0xF000) >> 12; npdu = (npdu_field2 & 0x0FFF); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "SN-UNITDATA N-PDU %d (segment %d)", npdu, segment); + col_add_fstr(pinfo->cinfo, COL_INFO, "SN-UNITDATA N-PDU %d (segment %d)", npdu, segment); if (tree) { npdu_field_item = proto_tree_add_text(sndcp_tree, tvb, offset,2, "Unacknowledged mode, N-PDU %d (segment %d)", npdu, segment ); npdu_field_tree = proto_item_add_subtree(npdu_field_item, ett_sndcp_npdu_field); @@ -352,11 +350,9 @@ dissect_sndcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else { /* Not reassembled in this packet */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, " (N-PDU payload reassembled in packet %u)", fd_npdu->reassembled_in); - } if (tree) { proto_tree_add_text(sndcp_tree, tvb, offset, -1, "Payload"); } @@ -364,12 +360,11 @@ dissect_sndcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else { /* Not reassembled yet, or not reassembled at all */ - if (check_col(pinfo->cinfo, COL_INFO)) { - if (unack) - col_append_fstr(pinfo->cinfo, COL_INFO, " (Unreassembled fragment %u)", segment); - else - col_append_str(pinfo->cinfo, COL_INFO, " (Unreassembled fragment)"); - } + if (unack) + col_append_fstr(pinfo->cinfo, COL_INFO, " (Unreassembled fragment %u)", segment); + else + col_append_str(pinfo->cinfo, COL_INFO, " (Unreassembled fragment)"); + if (tree) { proto_tree_add_text(sndcp_tree, tvb, offset, -1, "Payload"); } diff --git a/epan/dissectors/packet-spp.c b/epan/dissectors/packet-spp.c index 6648779dbd..c2d59d9557 100644 --- a/epan/dissectors/packet-spp.c +++ b/epan/dissectors/packet-spp.c @@ -126,8 +126,7 @@ dissect_spp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) conn_ctrl = tvb_get_guint8(tvb, 0); spp_msg_string = spp_conn_ctrl(conn_ctrl); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", spp_msg_string); + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", spp_msg_string); if (tree) { ti = proto_tree_add_uint_format(spp_tree, hf_spp_connection_control, tvb, 0, 1, conn_ctrl, @@ -147,9 +146,7 @@ dissect_spp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) datastream_type = tvb_get_guint8(tvb, 1); datastream_type_string = spp_datastream(datastream_type); if (datastream_type_string != NULL) { - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", - datastream_type_string); + col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", datastream_type_string); } if (tree) { if (datastream_type_string != NULL) { diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c index 3aa843385c..84c14eea5d 100644 --- a/epan/dissectors/packet-srvloc.c +++ b/epan/dissectors/packet-srvloc.c @@ -832,9 +832,8 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ version = tvb_get_guint8(tvb, offset); function = tvb_get_guint8(tvb, offset + 1); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, - val_to_str(function, srvloc_functions, "Unknown Function (%u)")); + col_add_str(pinfo->cinfo, COL_INFO, + val_to_str(function, srvloc_functions, "Unknown Function (%u)")); ti = proto_tree_add_item(tree, proto_srvloc, tvb, offset, -1, ENC_NA); srvloc_tree = proto_item_add_subtree(ti, ett_srvloc); @@ -872,8 +871,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ proto_tree_add_text(srvloc_tree, tvb, offset + 10, 2, "Transaction ID: %u", tvb_get_ntohs(tvb, offset + 10)); /* added echo of XID to info colomn by Greg Morris 0ct 14, 2005 */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", V1 Transaction ID - %u", tvb_get_ntohs(tvb, offset + 10)); + col_append_fstr(pinfo->cinfo, COL_INFO, ", V1 Transaction ID - %u", tvb_get_ntohs(tvb, offset + 10)); offset += 12; @@ -1085,8 +1083,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ next_ext_off); proto_tree_add_uint(srvloc_tree, hf_srvloc_xid, tvb, offset + 10, 2, tvb_get_ntohs(tvb, offset + 10)); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", V2 XID - %u", tvb_get_ntohs(tvb, offset + 10)); + col_append_fstr(pinfo->cinfo, COL_INFO, ", V2 XID - %u", tvb_get_ntohs(tvb, offset + 10)); lang_tag_len = tvb_get_ntohs(tvb, offset + 12); proto_tree_add_uint(srvloc_tree, hf_srvloc_langtaglen, tvb, offset + 12, 2, lang_tag_len); proto_tree_add_item(srvloc_tree, hf_srvloc_langtag, tvb, offset + 14, lang_tag_len, ENC_ASCII|ENC_NA); diff --git a/epan/dissectors/packet-sscf-nni.c b/epan/dissectors/packet-sscf-nni.c index 4fcf895242..03d4ef7b95 100644 --- a/epan/dissectors/packet-sscf-nni.c +++ b/epan/dissectors/packet-sscf-nni.c @@ -92,8 +92,7 @@ dissect_sscf_nni(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) sscf_status = tvb_get_guint8(tvb, SSCF_STATUS_OFFSET); col_set_str(pinfo->cinfo, COL_PROTOCOL, "SSCF-NNI"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "STATUS (%s) ", + col_add_fstr(pinfo->cinfo, COL_INFO, "STATUS (%s) ", val_to_str_const(sscf_status, sscf_status_vals, "Unknown")); diff --git a/epan/dissectors/packet-sscop.c b/epan/dissectors/packet-sscop.c index faf982b90b..67cab7a00a 100644 --- a/epan/dissectors/packet-sscop.c +++ b/epan/dissectors/packet-sscop.c @@ -191,8 +191,7 @@ dissect_sscop_and_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, d sscop_info.type = sscop_pdu_type & SSCOP_TYPE_MASK; col_set_str(pinfo->cinfo, COL_PROTOCOL, "SSCOP"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(sscop_info.type, sscop_type_vals, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(sscop_info.type, sscop_type_vals, "Unknown PDU type (0x%02x)")); /* diff --git a/epan/dissectors/packet-starteam.c b/epan/dissectors/packet-starteam.c index 5597c2a461..1be3219c11 100644 --- a/epan/dissectors/packet-starteam.c +++ b/epan/dissectors/packet-starteam.c @@ -490,14 +490,13 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "StarTeam"); - if(check_col(pinfo->cinfo, COL_INFO)){ - /* This is a trick to know whether this is the first PDU in this packet or not */ - if(iPreviousFrameNumber != (gint) pinfo->fd->num){ - col_clear(pinfo->cinfo, COL_INFO); - } else { - col_append_str(pinfo->cinfo, COL_INFO, " | "); - } + /* This is a trick to know whether this is the first PDU in this packet or not */ + if(iPreviousFrameNumber != (gint) pinfo->fd->num){ + col_clear(pinfo->cinfo, COL_INFO); + } else { + col_append_str(pinfo->cinfo, COL_INFO, " | "); } + iPreviousFrameNumber = pinfo->fd->num; if(tvb_length(tvb) >= 16){ guint32 iCommand = 0; @@ -514,10 +513,8 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(tvb_length_remaining(tvb, offset) >= 66){ iCommand = tvb_get_letohl(tvb, offset + 62); } - if(check_col(pinfo->cinfo, COL_INFO)){ - col_append_str(pinfo->cinfo, COL_INFO, + col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext(iCommand, &starteam_opcode_vals_ext, "Unknown (0x%02x)")); - } } if(tree){ diff --git a/epan/dissectors/packet-synphasor.c b/epan/dissectors/packet-synphasor.c index 35ee0eb740..545fdba70f 100644 --- a/epan/dissectors/packet-synphasor.c +++ b/epan/dissectors/packet-synphasor.c @@ -512,15 +512,12 @@ static void dissect_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return; /* write the protocol name to the info column */ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTOCOL_SHORT_NAME); + col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTOCOL_SHORT_NAME); frame_type = tvb_get_guint8(tvb, 1) >> 4; - if (check_col(pinfo->cinfo, COL_INFO)) { - col_clear(pinfo->cinfo, COL_INFO); /* clear out stuff in the info column */ - col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_const(frame_type, typenames, "invalid packet type")); - } + col_clear(pinfo->cinfo, COL_INFO); /* clear out stuff in the info column */ + col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_const(frame_type, typenames, "invalid packet type")); /* CFG-2 and DATA frames need special treatment during the first run: * For CFG-2 frames, a 'config_frame' struct is created to hold the @@ -863,17 +860,17 @@ static int dissect_command_frame(tvbuff_t *tvb, { proto_tree *command_tree = NULL; guint tvbsize = tvb_length(tvb); + const char *s; proto_item_set_text(command_item, "Command data"); command_tree = proto_item_add_subtree(command_item, ett_command); /* CMD */ proto_tree_add_item(command_tree, hf_command, tvb, 0, 2, ENC_BIG_ENDIAN); - if (check_col(pinfo->cinfo, COL_INFO)) { - const char *s = val_to_str_const(tvb_get_ntohs(tvb, 0), command_names, "invalid command"); - col_append_str(pinfo->cinfo, COL_INFO, ", "); - col_append_str(pinfo->cinfo, COL_INFO, s); - } + + s = val_to_str_const(tvb_get_ntohs(tvb, 0), command_names, "invalid command"); + col_append_str(pinfo->cinfo, COL_INFO, ", "); + col_append_str(pinfo->cinfo, COL_INFO, s); if (tvbsize > 2) { if (tvb_get_ntohs(tvb, 0) == 0x0008) { diff --git a/epan/dissectors/packet-syslog.c b/epan/dissectors/packet-syslog.c index 0530ea2138..f0df66e261 100644 --- a/epan/dissectors/packet-syslog.c +++ b/epan/dissectors/packet-syslog.c @@ -260,7 +260,7 @@ dissect_syslog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) mtp3_tvb = mtp3_msu_present(tvb, pinfo, fac, lev, msg_str, (reported_msg_len - msg_len)); - if (mtp3_tvb == NULL && check_col(pinfo->cinfo, COL_INFO)) { + if (mtp3_tvb == NULL) { if (pri >= 0) { col_add_fstr(pinfo->cinfo, COL_INFO, "%s.%s: %s", val_to_str_const(fac, short_fac, "UNKNOWN"), diff --git a/epan/dissectors/packet-tali.c b/epan/dissectors/packet-tali.c index e8e694b8b2..375ba6b530 100644 --- a/epan/dissectors/packet-tali.c +++ b/epan/dissectors/packet-tali.c @@ -105,10 +105,8 @@ dissect_tali_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Make entries in Protocol column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "TALI"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_set_str(pinfo->cinfo, COL_INFO, ""); - col_append_fstr(pinfo->cinfo, COL_INFO, "[%s] packet, [%u] bytes in payload", opcode, length); - } + col_set_str(pinfo->cinfo, COL_INFO, ""); + col_append_fstr(pinfo->cinfo, COL_INFO, "[%s] packet, [%u] bytes in payload", opcode, length); if (tree) { /* create display subtree for the protocol */ diff --git a/epan/dissectors/packet-tapa.c b/epan/dissectors/packet-tapa.c index eaafa8a723..34d95b051d 100644 --- a/epan/dissectors/packet-tapa.c +++ b/epan/dissectors/packet-tapa.c @@ -153,8 +153,7 @@ dissect_tapa_discover_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tapa_ proto_tree_add_item(tapa_discover_tree, hf_tapa_discover_reply_switchip, tvb, offset, 4, ENC_BIG_ENDIAN); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", Switch: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Switch: %s", tvb_ip_to_str(tvb, offset)); offset += 4; @@ -193,11 +192,10 @@ dissect_tapa_discover_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tapa_di DISSECTOR_ASSERT(item_length > 0); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s: %s", item_type_text, item_text); - item = proto_tree_add_text(tapa_discover_tree, tvb, offset, 4 + item_length, + item = proto_tree_add_text(tapa_discover_tree, tvb, offset, 4 + item_length, "Type %d = %s, length %d, value %s", item_type, item_type_text, item_length, item_text); @@ -247,11 +245,10 @@ dissect_tapa_discover_unknown_new_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_t else item_text = "BINARY-DATA"; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", T=%d L=%d", + col_append_fstr(pinfo->cinfo, COL_INFO, ", T=%d L=%d", item_type, item_length); - item = proto_tree_add_text(tapa_discover_tree, tvb, offset, 4 + item_length, + item = proto_tree_add_text(tapa_discover_tree, tvb, offset, 4 + item_length, "Type %d, length %d, value %s", item_type, item_length, item_text); @@ -297,8 +294,7 @@ dissect_tapa_discover(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) DISSECTOR_ASSERT(remaining > 4); col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_SHORT_NAME); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "Discover - %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "Discover - %s", val_to_str(packet_type, tapa_discover_type_vals, "Unknown (%d)")); if (tree) { @@ -356,8 +352,7 @@ dissect_tapa_tunnel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) remaining = tvb_reported_length(tvb); col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_SHORT_NAME); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "Tunnel - V=%d, T=%s", version >> 4, + col_add_fstr(pinfo->cinfo, COL_INFO, "Tunnel - V=%d, T=%s", version >> 4, val_to_str(type, tapa_tunnel_type_vals, "Unknown (%d)")); if (tree) { diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index a548302d9c..80511315c7 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -3422,7 +3422,7 @@ dissect_tcpopt_rvbd_probe(const ip_tcp_opt *optp _U_, tvbuff_t *tvb, int offset, proto_item_append_text(pitem, ", CSH IP: %s", ip_to_str((guint8 *)&ip)); - if (check_col(pinfo->cinfo, COL_INFO)) { + { /* Small look-ahead hack to distinguish S+ from S+* */ #define PROBE_V1_QUERY_LEN 10 const guint8 qinfo_hdr[] = { 0x4c, 0x04, 0x0c }; @@ -3518,7 +3518,6 @@ dissect_tcpopt_rvbd_probe(const ip_tcp_opt *optp _U_, tvbuff_t *tvb, int offset, 4, ENC_BIG_ENDIAN); if (type != PROBE_QUERY_INFO_SID && - check_col(pinfo->cinfo, COL_INFO) && (tvb_get_guint8(tvb, 13) & (TH_SYN|TH_ACK)) == (TH_SYN|TH_ACK) && (flags & RVBD_FLAGS_PROBE_LAST)) { col_prepend_fstr(pinfo->cinfo, COL_INFO, "SA++, "); @@ -4339,7 +4338,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else tcph->th_have_seglen = FALSE; - if (check_col(pinfo->cinfo, COL_INFO) || tree) { + if (tree) { gboolean first_flag = TRUE; for (i = 0; i < 9; i++) { bpos = 1 << i; diff --git a/epan/dissectors/packet-teamspeak2.c b/epan/dissectors/packet-teamspeak2.c index 27b12be66d..7204f0f766 100644 --- a/epan/dissectors/packet-teamspeak2.c +++ b/epan/dissectors/packet-teamspeak2.c @@ -440,7 +440,7 @@ static void ts2_standard_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree * } else { /* Not last packet of reassembled Short Message */ - if (check_col(pinfo->cinfo, COL_INFO))col_append_fstr(pinfo->cinfo, COL_INFO," (Message fragment %u)", frag->frag_num); + col_append_fstr(pinfo->cinfo, COL_INFO," (Message fragment %u)", frag->frag_num); } if (new_tvb) next_tvb = new_tvb; diff --git a/epan/dissectors/packet-teimanagement.c b/epan/dissectors/packet-teimanagement.c index f035066c97..785c3d4fa0 100644 --- a/epan/dissectors/packet-teimanagement.c +++ b/epan/dissectors/packet-teimanagement.c @@ -84,7 +84,6 @@ dissect_teimanagement(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } message = tvb_get_guint8(tvb, 3); - if (check_col(pinfo->cinfo, COL_INFO)) col_add_str(pinfo->cinfo, COL_INFO, val_to_str(message, tei_msg_vals, "Unknown message type (0x%04x)")); if (tree) { diff --git a/epan/dissectors/packet-telkonet.c b/epan/dissectors/packet-telkonet.c index d3ec6712aa..a6109e5fb2 100644 --- a/epan/dissectors/packet-telkonet.c +++ b/epan/dissectors/packet-telkonet.c @@ -65,12 +65,8 @@ dissect_telkonet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_clear(pinfo->cinfo, COL_INFO); type = (telkonet_type_t)tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "Telkonet type: %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "Telkonet type: %s", val_to_str(type, telkonet_type_vals, "Unknown (0x%02x)")); - } - - telkonet_tree = NULL; ti = proto_tree_add_item(tree, proto_telkonet, tvb, 0, 8, ENC_NA); telkonet_tree = proto_item_add_subtree(ti, ett_telkonet); diff --git a/epan/dissectors/packet-teredo.c b/epan/dissectors/packet-teredo.c index 0325fc7a7c..4296be66cb 100644 --- a/epan/dissectors/packet-teredo.c +++ b/epan/dissectors/packet-teredo.c @@ -85,8 +85,7 @@ parse_teredo_auth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { guint idlen, aulen; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_sep_str (pinfo->cinfo, COL_INFO, ", ", + col_append_sep_str (pinfo->cinfo, COL_INFO, ", ", "Authentication header"); teredoh->th_indtyp = 1; @@ -150,8 +149,7 @@ parse_teredo_orig(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { proto_item *ti = NULL; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_sep_str (pinfo->cinfo, COL_INFO, ", ", + col_append_sep_str (pinfo->cinfo, COL_INFO, ", ", "Origin indication"); if (tree) { diff --git a/epan/dissectors/packet-text-media.c b/epan/dissectors/packet-text-media.c index 0f0e1606cd..588b4029b9 100644 --- a/epan/dissectors/packet-text-media.c +++ b/epan/dissectors/packet-text-media.c @@ -92,7 +92,7 @@ dissect_text_lines(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - if (data_name && check_col(pinfo->cinfo, COL_INFO)) + if (data_name) col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "(%s)", data_name); diff --git a/epan/dissectors/packet-time.c b/epan/dissectors/packet-time.c index 56e9cd6c38..dfc81697e7 100644 --- a/epan/dissectors/packet-time.c +++ b/epan/dissectors/packet-time.c @@ -55,10 +55,8 @@ dissect_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "TIME"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "TIME %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "TIME %s", pinfo->srcport == pinfo->match_uint ? "Response":"Request"); - } if (tree) { diff --git a/epan/dissectors/packet-tivoconnect.c b/epan/dissectors/packet-tivoconnect.c index fa4348e61f..e6abb1e13b 100644 --- a/epan/dissectors/packet-tivoconnect.c +++ b/epan/dissectors/packet-tivoconnect.c @@ -167,8 +167,7 @@ dissect_tivoconnect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d /* Adjust "Info" column and top of tree into more useful info */ if (packet_machine) { proto_item_append_text(ti, ", %s", packet_machine); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", proto_name, packet_machine); } if (packet_identity) { @@ -176,13 +175,11 @@ dissect_tivoconnect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d packet_machine ? " (%s)" : ", ID:%s", packet_identity); if (packet_machine) { - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s (%s)", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s (%s)", proto_name, packet_machine, packet_identity); } else { - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s ID:%s", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s ID:%s", proto_name, packet_identity); } } diff --git a/epan/dissectors/packet-tns.c b/epan/dissectors/packet-tns.c index c88a8cbb4d..fb006d8bcf 100644 --- a/epan/dissectors/packet-tns.c +++ b/epan/dissectors/packet-tns.c @@ -290,24 +290,18 @@ static void dissect_tns_data(tvbuff_t *tvb, int offset, packet_info *pinfo, } offset += 2; - if ( check_col(pinfo->cinfo, COL_INFO) ) + if ( is_sns ) { - if ( is_sns ) - { - col_append_str(pinfo->cinfo, COL_INFO, ", SNS"); - } - else - { - col_append_str(pinfo->cinfo, COL_INFO, ", Data"); - } + col_append_str(pinfo->cinfo, COL_INFO, ", SNS"); } - - if ( data_tree ) + else { - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, offset), pinfo, data_tree); + col_append_str(pinfo->cinfo, COL_INFO, ", Data"); } + call_dissector(data_handle, + tvb_new_subset_remaining(tvb, offset), pinfo, data_tree); + return; } @@ -736,16 +730,13 @@ static void dissect_tns_marker(tvbuff_t *tvb, int offset, packet_info *pinfo, PROTO_ITEM_SET_HIDDEN(hidden_item); } - if ( check_col(pinfo->cinfo, COL_INFO) ) + if ( is_attention ) { - if ( is_attention ) - { - col_append_str(pinfo->cinfo, COL_INFO, ", Marker"); - } - else - { - col_append_str(pinfo->cinfo, COL_INFO, ", Attention"); - } + col_append_str(pinfo->cinfo, COL_INFO, ", Marker"); + } + else + { + col_append_str(pinfo->cinfo, COL_INFO, ", Attention"); } if ( marker_tree ) @@ -884,11 +875,8 @@ dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "TNS"); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_set_str(pinfo->cinfo, COL_INFO, + col_set_str(pinfo->cinfo, COL_INFO, (pinfo->match_uint == pinfo->destport) ? "Request" : "Response"); - } if (tree) { @@ -931,11 +919,8 @@ dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } offset += 1; - if ( check_col(pinfo->cinfo, COL_INFO)) - { - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s (%u)", + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s (%u)", val_to_str_const(type, tns_type_vals, "Unknown"), type); - } if ( tree ) { diff --git a/epan/dissectors/packet-tpncp.c b/epan/dissectors/packet-tpncp.c index 5ec37e0e57..b6d0b1e55c 100644 --- a/epan/dissectors/packet-tpncp.c +++ b/epan/dissectors/packet-tpncp.c @@ -266,18 +266,16 @@ static void dissect_tpncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "TPNCP"); - if (check_col(pinfo->cinfo, COL_INFO)) { - if (pinfo->srcport == UDP_PORT_TPNCP_TRUNKPACK) { - col_add_fstr(pinfo->cinfo, COL_INFO, - "EvID=%s(%d), SeqNo=%d, ChID=%d, Len=%d, Ver=%d", - val_to_str_const(id, tpncp_events_id_vals, "Unknown"), - id, seq_number, cid, len, ver); - } else { - col_add_fstr(pinfo->cinfo, COL_INFO, - "CmdID=%s(%d), SeqNo=%d, Len=%d, Ver=%d", - val_to_str_const(id, tpncp_commands_id_vals, "Unknown"), - id, seq_number, len, ver); - } + if (pinfo->srcport == UDP_PORT_TPNCP_TRUNKPACK) { + col_add_fstr(pinfo->cinfo, COL_INFO, + "EvID=%s(%d), SeqNo=%d, ChID=%d, Len=%d, Ver=%d", + val_to_str_const(id, tpncp_events_id_vals, "Unknown"), + id, seq_number, cid, len, ver); + } else { + col_add_fstr(pinfo->cinfo, COL_INFO, + "CmdID=%s(%d), SeqNo=%d, Len=%d, Ver=%d", + val_to_str_const(id, tpncp_commands_id_vals, "Unknown"), + id, seq_number, len, ver); } if (tree) { diff --git a/epan/dissectors/packet-trmac.c b/epan/dissectors/packet-trmac.c index 6d8488b508..155f4007d3 100644 --- a/epan/dissectors/packet-trmac.c +++ b/epan/dissectors/packet-trmac.c @@ -496,8 +496,7 @@ dissect_trmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) mv_val = tvb_get_guint8(tvb, 3); /* Interpret the major vector */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(mv_val, major_vector_vs, "Unknown Major Vector: %u")); if (tree) { diff --git a/epan/dissectors/packet-tsp.c b/epan/dissectors/packet-tsp.c index 939af78bd7..66d7df86e0 100644 --- a/epan/dissectors/packet-tsp.c +++ b/epan/dissectors/packet-tsp.c @@ -118,8 +118,7 @@ dissect_tsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_clear(pinfo->cinfo, COL_INFO); tsp_type = tvb_get_guint8(tvb, 0); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(tsp_type, names_tsp_type, "Unknown message type (%u)")); if (tree) { diff --git a/epan/dissectors/packet-turbocell.c b/epan/dissectors/packet-turbocell.c index 54a5442d01..4cef24a7e8 100644 --- a/epan/dissectors/packet-turbocell.c +++ b/epan/dissectors/packet-turbocell.c @@ -180,8 +180,7 @@ static void dissect_turbocell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre network_tree = proto_item_add_subtree(name_item, ett_network); str_name=tvb_get_ephemeral_stringz(tvb, 0x14, &str_len); - if (check_col (pinfo->cinfo, COL_INFO) && str_len > 0) - col_append_fstr(pinfo->cinfo, COL_INFO, ", Network=\"%s\"",format_text(str_name, str_len-1)); + col_append_fstr(pinfo->cinfo, COL_INFO, ", Network=\"%s\"",format_text(str_name, str_len-1)); while(tvb_get_guint8(tvb, 0x34 + 8*i)==0x00 && (tvb_length_remaining(tvb,0x34 + 8*i) > 6) && (i<32)) { proto_tree_add_item(network_tree, hf_turbocell_station[i], tvb, 0x34+8*i, 6, ENC_NA); diff --git a/epan/dissectors/packet-turnchannel.c b/epan/dissectors/packet-turnchannel.c index e15a2895fc..187151b6c2 100644 --- a/epan/dissectors/packet-turnchannel.c +++ b/epan/dissectors/packet-turnchannel.c @@ -86,8 +86,7 @@ dissect_turnchannel_message(tvbuff_t *tvb, packet_info *pinfo, /* Seems to be a decent TURN channel message */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "TURN CHANNEL"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "Channel Id 0x%x", channel_id); + col_add_fstr(pinfo->cinfo, COL_INFO, "Channel Id 0x%x", channel_id); ti = proto_tree_add_item(tree, proto_turnchannel, tvb, 0, -1, ENC_NA); diff --git a/epan/dissectors/packet-tuxedo.c b/epan/dissectors/packet-tuxedo.c index 6ba3028869..04481e39f5 100644 --- a/epan/dissectors/packet-tuxedo.c +++ b/epan/dissectors/packet-tuxedo.c @@ -115,10 +115,7 @@ dissect_tuxedo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { opcode = tvb_get_ntohl(tvb, 4); - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, tuxedo_opcode_vals, "Unknown (0x%02x)")); - } + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, tuxedo_opcode_vals, "Unknown (0x%02x)")); if (tree) { diff --git a/epan/dissectors/packet-tzsp.c b/epan/dissectors/packet-tzsp.c index 9cf8124602..050721822d 100644 --- a/epan/dissectors/packet-tzsp.c +++ b/epan/dissectors/packet-tzsp.c @@ -375,8 +375,7 @@ dissect_tzsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb, pinfo, tree))) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "TZSP_ENCAP = %u", + col_add_fstr(pinfo->cinfo, COL_INFO, "TZSP_ENCAP = %u", encapsulation); call_dissector(data_handle, next_tvb, pinfo, tree); } diff --git a/epan/dissectors/packet-ua.c b/epan/dissectors/packet-ua.c index 191e8e2746..fa71a76d6c 100644 --- a/epan/dissectors/packet-ua.c +++ b/epan/dissectors/packet-ua.c @@ -153,8 +153,7 @@ static void uadecode(e_ua_direction direction, default: { /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " - UA3G Message ERR: Opcode Unknown"); + col_append_fstr(pinfo->cinfo, COL_INFO, " - UA3G Message ERR: Opcode Unknown"); proto_tree_add_text(tree, tvb, diff --git a/epan/dissectors/packet-ua3g.c b/epan/dissectors/packet-ua3g.c index 9459c66869..dab38d0551 100644 --- a/epan/dissectors/packet-ua3g.c +++ b/epan/dissectors/packet-ua3g.c @@ -581,8 +581,7 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo command = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", val_to_str_ext_const(command, &str_command_ext, "Unknown")); if (!ua3g_body_item) @@ -1793,8 +1792,7 @@ decode_led_command(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, command = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", val_to_str_ext_const(command, &str_command_ext, "Unknown")); if (!ua3g_body_item) @@ -1867,8 +1865,7 @@ decode_lcd_line_cmd(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, column_n = tvb_get_guint8(tvb, offset + 1); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s %d", + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s %d", val_to_str_const(command, str_command, "Unknown"), column_n); @@ -1963,8 +1960,7 @@ decode_main_voice_mode(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, mode = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", val_to_str_ext_const(mode, &str_voice_mode_ext, "Unknown")); if (!ua3g_body_item) @@ -2159,8 +2155,7 @@ decode_set_clck(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, command = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", val_to_str_const(command, str_command, "Unknown")); if (!ua3g_body_item) @@ -2312,8 +2307,7 @@ decode_external_ringing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, command = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", val_to_str_const(command, str_ext_ring_cmd, "Unknown")); if (!ua3g_body_item) @@ -2346,9 +2340,8 @@ decode_lcd_cursor(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, str_on_off_val = tvb_get_guint8(tvb, offset + 1) & 0x02; /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", - STR_ON_OFF(str_on_off_val)); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + STR_ON_OFF(str_on_off_val)); if (!ua3g_body_item) return; @@ -2500,9 +2493,8 @@ decode_beep(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, command = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", - val_to_str_const(command, str_command, "Unknown")); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + val_to_str_const(command, str_command, "Unknown")); if (!ua3g_body_item) return; @@ -2652,8 +2644,7 @@ decode_beep(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, } } else { /* Classical Beep */ /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": Classical Beep"); + col_append_fstr(pinfo->cinfo, COL_INFO, ": Classical Beep"); if (!ua3g_body_item) return; @@ -2680,9 +2671,8 @@ decode_sidetone(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, command = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", - STR_ON_OFF(command)); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + STR_ON_OFF(command)); if (!ua3g_body_item) return; @@ -2759,9 +2749,8 @@ decode_mute(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, command = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", - val_to_str_const(command, str_mute, "Unknown")); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + val_to_str_const(command, str_mute, "Unknown")); if (!ua3g_body_item) return; @@ -2793,9 +2782,8 @@ decode_feedback(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, command = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", - STR_ON_OFF(command)); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + STR_ON_OFF(command)); if (!ua3g_body_item) return; @@ -2928,9 +2916,8 @@ decode_audio_config(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, command = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", - val_to_str_ext_const(command, &str_command_ext, "Unknown")); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); if (!ua3g_body_item) return; @@ -3159,9 +3146,8 @@ decode_on_off_level(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, command = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", - STR_ON_OFF(command)); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + STR_ON_OFF(command)); if (!ua3g_body_item) return; @@ -3215,9 +3201,8 @@ decode_ring(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, command = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", - STR_ON_OFF(command)); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + STR_ON_OFF(command)); if (!ua3g_body_item) return; @@ -3288,9 +3273,8 @@ decode_ua_dwl_protocol(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, command = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", - val_to_str_ext_const(command, &str_command_ext, "Unknown")); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); if (!ua3g_body_item) return; @@ -3602,9 +3586,8 @@ decode_cs_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, command = tvb_get_guint8(tvb, offset); /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", - val_to_str_const(command, str_command, "Unknown")); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + val_to_str_const(command, str_command, "Unknown")); if (!ua3g_body_item) return; @@ -4295,9 +4278,8 @@ decode_unsolicited_msg(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, if (opcode != 0x21) { /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", - val_to_str_ext_const(command, &str_command_ext, "Unknown")); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); if (!ua3g_body_item) return; @@ -4796,9 +4778,8 @@ dissect_ua3g(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) length--; /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - val_to_str_ext_const(opcode, opcodes_vals_ext_p, "Unknown")); + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + val_to_str_ext_const(opcode, opcodes_vals_ext_p, "Unknown")); proto_item_append_text(ua3g_item, ", %s", val_to_str_ext_const(opcode, opcodes_vals_ext_p, "Unknown")); diff --git a/epan/dissectors/packet-uasip.c b/epan/dissectors/packet-uasip.c index 3d25dc5412..7f084842dc 100644 --- a/epan/dissectors/packet-uasip.c +++ b/epan/dissectors/packet-uasip.c @@ -129,10 +129,7 @@ static void _dissect_uasip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ua_tap_info.expseq = 0; ua_tap_info.sntseq = 0; - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_ext(opcode, &uaudp_opcode_str_ext, "unknown (0x%02x)")); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_ext(opcode, &uaudp_opcode_str_ext, "unknown (0x%02x)")); uasip_item = proto_tree_add_protocol_format(tree, proto_uasip, tvb, 0, 5, "SIP/NOE Protocol, %s", @@ -252,19 +249,13 @@ static void _dissect_uasip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { if (datalen > 0) { - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_add_fstr(pinfo->cinfo, COL_INFO, "DATA exp:%d", ua_tap_info.expseq); - col_append_fstr(pinfo->cinfo, COL_INFO, " snt:%d", ua_tap_info.sntseq); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "DATA exp:%d", ua_tap_info.expseq); + col_append_fstr(pinfo->cinfo, COL_INFO, " snt:%d", ua_tap_info.sntseq); } else { - if (check_col(pinfo->cinfo, COL_INFO)) - { - col_add_fstr(pinfo->cinfo, COL_INFO, "ACK exp:%d", ua_tap_info.expseq); - col_append_fstr(pinfo->cinfo, COL_INFO, " snt:%d", ua_tap_info.sntseq); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "ACK exp:%d", ua_tap_info.expseq); + col_append_fstr(pinfo->cinfo, COL_INFO, " snt:%d", ua_tap_info.sntseq); } } } diff --git a/epan/dissectors/packet-uaudp.c b/epan/dissectors/packet-uaudp.c index ebe8eee81f..2a27561601 100644 --- a/epan/dissectors/packet-uaudp.c +++ b/epan/dissectors/packet-uaudp.c @@ -196,11 +196,10 @@ static void _dissect_uaudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ua_tap_info.sntseq = 0; /* print in "INFO" column the type of UAUDP message */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, - COL_INFO, - "%s", - val_to_str_ext(opcode, &uaudp_opcode_str_ext, "unknown (0x%02x)")); + col_add_fstr(pinfo->cinfo, + COL_INFO, + "%s", + val_to_str_ext(opcode, &uaudp_opcode_str_ext, "unknown (0x%02x)")); uaudp_item = proto_tree_add_protocol_format(tree, proto_uaudp, tvb, 0, 5, "Universal Alcatel/UDP Encapsulation Protocol, %s", @@ -307,8 +306,7 @@ static void _dissect_uaudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tree); else { /* XXX: expert ?? */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, + col_add_str(pinfo->cinfo, COL_INFO, "Data - Couldn't resolve direction. Check UAUDP Preferences."); } diff --git a/epan/dissectors/packet-ucp.c b/epan/dissectors/packet-ucp.c index c7ac61cd37..c36abc4208 100644 --- a/epan/dissectors/packet-ucp.c +++ b/epan/dissectors/packet-ucp.c @@ -1828,13 +1828,11 @@ dissect_ucp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tap_rec->operation = OT; /* Make entries in Info column on summary display */ - if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, "%s (%s)", - val_to_str_const(OT, vals_hdr_OT, "unknown operation"), - val_to_str(O_R, vals_hdr_O_R, "Unknown (%d)")); - if (result == UCP_INV_CHK) - col_append_str(pinfo->cinfo, COL_INFO, " [checksum invalid]"); - } + col_append_fstr(pinfo->cinfo, COL_INFO, "%s (%s)", + val_to_str_const(OT, vals_hdr_OT, "unknown operation"), + val_to_str(O_R, vals_hdr_O_R, "Unknown (%d)")); + if (result == UCP_INV_CHK) + col_append_str(pinfo->cinfo, COL_INFO, " [checksum invalid]"); /* In the interest of speed, if "tree" is NULL, don't do any work not necessary to generate protocol tree items. */ diff --git a/epan/dissectors/packet-udld.c b/epan/dissectors/packet-udld.c index e609e2fec6..25658fd997 100644 --- a/epan/dissectors/packet-udld.c +++ b/epan/dissectors/packet-udld.c @@ -154,8 +154,7 @@ dissect_udld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case TYPE_DEVICE_ID: /* Device ID */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, "Device ID: %s ", tvb_format_stringzpad(tvb, offset + 4, length - 4)); @@ -188,8 +187,7 @@ dissect_udld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) real_length = length + 3; } - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, "Port ID: %s ", tvb_format_stringzpad(tvb, offset + 4, length - 4)); diff --git a/epan/dissectors/packet-usb-hid.c b/epan/dissectors/packet-usb-hid.c index 2dbf8b8366..71950be2a3 100644 --- a/epan/dissectors/packet-usb-hid.c +++ b/epan/dissectors/packet-usb-hid.c @@ -784,11 +784,9 @@ dissect_usb_hid_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi col_set_str(pinfo->cinfo, COL_PROTOCOL, "USBHID"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", - val_to_str(usb_trans_info->setup.request, setup_request_names_vals, "Unknown type %x"), - is_request ? "Request" : "Response"); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", + val_to_str(usb_trans_info->setup.request, setup_request_names_vals, "Unknown type %x"), + is_request ? "Request" : "Response"); if (is_request) { proto_tree_add_item(tree, hf_usb_hid_request, tvb, offset, 1, ENC_LITTLE_ENDIAN); diff --git a/epan/dissectors/packet-usb-masstorage.c b/epan/dissectors/packet-usb-masstorage.c index 924dea29a8..72ba258da0 100644 --- a/epan/dissectors/packet-usb-masstorage.c +++ b/epan/dissectors/packet-usb-masstorage.c @@ -161,11 +161,9 @@ dissect_usb_ms_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void col_set_str(pinfo->cinfo, COL_PROTOCOL, "USBMS"); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", - val_to_str(usb_trans_info->setup.request, setup_request_names_vals, "Unknown type %x"), - is_request?"Request":"Response"); - } + col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", + val_to_str(usb_trans_info->setup.request, setup_request_names_vals, "Unknown type %x"), + is_request?"Request":"Response"); if(is_request){ proto_tree_add_item(tree, hf_usb_ms_request, tvb, offset, 1, ENC_LITTLE_ENDIAN); diff --git a/epan/dissectors/packet-uts.c b/epan/dissectors/packet-uts.c index f2d8c88d98..28bfec0bd4 100644 --- a/epan/dissectors/packet-uts.c +++ b/epan/dissectors/packet-uts.c @@ -93,11 +93,9 @@ static void set_addr(packet_info *pinfo _U_ , int field, gchar rid, gchar sid, gchar did) { if (field == SRC) { - if (check_col(pinfo->cinfo, COL_DEF_SRC)) - col_append_fstr(pinfo->cinfo, COL_DEF_SRC, " %2.2X:%2.2X:%2.2X", rid, sid, did); + col_append_fstr(pinfo->cinfo, COL_DEF_SRC, " %2.2X:%2.2X:%2.2X", rid, sid, did); } else { - if (check_col(pinfo->cinfo, COL_DEF_DST)) - col_append_fstr(pinfo->cinfo, COL_DEF_DST, " %2.2X:%2.2X:%2.2X", rid, sid, did); + col_append_fstr(pinfo->cinfo, COL_DEF_DST, " %2.2X:%2.2X:%2.2X", rid, sid, did); } } diff --git a/epan/dissectors/packet-v120.c b/epan/dissectors/packet-v120.c index de57c9ba67..1fe7609ef0 100644 --- a/epan/dissectors/packet-v120.c +++ b/epan/dissectors/packet-v120.c @@ -120,8 +120,7 @@ dissect_v120(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) byte0 = tvb_get_guint8(tvb, 0); - if(check_col(pinfo->cinfo, COL_RES_DL_SRC)) - col_add_fstr(pinfo->cinfo, COL_RES_DL_SRC, "0x%02X", byte0); + col_add_fstr(pinfo->cinfo, COL_RES_DL_SRC, "0x%02X", byte0); byte1 = tvb_get_guint8(tvb, 1); diff --git a/epan/dissectors/packet-vj.c b/epan/dissectors/packet-vj.c index 7b283b86d3..2382aab7f1 100644 --- a/epan/dissectors/packet-vj.c +++ b/epan/dissectors/packet-vj.c @@ -273,10 +273,8 @@ dissect_vjuc(tvbuff_t *tvb, packet_info *pinfo, proto_tree * tree) /* Check IP header length */ if(ihl < IP_HDR_LEN) { - if(check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "VJ uncompressed TCP (IP header length (%u) < %u)", + col_add_fstr(pinfo->cinfo, COL_INFO, "VJ uncompressed TCP (IP header length (%u) < %u)", ihl, IP_HDR_LEN); - } if(cs != NULL) cs->flags |= SLF_TOSS; return; @@ -325,10 +323,8 @@ dissect_vjuc(tvbuff_t *tvb, packet_info *pinfo, proto_tree * tree) /* Check TCP header length */ if(thl < TCP_HDR_LEN) { - if(check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "VJ uncompressed TCP (TCP header length (%u) < %u)", + col_add_fstr(pinfo->cinfo, COL_INFO, "VJ uncompressed TCP (TCP header length (%u) < %u)", thl, TCP_HDR_LEN); - } if(cs != NULL) cs->flags |= SLF_TOSS; cs = NULL; /* disable state updates */ diff --git a/epan/dissectors/packet-vnc.c b/epan/dissectors/packet-vnc.c index 0c7edf2b4f..076bab7528 100644 --- a/epan/dissectors/packet-vnc.c +++ b/epan/dissectors/packet-vnc.c @@ -823,8 +823,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, g_ascii_strtod((char *)tvb_get_ephemeral_string(tvb, 4, 7), NULL); per_conversation_info->server_port = pinfo->srcport; - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "Server protocol version: %s", tvb_format_text(tvb, 4, 7)); @@ -840,8 +839,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, per_conversation_info->client_proto_ver = g_ascii_strtod((char *)tvb_get_ephemeral_string(tvb, 4, 7), NULL); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, + col_add_fstr(pinfo->cinfo, COL_INFO, "Client protocol version: %s", tvb_format_text(tvb, 4, 7)); diff --git a/epan/dissectors/packet-wbxml.c b/epan/dissectors/packet-wbxml.c index cb05adff6d..30e2cd4e59 100644 --- a/epan/dissectors/packet-wbxml.c +++ b/epan/dissectors/packet-wbxml.c @@ -7027,8 +7027,7 @@ dissect_wbxml_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* Put some information here, so that the user knows what's going on. */ /* Add summary to INFO column if it is enabled */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " (Unknown WBXML version 0x%02x)", version); + col_append_fstr(pinfo->cinfo, COL_INFO, " (Unknown WBXML version 0x%02x)", version); ti = proto_tree_add_item (tree, proto_wbxml, tvb, 0, -1, ENC_NA); proto_item_append_text(ti, ", Unknown version 0x%02x", version); return; @@ -7085,8 +7084,7 @@ dissect_wbxml_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* Add summary to INFO column if it is enabled */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " (WBXML %s)", summary); + col_append_fstr(pinfo->cinfo, COL_INFO, " (WBXML %s)", summary); /* create display subtree for the protocol */ ti = proto_tree_add_item (tree, proto_wbxml, tvb, 0, -1, ENC_NA); diff --git a/epan/dissectors/packet-wccp.c b/epan/dissectors/packet-wccp.c index cfb7a634d4..34b1fe36a1 100644 --- a/epan/dissectors/packet-wccp.c +++ b/epan/dissectors/packet-wccp.c @@ -650,10 +650,8 @@ dissect_wccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ col_clear(pinfo->cinfo, COL_INFO); - if(check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(wccp_message_type, + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(wccp_message_type, wccp_type_vals, "Unknown WCCP message (%u)")); - } if(tree != NULL) { wccp_tree_item = proto_tree_add_item(tree, proto_wccp, tvb, offset, diff --git a/epan/dissectors/packet-wcp.c b/epan/dissectors/packet-wcp.c index f20e724e94..405d2dd87e 100644 --- a/epan/dissectors/packet-wcp.c +++ b/epan/dissectors/packet-wcp.c @@ -321,12 +321,10 @@ static void dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /*XXX should test seq to be sure it the last + 1 !! */ - if (check_col(pinfo->cinfo, COL_INFO)){ - col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(cmd, cmd_string, "Unknown")); - if ( cmd == 0xf) - col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", + col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(cmd, cmd_string, "Unknown")); + if ( cmd == 0xf) + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_const(ext_cmd, ext_cmd_string, "Unknown")); - } if (tree) { ti = proto_tree_add_item(tree, proto_wcp, tvb, 0, wcp_header_len, ENC_NA); diff --git a/epan/dissectors/packet-who.c b/epan/dissectors/packet-who.c index 00c0681315..d047cf8f0d 100644 --- a/epan/dissectors/packet-who.c +++ b/epan/dissectors/packet-who.c @@ -158,8 +158,7 @@ dissect_who(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 4; /* Summary information */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %.02f %.02f %.02f", + col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %.02f %.02f %.02f", server_name, loadav_5, loadav_10, loadav_15); if (tree) { diff --git a/epan/dissectors/packet-wlccp.c b/epan/dissectors/packet-wlccp.c index 759b0588e8..8f5af6844b 100644 --- a/epan/dissectors/packet-wlccp.c +++ b/epan/dissectors/packet-wlccp.c @@ -707,93 +707,81 @@ dissect_wlccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLCCP"); - if (check_col(pinfo->cinfo, COL_INFO)) + if(tvb_get_guint8(tvb, 0) == 0xC1) /* Get the version number */ { - if(tvb_get_guint8(tvb, 0) == 0xC1) /* Get the version number */ - { - sap_id = tvb_get_guint8(tvb,1) & SAP_VALUE_MASK; - base_message_type=(tvb_get_guint8(tvb,6)) & MT_BASE_MSG_TYPE; - message_sub_type=(tvb_get_guint8(tvb, 6) & MT_SUBTYPE ) >> 6; + sap_id = tvb_get_guint8(tvb,1) & SAP_VALUE_MASK; + base_message_type=(tvb_get_guint8(tvb,6)) & MT_BASE_MSG_TYPE; + message_sub_type=(tvb_get_guint8(tvb, 6) & MT_SUBTYPE ) >> 6; - switch (sap_id) - { + switch (sap_id) + { - case WLCCP_SAP_CCM: - { + case WLCCP_SAP_CCM: + { - col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", val_to_str_const(base_message_type, wlccp_msg_type_vs_0, "Unknown"), - val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown") - ); - break; + val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown")); + break; - } /* case WLCCP_SAP_CCM */ + } /* case WLCCP_SAP_CCM */ - case WLCCP_SAP_SEC: - { + case WLCCP_SAP_SEC: + { - col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", + col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", val_to_str_const(base_message_type, wlccp_msg_type_vs_1, "Unknown"), - val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown") - ); - break; - } /* case WLCCP_SAP_SEC */ + val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown")); + break; + } /* case WLCCP_SAP_SEC */ - case WLCCP_SAP_RRM: - { - col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", + case WLCCP_SAP_RRM: + { + col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", val_to_str_const(base_message_type, wlccp_msg_type_vs_2, "Unknown"), - val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown") - ); - break; + val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown")); + break; - } /* case WLCCP_SAP_RRM */ + } /* case WLCCP_SAP_RRM */ - case WLCCP_SAP_QOS: - { - col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", + case WLCCP_SAP_QOS: + { + col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", val_to_str_const(base_message_type, wlccp_msg_type_vs_3, "Unknown"), - val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown") - ); - break; - } /* case WLCCP_SAP_QOS */ + val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown")); + break; + } /* case WLCCP_SAP_QOS */ - case WLCCP_SAP_NM: - { - col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", + case WLCCP_SAP_NM: + { + col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", val_to_str_const(base_message_type, wlccp_msg_type_vs_4, "Unknown"), - val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown") - ); - break; + val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown")); + break; - } /* case WLCCP_SAP_NM */ + } /* case WLCCP_SAP_NM */ - case WLCCP_SAP_MIP: - { - col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", + case WLCCP_SAP_MIP: + { + col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", val_to_str_const(base_message_type, wlccp_msg_type_vs_5, "Unknown"), - val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown") - ); - break; - } /* case WLCCP_SAP_MIP */ - - default: - { - col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", - "Unknown", - val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown") - ); - break; - } /* default for switch sap */ + val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown")); + break; + } /* case WLCCP_SAP_MIP */ + default: + { + col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %-27s SubType: %s", "Unknown", + val_to_str_const(message_sub_type, wlccp_subtype_vs, "Unknown")); + break; + } /* default for switch sap */ - } /* switch sap */ - } /* if version=0xC1 (tvb_get_guint8(tvb, 0) == 0xC1)*/ + } /* switch sap */ - } /* if check_col */ + } /* if version=0xC1 (tvb_get_guint8(tvb, 0) == 0xC1)*/ if (tree) { /* create display subtree for the protocol */ diff --git a/epan/dissectors/packet-wow.c b/epan/dissectors/packet-wow.c index 5da5c63742..6b71ec0b0f 100644 --- a/epan/dissectors/packet-wow.c +++ b/epan/dissectors/packet-wow.c @@ -205,11 +205,9 @@ dissect_wow_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) cmd = tvb_get_guint8(tvb, offset); - if(check_col(pinfo->cinfo, COL_INFO)) { - col_set_str(pinfo->cinfo, COL_INFO, + col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(cmd, cmd_vs, "Unrecognized packet type")); - } if(tree) { ti = proto_tree_add_item(tree, proto_wow, tvb, 0, -1, ENC_NA); diff --git a/epan/dissectors/packet-wps.c b/epan/dissectors/packet-wps.c index 83ea4526f4..2db161812e 100644 --- a/epan/dissectors/packet-wps.c +++ b/epan/dissectors/packet-wps.c @@ -1153,7 +1153,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, case WPS_TLV_TYPE_MESSAGE_TYPE: tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_message_type, tvb, offset+4, 1, ENC_BIG_ENDIAN); hfindex = hf_eapwps_tlv_message_type; - if ((pinfo != NULL) && check_col(pinfo->cinfo, COL_INFO)) + if ((pinfo != NULL)) col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(tvb_get_guint8(tvb, offset+4), eapwps_tlv_message_type_vals, "Unknown (0x%02x)")); @@ -1674,7 +1674,7 @@ dissect_exteap_wps(proto_tree *eap_tree, tvbuff_t *tvb, int offset, pi = proto_item_get_parent(pi); if (pi != NULL) proto_item_append_text(pi, " (Wifi Alliance, WifiProtectedSetup)"); - if ((pinfo != NULL) && (check_col(pinfo->cinfo, COL_INFO))) + if (pinfo != NULL) col_append_fstr(pinfo->cinfo, COL_INFO, ", WPS"); diff --git a/epan/dissectors/packet-wtls.c b/epan/dissectors/packet-wtls.c index df79c656e6..86770526b9 100644 --- a/epan/dissectors/packet-wtls.c +++ b/epan/dissectors/packet-wtls.c @@ -331,17 +331,14 @@ dissect_wtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *wtls_rec_tree; proto_tree *wtls_msg_type_tree; - if (check_col(pinfo->cinfo, COL_PROTOCOL)) + switch ( pinfo->match_uint ) { - switch ( pinfo->match_uint ) - { - case UDP_PORT_WTLS_WSP: - col_set_str(pinfo->cinfo, COL_PROTOCOL, "WTLS+WSP" ); - break; - case UDP_PORT_WTLS_WTP_WSP: - col_set_str(pinfo->cinfo, COL_PROTOCOL, "WTLS+WTP+WSP" ); - break; - } + case UDP_PORT_WTLS_WSP: + col_set_str(pinfo->cinfo, COL_PROTOCOL, "WTLS+WSP" ); + break; + case UDP_PORT_WTLS_WTP_WSP: + col_set_str(pinfo->cinfo, COL_PROTOCOL, "WTLS+WTP+WSP" ); + break; } /* Develop the string to put in the Info column */ |