From 0ef1d941ea971fc4367b97ca7e7ab7a2ee9e9b88 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Tue, 14 Jun 2016 11:55:08 -0400 Subject: [PATCH] Allow control of individual columns to be (un)writable. Most protocols just want to limit COL_INFO or COL_PROTOCOL so give that level of granularity. Bug: 12144 Bug: 5117 Bug: 11144 Change-Id: I8de9b7d2c69e90d3fbfc0a52c2bd78c3de58e2f8 Reviewed-on: https://code.wireshark.org/review/15894 Reviewed-by: Jeff Morriss Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/column-info.h | 1 + epan/column-utils.c | 47 +++++++++++++++---- epan/column-utils.h | 6 ++- .../asn1/lte-rrc/packet-lte-rrc-template.c | 4 +- epan/dissectors/asn1/s1ap/s1ap.cnf | 4 +- epan/dissectors/packet-artnet.c | 18 +++---- epan/dissectors/packet-bacapp.c | 40 +++++++--------- epan/dissectors/packet-diameter.c | 9 ++-- epan/dissectors/packet-enip.c | 6 +-- epan/dissectors/packet-etch.c | 2 - epan/dissectors/packet-gsm_a_gm.c | 4 +- epan/dissectors/packet-gsm_sms_ud.c | 6 +-- epan/dissectors/packet-ipsec.c | 2 +- epan/dissectors/packet-jxta.c | 4 +- epan/dissectors/packet-knet.c | 8 ---- epan/dissectors/packet-lte-rrc.c | 4 +- epan/dissectors/packet-mac-lte.c | 8 ++-- epan/dissectors/packet-mint.c | 4 +- epan/dissectors/packet-msdp.c | 2 +- epan/dissectors/packet-ndmp.c | 11 +++-- epan/dissectors/packet-openflow_v1.c | 2 +- epan/dissectors/packet-openflow_v4.c | 12 ++--- epan/dissectors/packet-openflow_v5.c | 12 ++--- epan/dissectors/packet-pdcp-lte.c | 20 ++++---- epan/dissectors/packet-pim.c | 4 +- epan/dissectors/packet-portmap.c | 6 +-- epan/dissectors/packet-radius.c | 6 +-- epan/dissectors/packet-rlc.c | 4 +- epan/dissectors/packet-rtsp.c | 6 +-- epan/dissectors/packet-s1ap.c | 4 +- epan/dissectors/packet-sctp.c | 4 +- epan/dissectors/packet-sflow.c | 6 +-- epan/dissectors/packet-ssl.c | 7 +-- epan/dissectors/packet-tcp.c | 11 ++--- epan/dissectors/packet-wassp.c | 8 ++-- epan/dissectors/packet-zbee-zcl-general.c | 6 +-- epan/packet.c | 8 ++-- plugins/wimaxasncp/packet-wimaxasncp.c | 6 +-- ui/cli/tap-protocolinfo.c | 2 +- 39 files changed, 167 insertions(+), 157 deletions(-) diff --git a/epan/column-info.h b/epan/column-info.h index cca684e83a..4fe638ca06 100644 --- a/epan/column-info.h +++ b/epan/column-info.h @@ -56,6 +56,7 @@ typedef struct { const gchar *col_data; /**< Column data */ gchar *col_buf; /**< Buffer into which to copy data for column */ int col_fence; /**< Stuff in column buffer before this index is immutable */ + gboolean writable; /**< writable or not */ } col_item_t; /** Column info */ diff --git a/epan/column-utils.c b/epan/column-utils.c index 846c177c6b..bbff48a21e 100644 --- a/epan/column-utils.c +++ b/epan/column-utils.c @@ -138,6 +138,7 @@ col_init(column_info *cinfo, const struct epan_session *epan) col_item->col_buf[0] = '\0'; col_item->col_data = col_item->col_buf; col_item->col_fence = 0; + col_item->writable = TRUE; cinfo->col_expr.col_expr[i] = ""; cinfo->col_expr.col_expr_val[i][0] = '\0'; } @@ -145,25 +146,55 @@ col_init(column_info *cinfo, const struct epan_session *epan) cinfo->epan = epan; } -#define COL_GET_WRITABLE(cinfo) (cinfo ? cinfo->writable : FALSE) - gboolean -col_get_writable(column_info *cinfo) +col_get_writable(column_info *cinfo, const gint col) { - return COL_GET_WRITABLE(cinfo); + int i; + col_item_t* col_item; + + if (cinfo == NULL) + return FALSE; + + /* "global" (not) writeability will always override + an individual column */ + if ((col == -1) || (cinfo->writable == FALSE)) + return cinfo->writable; + + if (cinfo->col_first[col] >= 0) { + for (i = cinfo->col_first[col]; i <= cinfo->col_last[col]; i++) { + col_item = &cinfo->columns[i]; + if (col_item->fmt_matx[col]) { + return col_item->writable; + } + } + } + return FALSE; } void -col_set_writable(column_info *cinfo, const gboolean writable) +col_set_writable(column_info *cinfo, const gint col, const gboolean writable) { - if (cinfo) - cinfo->writable = writable; + int i; + col_item_t* col_item; + + if (cinfo) { + if (col == -1) { + cinfo->writable = writable; + } else if (cinfo->col_first[col] >= 0) { + for (i = cinfo->col_first[col]; i <= cinfo->col_last[col]; i++) { + col_item = &cinfo->columns[i]; + if (col_item->fmt_matx[col]) { + col_item->writable = writable; + } + } + } + } } /* Checks to see if a particular packet information element is needed for the packet list */ #define CHECK_COL(cinfo, el) \ /* We are constructing columns, and they're writable */ \ - (COL_GET_WRITABLE(cinfo) && \ + (col_get_writable(cinfo, el) && \ /* There is at least one column in that format */ \ ((cinfo)->col_first[el] >= 0)) diff --git a/epan/column-utils.h b/epan/column-utils.h index c51397a008..2da28d78ad 100644 --- a/epan/column-utils.h +++ b/epan/column-utils.h @@ -149,16 +149,18 @@ WS_DLL_PUBLIC void col_fill_in_error(column_info *cinfo, frame_data *fdata, cons /** Are the columns writable? * * @param cinfo the current packet row + * @param col the writable column, -1 for checking the state of all columns * @return TRUE if it's writable, FALSE if not */ -WS_DLL_PUBLIC gboolean col_get_writable(column_info *cinfo); +WS_DLL_PUBLIC gboolean col_get_writable(column_info *cinfo, const gint col); /** Set the columns writable. * * @param cinfo the current packet row + * @param col the column to set, -1 for all * @param writable TRUE if it's writable, FALSE if not */ -WS_DLL_PUBLIC void col_set_writable(column_info *cinfo, const gboolean writable); +WS_DLL_PUBLIC void col_set_writable(column_info *cinfo, const gint col, const gboolean writable); /** Sets a fence for the current column content, * so this content won't be affected by further col_... function calls. diff --git a/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c b/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c index 0a57bc4a86..7917f64599 100644 --- a/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c +++ b/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c @@ -3007,13 +3007,13 @@ dissect_lte_rrc_Handover_Preparation_Info(tvbuff_t *tvb, packet_info *pinfo, pro /* Don't want elements inside message updating Info column, so set now and freeze during dissection of PDU */ col_set_str(pinfo->cinfo, COL_INFO, "HandoverPreparationInformation"); - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); ti = proto_tree_add_item(tree, proto_lte_rrc, tvb, 0, -1, ENC_NA); lte_rrc_tree = proto_item_add_subtree(ti, ett_lte_rrc); dissect_lte_rrc_HandoverPreparationInformation_PDU(tvb, pinfo, lte_rrc_tree, NULL); - col_set_writable(pinfo->cinfo, TRUE); + col_set_writable(pinfo->cinfo, COL_INFO, TRUE); return tvb_captured_length(tvb); } diff --git a/epan/dissectors/asn1/s1ap/s1ap.cnf b/epan/dissectors/asn1/s1ap/s1ap.cnf index 18cca77d30..777c6712bd 100644 --- a/epan/dissectors/asn1/s1ap/s1ap.cnf +++ b/epan/dissectors/asn1/s1ap/s1ap.cnf @@ -333,7 +333,7 @@ tvbuff_t *parameter_tvb=NULL; if (g_s1ap_dissect_container) { /* Don't want elements inside container to write to info column */ - col_set_writable(actx->pinfo->cinfo, FALSE); + col_set_writable(actx->pinfo->cinfo, COL_INFO, FALSE); subtree = proto_item_add_subtree(actx->created_item, ett_s1ap_ToTargetTransparentContainer); switch(handover_type_value){ @@ -378,7 +378,7 @@ tvbuff_t *parameter_tvb=NULL; break; } /* Enable writing of the column again */ - col_set_writable(actx->pinfo->cinfo, TRUE); + col_set_writable(actx->pinfo->cinfo, COL_INFO, TRUE); } #.FN_BODY Target-ToSource-TransparentContainer VAL_PTR = ¶meter_tvb # I think the message is "directly encoded" into the octet string(no "double encoding") diff --git a/epan/dissectors/packet-artnet.c b/epan/dissectors/packet-artnet.c index 381aff1e9e..2723a111a8 100644 --- a/epan/dissectors/packet-artnet.c +++ b/epan/dissectors/packet-artnet.c @@ -2317,15 +2317,14 @@ dissect_artnet_output(tvbuff_t *tvb, guint offset, proto_tree *tree, packet_info size = tvb_reported_length_remaining(tvb, offset); - save_info = col_get_writable(pinfo->cinfo); - col_set_writable(pinfo->cinfo, FALSE); + save_info = col_get_writable(pinfo->cinfo, COL_INFO); + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); next_tvb = tvb_new_subset_length(tvb, offset, length); - /* XXX: Assumption: OK to call dmx-chan dissector under 'if (tree)' */ call_dissector(dmx_chan_handle, next_tvb, pinfo, base_tree); - col_set_writable(pinfo->cinfo, save_info); + col_set_writable(pinfo->cinfo, COL_INFO, save_info); return offset + size; } @@ -2813,15 +2812,14 @@ dissect_artnet_rdm(tvbuff_t *tvb, guint offset, proto_tree *tree, packet_info * size = tvb_reported_length_remaining(tvb, offset); - save_info = col_get_writable(pinfo->cinfo); - col_set_writable(pinfo->cinfo, FALSE); + save_info = col_get_writable(pinfo->cinfo, COL_INFO); + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); next_tvb = tvb_new_subset_remaining(tvb, offset); - /* XXX: Assumption: OK to call rdm dissector under 'if (tree)' */ call_dissector(rdm_handle, next_tvb, pinfo, base_tree); - col_set_writable(pinfo->cinfo, save_info); + col_set_writable(pinfo->cinfo, COL_INFO, save_info); return offset + size; } @@ -3322,7 +3320,6 @@ dissect_artnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ break; case ARTNET_OP_OUTPUT: - if (tree) { hi = proto_tree_add_item(artnet_tree, hf_artnet_output, tvb, @@ -3336,7 +3333,6 @@ dissect_artnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ size -= offset; proto_item_set_len(si, size ); offset += size; - } break; @@ -3435,7 +3431,6 @@ dissect_artnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ break; case ARTNET_OP_RDM: - if (tree) { hi = proto_tree_add_item(artnet_tree, hf_artnet_rdm, tvb, @@ -3448,7 +3443,6 @@ dissect_artnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ proto_item_set_len( si, size ); offset += size; - } break; case ARTNET_OP_RDM_SUB: diff --git a/epan/dissectors/packet-bacapp.c b/epan/dissectors/packet-bacapp.c index 33517c7894..e483496dd9 100644 --- a/epan/dissectors/packet-bacapp.c +++ b/epan/dissectors/packet-bacapp.c @@ -5991,8 +5991,7 @@ fObjectIdentifier(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off Vendor_Proprietary_Fmt), object_id_instance(object_id)); - if (col_get_writable(pinfo->cinfo)) - col_append_fstr(pinfo->cinfo, COL_INFO, "%s,%u ", + col_append_fstr(pinfo->cinfo, COL_INFO, "%s,%u ", val_to_split_str(object_type, 128, BACnetObjectType, @@ -6255,8 +6254,7 @@ fPropertyIdentifier(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint o BACnetPropertyIdentifier, ASHRAE_Reserved_Fmt, Vendor_Proprietary_Fmt), propertyIdentifier); - if (col_get_writable(pinfo->cinfo)) - col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", + col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_split_str(propertyIdentifier, 512, BACnetPropertyIdentifier, ASHRAE_Reserved_Fmt, @@ -7390,8 +7388,7 @@ fConfirmedPrivateTransferRequest(tvbuff_t *tvb, packet_info *pinfo, proto_tree * len = fTagHeader(tvb, pinfo, offset, &tag_no, &tag_info, &lvt); fUnsigned32(tvb, offset+len, lvt, &vendor_identifier); - if (col_get_writable(pinfo->cinfo)) - col_append_fstr(pinfo->cinfo, COL_INFO, "V=%u ", vendor_identifier); + col_append_fstr(pinfo->cinfo, COL_INFO, "V=%u ", vendor_identifier); offset = fVendorIdentifier(tvb, pinfo, subtree, offset); next_tvb = tvb_new_subset_remaining(tvb, offset); @@ -7422,8 +7419,7 @@ fConfirmedPrivateTransferRequest(tvbuff_t *tvb, packet_info *pinfo, proto_tree * /* vendorID is now parsed above */ case 1: /* serviceNumber */ fUnsigned32(tvb, offset+len, lvt, &service_number); - if (col_get_writable(pinfo->cinfo)) - col_append_fstr(pinfo->cinfo, COL_INFO, "SN=%u ", service_number); + col_append_fstr(pinfo->cinfo, COL_INFO, "SN=%u ", service_number); offset = fUnsignedTag(tvb, pinfo, subtree, offset, "service Number: "); break; case 2: /*serviceParameters */ @@ -9124,7 +9120,7 @@ fLOPR(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) guint8 tag_no, tag_info; guint32 lvt; - col_set_writable(pinfo->cinfo, FALSE); /* don't set all infos into INFO column */ + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); /* don't set all infos into INFO column */ while (tvb_reported_length_remaining(tvb, offset) > 0) { /* exit loop if nothing happens inside */ lastoffset = offset; fTagHeader(tvb, pinfo, offset, &tag_no, &tag_info, &lvt); @@ -9172,7 +9168,7 @@ fAddListElementRequest(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guin guint32 lvt; proto_tree *subtree = tree; - col_set_writable(pinfo->cinfo, FALSE); /* don't set all infos into INFO column */ + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); /* don't set all infos into INFO column */ while (tvb_reported_length_remaining(tvb, offset) > 0) { /* exit loop if nothing happens inside */ lastoffset = offset; @@ -9503,7 +9499,7 @@ fWritePropertyMultipleRequest(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre if (offset >= tvb_reported_length(tvb)) return offset; - col_set_writable(pinfo->cinfo, FALSE); /* don't set all infos into INFO column */ + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); /* don't set all infos into INFO column */ return fWriteAccessSpecification(tvb, pinfo, tree, offset); } @@ -9543,7 +9539,7 @@ fPropertyReference(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint of static guint fBACnetPropertyReference(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, guint8 list) { - col_set_writable(pinfo->cinfo, FALSE); /* don't set all infos into INFO column */ + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); /* don't set all infos into INFO column */ return fPropertyReference(tvb, pinfo, tree, offset, 0, list); } @@ -9561,7 +9557,7 @@ fBACnetObjectPropertyReference(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr break; case 1: /* PropertyIdentifier and propertyArrayIndex */ offset = fPropertyReference(tvb, pinfo, tree, offset, 1, 0); - col_set_writable(pinfo->cinfo, FALSE); /* don't set all infos into INFO column */ + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); /* don't set all infos into INFO column */ default: lastoffset = offset; /* Set loop end condition */ break; @@ -10034,7 +10030,7 @@ fReadRangeAck(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) /* itemData */ fTagHeader(tvb, pinfo, offset, &tag_no, &tag_info, &lvt); if (tag_is_opening(tag_info)) { - col_set_writable(pinfo->cinfo, FALSE); /* don't set all infos into INFO column */ + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); /* don't set all infos into INFO column */ subtree = proto_tree_add_subtree(subtree, tvb, offset, 1, ett_bacapp_value, NULL, "itemData"); offset += fTagHeaderTree(tvb, pinfo, subtree, offset, &tag_no, &tag_info, &lvt); offset = fAbstractSyntaxNType(tvb, pinfo, subtree, offset); @@ -10135,14 +10131,14 @@ fAtomicReadFileAck(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint of static guint fReadPropertyMultipleRequest(tvbuff_t *tvb, packet_info *pinfo, proto_tree *subtree, guint offset) { - col_set_writable(pinfo->cinfo, FALSE); /* don't set all infos into INFO column */ + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); /* don't set all infos into INFO column */ return fReadAccessSpecification(tvb, pinfo, subtree, offset); } static guint fReadPropertyMultipleAck(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) { - col_set_writable(pinfo->cinfo, FALSE); /* don't set all infos into INFO column */ + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); /* don't set all infos into INFO column */ return fReadAccessResult(tvb, pinfo, tree, offset); } @@ -10352,7 +10348,7 @@ fWhoIsRequest(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint offset) switch (tag_no) { case 0: /* DeviceInstanceRangeLowLimit Optional */ - if (col_get_writable(pinfo->cinfo) && fUnsigned32(tvb, offset+tag_len, lvt, &val)) + if (fUnsigned32(tvb, offset+tag_len, lvt, &val)) col_append_fstr(pinfo->cinfo, COL_INFO, "%d ", val); offset = fDevice_Instance(tvb, pinfo, tree, offset, hf_Device_Instance_Range_Low_Limit); @@ -10360,7 +10356,7 @@ fWhoIsRequest(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint offset) case 1: /* DeviceInstanceRangeHighLimit Optional but required if DeviceInstanceRangeLowLimit is there */ - if (col_get_writable(pinfo->cinfo) && fUnsigned32(tvb, offset+tag_len, lvt, &val)) + if (fUnsigned32(tvb, offset+tag_len, lvt, &val)) col_append_fstr(pinfo->cinfo, COL_INFO, "%d ", val); offset = fDevice_Instance(tvb, pinfo, tree, offset, hf_Device_Instance_Range_High_Limit); @@ -10590,14 +10586,12 @@ fConfirmedPrivateTransferError(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr break; case 1: /* vendorID */ fUnsigned32(tvb, offset+tag_len, lvt, &vendor_identifier); - if (col_get_writable(pinfo->cinfo)) - col_append_fstr(pinfo->cinfo, COL_INFO, "V=%u ", vendor_identifier); + col_append_fstr(pinfo->cinfo, COL_INFO, "V=%u ", vendor_identifier); offset = fVendorIdentifier(tvb, pinfo, subtree, offset); break; case 2: /* serviceNumber */ fUnsigned32(tvb, offset+tag_len, lvt, &service_number); - if (col_get_writable(pinfo->cinfo)) - col_append_fstr(pinfo->cinfo, COL_INFO, "SN=%u ", service_number); + col_append_fstr(pinfo->cinfo, COL_INFO, "SN=%u ", service_number); offset = fUnsignedTag(tvb, pinfo, subtree, offset, "service Number: "); break; case 3: /* errorParameters */ @@ -10680,7 +10674,7 @@ fWritePropertyMultipleError(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 tag_no = 0, tag_info = 0; guint32 lvt = 0; - col_set_writable(pinfo->cinfo, FALSE); /* don't set all infos into INFO column */ + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); /* don't set all infos into INFO column */ while (tvb_reported_length_remaining(tvb, offset) > 0) { /* exit loop if nothing happens inside */ lastoffset = offset; switch (fTagNo(tvb, offset)) { diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index 45ff749036..7bfa12c15e 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -447,12 +447,12 @@ dissect_diameter_eap_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree gboolean save_writable; /* Ensure the packet is displayed as Diameter, not EAP */ - save_writable = col_get_writable(pinfo->cinfo); - col_set_writable(pinfo->cinfo, FALSE); + save_writable = col_get_writable(pinfo->cinfo, COL_PROTOCOL); + col_set_writable(pinfo->cinfo, COL_PROTOCOL, FALSE); call_dissector(eap_handle, tvb, pinfo, tree); - col_set_writable(pinfo->cinfo, save_writable); + col_set_writable(pinfo->cinfo, COL_PROTOCOL, save_writable); return tvb_reported_length(tvb); } @@ -877,7 +877,8 @@ proto_avp(diam_ctx_t *c, diam_avp_t *a, tvbuff_t *tvb, diam_sub_dis_t *diam_sub_ { proto_avp_t *t = (proto_avp_t *)a->type_data; - col_set_writable(c->pinfo->cinfo, FALSE); + col_set_writable(c->pinfo->cinfo, COL_PROTOCOL, FALSE); + col_set_writable(c->pinfo->cinfo, COL_INFO, FALSE); if (!t->handle) { t->handle = find_dissector(t->name); diff --git a/epan/dissectors/packet-enip.c b/epan/dissectors/packet-enip.c index 4efe8c24e4..dce48f2275 100644 --- a/epan/dissectors/packet-enip.c +++ b/epan/dissectors/packet-enip.c @@ -1513,13 +1513,13 @@ dissect_tcpip_last_conflict(packet_info *pinfo, proto_tree *tree, proto_item *it else { /* Dissect ARP PDU, but don't have it change column info */ - save_info = col_get_writable(pinfo->cinfo); - col_set_writable(pinfo->cinfo, FALSE); + save_info = col_get_writable(pinfo->cinfo, -1); + col_set_writable(pinfo->cinfo, -1, FALSE); next_tvb = tvb_new_subset_length(tvb, offset+7, 28); call_dissector(arp_handle, next_tvb, pinfo, tree); - col_set_writable(pinfo->cinfo, save_info); + col_set_writable(pinfo->cinfo, -1, save_info); } return 35; diff --git a/epan/dissectors/packet-etch.c b/epan/dissectors/packet-etch.c index 80714d6dcb..76c380b83c 100644 --- a/epan/dissectors/packet-etch.c +++ b/epan/dissectors/packet-etch.c @@ -729,7 +729,6 @@ dissect_etch_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* } gbl_old_frame_num = pinfo->num; - col_set_writable(pinfo->cinfo, TRUE); col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", wmem_strbuf_get_str(colInfo)); } @@ -785,7 +784,6 @@ dissect_etch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) dissect_etch_message, data); if (gbl_pdu_counter > 0) { - col_set_writable(pinfo->cinfo, TRUE); col_prepend_fstr(pinfo->cinfo, COL_INFO, "[%d] ", gbl_pdu_counter + 1); } diff --git a/epan/dissectors/packet-gsm_a_gm.c b/epan/dissectors/packet-gsm_a_gm.c index efeb71102d..c093fa0113 100644 --- a/epan/dissectors/packet-gsm_a_gm.c +++ b/epan/dissectors/packet-gsm_a_gm.c @@ -4313,9 +4313,9 @@ de_sm_pco(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, g * dissect the embedded message */ /* In this case we do not want the columns updated */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); call_dissector(handle, l3_tvb, pinfo, pco_tree); - col_set_writable(pinfo->cinfo, TRUE); + col_set_writable(pinfo->cinfo, -1, TRUE); } else { diff --git a/epan/dissectors/packet-gsm_sms_ud.c b/epan/dissectors/packet-gsm_sms_ud.c index 3efc54e37e..d98b3c364e 100644 --- a/epan/dissectors/packet-gsm_sms_ud.c +++ b/epan/dissectors/packet-gsm_sms_ud.c @@ -458,9 +458,9 @@ parse_gsm_sms_ud_message(proto_tree *sm_tree, tvbuff_t *tvb, packet_info *pinfo, if (ports_available) { gboolean disallow_write = FALSE; /* TRUE if we changed writability of the columns of the summary */ - if (prevent_subdissectors_changing_columns && col_get_writable(pinfo->cinfo)) { + if (prevent_subdissectors_changing_columns && col_get_writable(pinfo->cinfo, -1)) { disallow_write = TRUE; - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); } if (port_number_udh_means_wsp) { @@ -478,7 +478,7 @@ parse_gsm_sms_ud_message(proto_tree *sm_tree, tvbuff_t *tvb, packet_info *pinfo, } if (disallow_write) - col_set_writable(pinfo->cinfo, TRUE); + col_set_writable(pinfo->cinfo, -1, TRUE); } else { /* No ports IE */ proto_tree_add_item(sm_tree, hf_gsm_sms_ud_short_msg, sm_tvb, 0, -1, ENC_NA); } diff --git a/epan/dissectors/packet-ipsec.c b/epan/dissectors/packet-ipsec.c index a9b8d25df9..8643c92957 100644 --- a/epan/dissectors/packet-ipsec.c +++ b/epan/dissectors/packet-ipsec.c @@ -1202,7 +1202,7 @@ dissect_ah(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) next_tvb = tvb_new_subset_remaining(tvb, advance); if (g_ah_payload_in_subtree) { - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); } /* do lookup with the subdissector table */ diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c index 465c18ff62..65379a447a 100644 --- a/epan/dissectors/packet-jxta.c +++ b/epan/dissectors/packet-jxta.c @@ -1006,7 +1006,7 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree Common_Exit: g_strfreev(tokens); - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); return afterwelcome; } @@ -1363,7 +1363,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree wmem_strbuf_get_str(src_addr), wmem_strbuf_get_str(dst_addr)); } - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); while( tree && (complete_messages > 0) ) { proto_item *jxta_msg_tree_item = NULL; diff --git a/epan/dissectors/packet-knet.c b/epan/dissectors/packet-knet.c index dc8f127ad8..6640a7a1a6 100644 --- a/epan/dissectors/packet-knet.c +++ b/epan/dissectors/packet-knet.c @@ -353,7 +353,6 @@ dissect_messageid(tvbuff_t *buffer, int *offset, proto_tree *tree, packet_info * { gint messageid_length; guint8 messageid; - gboolean col_write; messageid = tvb_get_guint8(buffer, (*offset)); @@ -374,16 +373,9 @@ dissect_messageid(tvbuff_t *buffer, int *offset, proto_tree *tree, packet_info * proto_tree_add_uint_format_value(tree, hf_knet_messageid, buffer, *offset, messageid_length, messageid, "%s (%d)", val_to_str_const(messageid, packettypenames, "AppData or Malformed Message ID"), messageid); - /* XXX - TCP reassembly disables writing columns which prevents populating COL_INFO if multiple KNET messages - appear in a single packet that needed to be reassembled. - Force making columns writable. - */ if (separator) { - col_write = col_get_writable(pinfo->cinfo); - col_set_writable(pinfo->cinfo, TRUE); col_append_sep_fstr(pinfo->cinfo, COL_INFO, ", ", "%s (%d)", val_to_str_const(messageid, packettypenames, "AppData"), messageid); - col_set_writable(pinfo->cinfo, col_write); } else { diff --git a/epan/dissectors/packet-lte-rrc.c b/epan/dissectors/packet-lte-rrc.c index db0990ce7f..0b6dc9c8cf 100644 --- a/epan/dissectors/packet-lte-rrc.c +++ b/epan/dissectors/packet-lte-rrc.c @@ -59287,13 +59287,13 @@ dissect_lte_rrc_Handover_Preparation_Info(tvbuff_t *tvb, packet_info *pinfo, pro /* Don't want elements inside message updating Info column, so set now and freeze during dissection of PDU */ col_set_str(pinfo->cinfo, COL_INFO, "HandoverPreparationInformation"); - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); ti = proto_tree_add_item(tree, proto_lte_rrc, tvb, 0, -1, ENC_NA); lte_rrc_tree = proto_item_add_subtree(ti, ett_lte_rrc); dissect_lte_rrc_HandoverPreparationInformation_PDU(tvb, pinfo, lte_rrc_tree, NULL); - col_set_writable(pinfo->cinfo, TRUE); + col_set_writable(pinfo->cinfo, COL_INFO, TRUE); return tvb_captured_length(tvb); } diff --git a/epan/dissectors/packet-mac-lte.c b/epan/dissectors/packet-mac-lte.c index 6525867655..d499b4ce73 100644 --- a/epan/dissectors/packet-mac-lte.c +++ b/epan/dissectors/packet-mac-lte.c @@ -2583,7 +2583,7 @@ static void show_extra_phy_parameters(packet_info *pinfo, tvbuff_t *tvb, proto_t /* Don't want columns to be replaced now */ if (global_mac_lte_layer_to_show == ShowPHYLayer) { - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); } } } @@ -2670,7 +2670,7 @@ static void show_extra_phy_parameters(packet_info *pinfo, tvbuff_t *tvb, proto_t /* Don't want columns to be replaced now */ if (global_mac_lte_layer_to_show == ShowPHYLayer) { - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); } } } @@ -3169,7 +3169,7 @@ static void call_rlc_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if (global_mac_lte_layer_to_show != ShowRLCLayer) { /* Don't want these columns replaced */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); } else { /* Clear info column before first RLC PDU */ @@ -3188,7 +3188,7 @@ static void call_rlc_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr call_with_catch_all(rlc_lte_handle, rb_tvb, pinfo, tree); /* Let columns be written to again */ - col_set_writable(pinfo->cinfo, TRUE); + col_set_writable(pinfo->cinfo, -1, TRUE); } diff --git a/epan/dissectors/packet-mint.c b/epan/dissectors/packet-mint.c index 8c3b34c68a..32cc2d2f4f 100644 --- a/epan/dissectors/packet-mint.c +++ b/epan/dissectors/packet-mint.c @@ -284,7 +284,7 @@ dissect_eth_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mint_tree, tvbuff_t *eth_tvb; #ifdef MINT_DEVELOPMENT - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); #endif eth_tvb = tvb_new_subset_length(tvb, offset, length); @@ -297,7 +297,7 @@ dissect_eth_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mint_tree, offset += length; #ifdef MINT_DEVELOPMENT - col_set_writable(pinfo->cinfo, TRUE); + col_set_writable(pinfo->cinfo, -1, TRUE); #endif return offset; } diff --git a/epan/dissectors/packet-msdp.c b/epan/dissectors/packet-msdp.c index 9a76c31d28..081c6cde24 100644 --- a/epan/dissectors/packet-msdp.c +++ b/epan/dissectors/packet-msdp.c @@ -316,7 +316,7 @@ static void dissect_msdp_sa(tvbuff_t *tvb, packet_info *pinfo, * reflect the MSDP packet rather than the * encapsulated packet. */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); call_dissector(ip_handle, next_tvb, pinfo, enc_tree); } *offset += length; diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c index 1fe64719d2..f3f0d4600d 100644 --- a/epan/dissectors/packet-ndmp.c +++ b/epan/dissectors/packet-ndmp.c @@ -2991,7 +2991,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* wmem_map_t *frags; conversation_t *conversation; proto_item *vers_item; - gboolean save_fragmented, save_writable; + gboolean save_fragmented, save_info_writable, save_proto_writable; gboolean do_frag = TRUE; tvbuff_t* new_tvb = NULL; fragment_head *frag_msg = NULL; @@ -3212,8 +3212,10 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* * multiple fragments, the column becomes unwritable. * Temporarily change that so that the correct header can be * applied */ - save_writable = col_get_writable(pinfo->cinfo); - col_set_writable(pinfo->cinfo, TRUE); + save_info_writable = col_get_writable(pinfo->cinfo, COL_INFO); + save_proto_writable = col_get_writable(pinfo->cinfo, COL_PROTOCOL); + col_set_writable(pinfo->cinfo, COL_PROTOCOL, TRUE); + col_set_writable(pinfo->cinfo, COL_INFO, TRUE); col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDMP"); col_clear(pinfo->cinfo, COL_INFO); @@ -3292,7 +3294,8 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* /* restore saved variables */ pinfo->fragmented = save_fragmented; - col_set_writable(pinfo->cinfo, save_writable); + col_set_writable(pinfo->cinfo, COL_INFO, save_info_writable); + col_set_writable(pinfo->cinfo, COL_PROTOCOL, save_proto_writable); return tvb_captured_length(tvb); } diff --git a/epan/dissectors/packet-openflow_v1.c b/epan/dissectors/packet-openflow_v1.c index 41c9bd62df..52f89b83f2 100644 --- a/epan/dissectors/packet-openflow_v1.c +++ b/epan/dissectors/packet-openflow_v1.c @@ -838,7 +838,7 @@ dissect_openflow_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d /* Stop the Ethernet frame from overwriting the columns */ if((type == OFPT_1_0_PACKET_IN) || (type == OFPT_1_0_PACKET_OUT)){ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); } /* Create display subtree for the protocol */ diff --git a/epan/dissectors/packet-openflow_v4.c b/epan/dissectors/packet-openflow_v4.c index 97efeb322e..1d84e6d9f3 100644 --- a/epan/dissectors/packet-openflow_v4.c +++ b/epan/dissectors/packet-openflow_v4.c @@ -1819,7 +1819,7 @@ dissect_openflow_packet_in_v4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree data_tree = proto_tree_add_subtree(tree, tvb, offset, length - offset, ett_openflow_v4_packet_in_data, NULL, "Data"); /* save some state */ - save_writable = col_get_writable(pinfo->cinfo); + save_writable = col_get_writable(pinfo->cinfo, -1); save_in_error_pkt = pinfo->flags.in_error_pkt; copy_address_shallow(&save_dl_src, &pinfo->dl_src); copy_address_shallow(&save_dl_dst, &pinfo->dl_dst); @@ -1829,12 +1829,12 @@ dissect_openflow_packet_in_v4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree copy_address_shallow(&save_dst, &pinfo->dst); /* dissect data */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); next_tvb = tvb_new_subset_length(tvb, offset, length - offset); call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, data_tree); /* restore saved state */ - col_set_writable(pinfo->cinfo, save_writable); + col_set_writable(pinfo->cinfo, -1, save_writable); pinfo->flags.in_error_pkt = save_in_error_pkt; copy_address_shallow(&pinfo->dl_src, &save_dl_src); copy_address_shallow(&pinfo->dl_dst, &save_dl_dst); @@ -2406,7 +2406,7 @@ dissect_openflow_packet_out_v4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree data_tree = proto_tree_add_subtree(tree, tvb, offset, length - offset, ett_openflow_v4_packet_out_data, NULL, "Data"); /* save some state */ - save_writable = col_get_writable(pinfo->cinfo); + save_writable = col_get_writable(pinfo->cinfo, -1); save_in_error_pkt = pinfo->flags.in_error_pkt; copy_address_shallow(&save_dl_src, &pinfo->dl_src); copy_address_shallow(&save_dl_dst, &pinfo->dl_dst); @@ -2416,12 +2416,12 @@ dissect_openflow_packet_out_v4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree copy_address_shallow(&save_dst, &pinfo->dst); /* dissect data */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); next_tvb = tvb_new_subset_length(tvb, offset, length - offset); call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, data_tree); /* restore saved state */ - col_set_writable(pinfo->cinfo, save_writable); + col_set_writable(pinfo->cinfo, -1, save_writable); pinfo->flags.in_error_pkt = save_in_error_pkt; copy_address_shallow(&pinfo->dl_src, &save_dl_src); copy_address_shallow(&pinfo->dl_dst, &save_dl_dst); diff --git a/epan/dissectors/packet-openflow_v5.c b/epan/dissectors/packet-openflow_v5.c index 1822f673c5..cc9d9d4d4e 100644 --- a/epan/dissectors/packet-openflow_v5.c +++ b/epan/dissectors/packet-openflow_v5.c @@ -2049,7 +2049,7 @@ dissect_openflow_packet_in_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree data_tree = proto_tree_add_subtree(tree, tvb, offset, length - offset, ett_openflow_v5_packet_in_data, NULL, "Data"); /* save some state */ - save_writable = col_get_writable(pinfo->cinfo); + save_writable = col_get_writable(pinfo->cinfo, -1); save_in_error_pkt = pinfo->flags.in_error_pkt; copy_address_shallow(&save_dl_src, &pinfo->dl_src); copy_address_shallow(&save_dl_dst, &pinfo->dl_dst); @@ -2059,12 +2059,12 @@ dissect_openflow_packet_in_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree copy_address_shallow(&save_dst, &pinfo->dst); /* dissect data */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); next_tvb = tvb_new_subset_length(tvb, offset, length - offset); call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, data_tree); /* restore saved state */ - col_set_writable(pinfo->cinfo, save_writable); + col_set_writable(pinfo->cinfo, -1, save_writable); pinfo->flags.in_error_pkt = save_in_error_pkt; copy_address_shallow(&pinfo->dl_src, &save_dl_src); copy_address_shallow(&pinfo->dl_dst, &save_dl_dst); @@ -2788,7 +2788,7 @@ dissect_openflow_packet_out_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree data_tree = proto_tree_add_subtree(tree, tvb, offset, length - offset, ett_openflow_v5_packet_out_data, NULL, "Data"); /* save some state */ - save_writable = col_get_writable(pinfo->cinfo); + save_writable = col_get_writable(pinfo->cinfo, -1); save_in_error_pkt = pinfo->flags.in_error_pkt; copy_address_shallow(&save_dl_src, &pinfo->dl_src); copy_address_shallow(&save_dl_dst, &pinfo->dl_dst); @@ -2798,12 +2798,12 @@ dissect_openflow_packet_out_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree copy_address_shallow(&save_dst, &pinfo->dst); /* dissect data */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); next_tvb = tvb_new_subset_length(tvb, offset, length - offset); call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, data_tree); /* restore saved state */ - col_set_writable(pinfo->cinfo, save_writable); + col_set_writable(pinfo->cinfo, -1, save_writable); pinfo->flags.in_error_pkt = save_in_error_pkt; copy_address_shallow(&pinfo->dl_src, &save_dl_src); copy_address_shallow(&pinfo->dl_dst, &save_dl_dst); diff --git a/epan/dissectors/packet-pdcp-lte.c b/epan/dissectors/packet-pdcp-lte.c index b0455bbdac..42da3f239f 100644 --- a/epan/dissectors/packet-pdcp-lte.c +++ b/epan/dissectors/packet-pdcp-lte.c @@ -1740,12 +1740,12 @@ static int dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if ((global_pdcp_lte_layer_to_show == ShowRLCLayer) && (p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc_lte, 0) != NULL)) { - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); } else { /* TODO: won't help with multiple PDCP-or-traffic PDUs / frame... */ col_clear(pinfo->cinfo, COL_INFO); - col_set_writable(pinfo->cinfo, TRUE); + col_set_writable(pinfo->cinfo, COL_INFO, TRUE); } /* Create pdcp tree. */ @@ -2263,15 +2263,15 @@ static int dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (rrc_handle != 0) { /* Call RRC dissector if have one */ tvbuff_t *rrc_payload_tvb = tvb_new_subset_length(payload_tvb, offset, data_length); - gboolean was_writable = col_get_writable(pinfo->cinfo); + gboolean was_writable = col_get_writable(pinfo->cinfo, COL_INFO); /* We always want to see this in the info column */ - col_set_writable(pinfo->cinfo, TRUE); + col_set_writable(pinfo->cinfo, COL_INFO, TRUE); call_dissector_only(rrc_handle, rrc_payload_tvb, pinfo, pdcp_tree, NULL); /* Restore to whatever it was */ - col_set_writable(pinfo->cinfo, was_writable); + col_set_writable(pinfo->cinfo, COL_INFO, was_writable); } else { /* Just show data */ @@ -2338,7 +2338,7 @@ static int dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* Don't update info column for ROHC unless configured to */ if (global_pdcp_lte_layer_to_show != ShowTrafficLayer) { - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); } switch (tvb_get_guint8(ip_payload_tvb, 0) & 0xf0) { @@ -2355,7 +2355,7 @@ static int dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* Freeze the columns again because we don't want other layers writing to info */ if (global_pdcp_lte_layer_to_show == ShowTrafficLayer) { - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); } } @@ -2371,7 +2371,7 @@ static int dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* (there will be no signalling data left at this point) */ /* Let RLC write to columns again */ - col_set_writable(pinfo->cinfo, global_pdcp_lte_layer_to_show == ShowRLCLayer); + col_set_writable(pinfo->cinfo, COL_INFO, global_pdcp_lte_layer_to_show == ShowRLCLayer); /* DROPPING OUT HERE IF NOT DOING ROHC! */ return tvb_captured_length(tvb); @@ -2392,7 +2392,7 @@ static int dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* Only enable writing to column if configured to show ROHC */ if (global_pdcp_lte_layer_to_show != ShowTrafficLayer) { - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); } else { col_clear(pinfo->cinfo, COL_INFO); @@ -2402,7 +2402,7 @@ static int dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, call_dissector_with_data(rohc_handle, rohc_tvb, pinfo, tree, &p_pdcp_info->rohc); /* Let RLC write to columns again */ - col_set_writable(pinfo->cinfo, global_pdcp_lte_layer_to_show == ShowRLCLayer); + col_set_writable(pinfo->cinfo, COL_INFO, global_pdcp_lte_layer_to_show == ShowRLCLayer); } } return tvb_captured_length(tvb); diff --git a/epan/dissectors/packet-pim.c b/epan/dissectors/packet-pim.c index ac0c299c37..f2257dc8c2 100644 --- a/epan/dissectors/packet-pim.c +++ b/epan/dissectors/packet-pim.c @@ -388,7 +388,7 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U * explicitly state that. */ pim_length = 8; - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); } else { /* * Other message - checksum the entire packet. @@ -874,7 +874,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) * this register will overwrite the PIM info in the columns. */ pim_length = 8; - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); } else { /* * Other message - checksum the entire packet. diff --git a/epan/dissectors/packet-portmap.c b/epan/dissectors/packet-portmap.c index 1e578bde2f..e990cc94c0 100644 --- a/epan/dissectors/packet-portmap.c +++ b/epan/dissectors/packet-portmap.c @@ -304,7 +304,7 @@ dissect_callit_call(tvbuff_t *tvb, packet_info *pinfo, /* Dissect the arguments for this procedure. Make the columns non-writable, so the dissector won't change them out from under us. */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); offset = dissect_rpc_indir_call(tvb, pinfo, tree, offset, hf_portmap_args, prog, vers, proc); @@ -325,7 +325,7 @@ dissect_callit_reply(tvbuff_t *tvb, packet_info *pinfo, /* Dissect the result of this procedure. Make the columns non-writable, so the dissector won't change them out from under us. */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); offset = dissect_rpc_indir_reply(tvb, pinfo, tree, offset, hf_portmap_result, hf_portmap_prog, hf_portmap_version, hf_portmap_proc); @@ -460,7 +460,7 @@ dissect_rpcb_rmtcallres(tvbuff_t *tvb, packet_info *pinfo _U_, /* Dissect the result of this procedure. Make the columns non-writable, so the dissector won't change them out from under us. */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); offset = dissect_rpc_indir_reply(tvb, pinfo, tree, offset, hf_portmap_result, hf_portmap_prog, hf_portmap_version, hf_portmap_proc); diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index 6202f162e0..c0b1ff5945 100644 --- a/epan/dissectors/packet-radius.c +++ b/epan/dissectors/packet-radius.c @@ -1701,12 +1701,12 @@ dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_t *tv * this as an RADIUS packet, not * as an EAP packet. */ - save_writable = col_get_writable(pinfo->cinfo); - col_set_writable(pinfo->cinfo, FALSE); + save_writable = col_get_writable(pinfo->cinfo, -1); + col_set_writable(pinfo->cinfo, -1, FALSE); call_dissector(eap_handle, eap_tvb, pinfo, eap_tree); - col_set_writable(pinfo->cinfo, save_writable); + col_set_writable(pinfo->cinfo, -1, save_writable); } else { proto_item_append_text(avp_item, " Segment[%u]", eap_seg_num); diff --git a/epan/dissectors/packet-rlc.c b/epan/dissectors/packet-rlc.c index 281e5a3386..e346a9075b 100644 --- a/epan/dissectors/packet-rlc.c +++ b/epan/dissectors/packet-rlc.c @@ -1322,7 +1322,7 @@ rlc_call_subdissector(enum rlc_channel_type channel, tvbuff_t *tvb, /* assume transparent PDCP for now */ call_dissector(ip_handle, tvb, pinfo, tree); /* once the packet has been dissected, protect it from further changes */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); break; default: return; /* stop dissecting */ @@ -1339,7 +1339,7 @@ rlc_call_subdissector(enum rlc_channel_type channel, tvbuff_t *tvb, rrcinf->msgtype[fpinf->cur_tb] = msgtype; call_dissector(rrc_handle, tvb, pinfo, tree); /* once the packet has been dissected, protect it from further changes */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); } } diff --git a/epan/dissectors/packet-rtsp.c b/epan/dissectors/packet-rtsp.c index 27996976c3..6858be26bf 100644 --- a/epan/dissectors/packet-rtsp.c +++ b/epan/dissectors/packet-rtsp.c @@ -1376,10 +1376,10 @@ dissect_rtsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ /* * OK, we've set the Protocol and Info columns for the - * first RTSP message; make the columns non-writable, - * so that we don't change it for subsequent RTSP messages. + * first RTSP message; set fence so changes are kept for + * subsequent RTSP messages. */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_fence(pinfo->cinfo, COL_INFO); } return tvb_captured_length(tvb); } diff --git a/epan/dissectors/packet-s1ap.c b/epan/dissectors/packet-s1ap.c index 3bcc1e484e..93f822f5e4 100644 --- a/epan/dissectors/packet-s1ap.c +++ b/epan/dissectors/packet-s1ap.c @@ -6002,7 +6002,7 @@ dissect_s1ap_Source_ToTarget_TransparentContainer(tvbuff_t *tvb _U_, int offset if (g_s1ap_dissect_container) { /* Don't want elements inside container to write to info column */ - col_set_writable(actx->pinfo->cinfo, FALSE); + col_set_writable(actx->pinfo->cinfo, COL_INFO, FALSE); subtree = proto_item_add_subtree(actx->created_item, ett_s1ap_ToTargetTransparentContainer); switch(handover_type_value){ @@ -6047,7 +6047,7 @@ dissect_s1ap_Source_ToTarget_TransparentContainer(tvbuff_t *tvb _U_, int offset break; } /* Enable writing of the column again */ - col_set_writable(actx->pinfo->cinfo, TRUE); + col_set_writable(actx->pinfo->cinfo, COL_INFO, TRUE); } diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c index 7baf3a9ee0..fb7e32e1ad 100644 --- a/epan/dissectors/packet-sctp.c +++ b/epan/dissectors/packet-sctp.c @@ -4447,9 +4447,9 @@ dissect_sctp_chunk(tvbuff_t *chunk_tvb, dissect_i_forward_tsn_chunk(chunk_tvb, length, chunk_tree, chunk_item); break; case SCTP_PKTDROP_CHUNK_ID: - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); dissect_pktdrop_chunk(chunk_tvb, length, pinfo, chunk_tree, chunk_item, flags_item); - col_set_writable(pinfo->cinfo, TRUE); + col_set_writable(pinfo->cinfo, -1, TRUE); break; case SCTP_PAD_CHUNK_ID: dissect_pad_chunk(chunk_tvb, length, chunk_tree, chunk_item); diff --git a/epan/dissectors/packet-sflow.c b/epan/dissectors/packet-sflow.c index 991f283e8c..6c9206db6f 100644 --- a/epan/dissectors/packet-sflow.c +++ b/epan/dissectors/packet-sflow.c @@ -679,7 +679,7 @@ dissect_sflow_245_sampled_header(tvbuff_t *tvb, packet_info *pinfo, next_tvb = tvb_new_subset(tvb, offset, header_length, frame_length); /* save some state */ - save_writable = col_get_writable(pinfo->cinfo); + save_writable = col_get_writable(pinfo->cinfo, -1); /* If sFlow samples a TCP packet it is very likely that the @@ -705,7 +705,7 @@ dissect_sflow_245_sampled_header(tvbuff_t *tvb, packet_info *pinfo, pinfo->flags.in_error_pkt = TRUE; } - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, -1, FALSE); copy_address_shallow(&save_dl_src, &pinfo->dl_src); copy_address_shallow(&save_dl_dst, &pinfo->dl_dst); copy_address_shallow(&save_net_src, &pinfo->net_src); @@ -727,7 +727,7 @@ dissect_sflow_245_sampled_header(tvbuff_t *tvb, packet_info *pinfo, ENDTRY; /* restore saved state */ - col_set_writable(pinfo->cinfo, save_writable); + col_set_writable(pinfo->cinfo, -1, save_writable); pinfo->flags.in_error_pkt = save_in_error_pkt; copy_address_shallow(&pinfo->dl_src, &save_dl_src); copy_address_shallow(&pinfo->dl_dst, &save_dl_dst); diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c index 6bab404798..1cbbe939c8 100644 --- a/epan/dissectors/packet-ssl.c +++ b/epan/dissectors/packet-ssl.c @@ -1095,12 +1095,11 @@ again: int old_len; /* - * Unblock and reset column in case multiple SSL segments form the + * Reset column in case multiple SSL segments form the * PDU and this last SSL segment is not in the first TCP segment of * this frame. * XXX prevent clearing the column if the last layer is not SSL? */ - col_set_writable(pinfo->cinfo, TRUE); /* Clear column during the first pass. */ col_clear(pinfo->cinfo, COL_INFO); @@ -1339,11 +1338,9 @@ again: * PROTOCOL and INFO colums since what follows may be an * incomplete PDU and we don't want it be changed back from * to - * XXX There is no good way to block the PROTOCOL column - * from being changed yet so we set the entire row unwritable. */ col_set_fence(pinfo->cinfo, COL_INFO); - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, COL_PROTOCOL, FALSE); offset += another_pdu_follows; seq += another_pdu_follows; goto again; diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index 73399e12d1..ac7d9217a0 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -2487,7 +2487,7 @@ desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset, gint nbytes; proto_item *item; struct tcp_multisegment_pdu *msp; - gboolean cleared_writable = col_get_writable(pinfo->cinfo); + gboolean cleared_writable = col_get_writable(pinfo->cinfo, COL_PROTOCOL); again: ipfd_head = NULL; @@ -2932,13 +2932,10 @@ again: * PROTOCOL and INFO columns since what follows may be an * incomplete PDU and we don't want it be changed back from * to - * XXX There is no good way to block the PROTOCOL column - * from being changed yet so we set the entire row unwritable. - * The flag cleared_writable stores the initial state. */ col_set_fence(pinfo->cinfo, COL_INFO); - cleared_writable |= col_get_writable(pinfo->cinfo); - col_set_writable(pinfo->cinfo, FALSE); + cleared_writable |= col_get_writable(pinfo->cinfo, COL_PROTOCOL); + col_set_writable(pinfo->cinfo, COL_PROTOCOL, FALSE); offset += another_pdu_follows; seq += another_pdu_follows; goto again; @@ -2947,7 +2944,7 @@ again: * proto,colinfo tap will break */ if(cleared_writable) { - col_set_writable(pinfo->cinfo, TRUE); + col_set_writable(pinfo->cinfo, COL_PROTOCOL, TRUE); } } } diff --git a/epan/dissectors/packet-wassp.c b/epan/dissectors/packet-wassp.c index a3c6f86ddf..527c785d59 100644 --- a/epan/dissectors/packet-wassp.c +++ b/epan/dissectors/packet-wassp.c @@ -773,7 +773,7 @@ dissect_snmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *wassp_tree, tvbuff_t *snmp_tvb; /* Don't add SNMP stuff to the info column */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); snmp_tvb = tvb_new_subset_length(tvb, offset, length); @@ -784,7 +784,7 @@ dissect_snmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *wassp_tree, show_exception(snmp_tvb, pinfo, wassp_tree, EXCEPT_CODE, GET_MESSAGE); } ENDTRY; - col_set_writable(pinfo->cinfo, TRUE); + col_set_writable(pinfo->cinfo, COL_INFO, TRUE); offset += length; @@ -798,7 +798,7 @@ dissect_ieee80211(tvbuff_t *tvb, packet_info *pinfo, proto_tree *wassp_tree, tvbuff_t *ieee80211_tvb; /* Don't add IEEE 802.11 stuff to the info column */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); ieee80211_tvb = tvb_new_subset_length(tvb, offset, length); @@ -809,7 +809,7 @@ dissect_ieee80211(tvbuff_t *tvb, packet_info *pinfo, proto_tree *wassp_tree, show_exception(ieee80211_tvb, pinfo, wassp_tree, EXCEPT_CODE, GET_MESSAGE); } ENDTRY; - col_set_writable(pinfo->cinfo, TRUE); + col_set_writable(pinfo->cinfo, COL_INFO, TRUE); offset += length; diff --git a/epan/dissectors/packet-zbee-zcl-general.c b/epan/dissectors/packet-zbee-zcl-general.c index 45bcadf7df..611306f963 100644 --- a/epan/dissectors/packet-zbee-zcl-general.c +++ b/epan/dissectors/packet-zbee-zcl-general.c @@ -12679,18 +12679,18 @@ dissect_zbee_zcl_gp_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (payload_size != 0 && payload_size != 0xff) { tvbuff_t *gtvb = tvb_new_composite(); - gboolean writable = col_get_writable(pinfo->cinfo); + gboolean writable = col_get_writable(pinfo->cinfo, COL_INFO); /* remove payload length and put command id instead */ tvb_composite_append(gtvb, tvb_new_subset_length(tvb, offset-2, 1)); tvb_composite_append(gtvb, tvb_new_subset_length(tvb, offset, payload_size)); tvb_composite_finalize(gtvb); /* prevent overwriting COL_INFO */ - col_set_writable(pinfo->cinfo, FALSE); + col_set_writable(pinfo->cinfo, COL_INFO, FALSE); /* Actually dissect_zbee_nwk_gp_cmd wants zbee_nwk_green_power_packet* * as a data but never uses it. */ call_dissector_only(zgp_handle, gtvb, pinfo, tree, NULL); - col_set_writable(pinfo->cinfo, writable); + col_set_writable(pinfo->cinfo, COL_INFO, writable); offset += payload_size; } return offset; diff --git a/epan/packet.c b/epan/packet.c index 21ea2d2b88..8deef8fdef 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -782,8 +782,8 @@ call_dissector_work_error(dissector_handle_t handle, tvbuff_t *tvb, saved_proto = pinfo->current_proto; saved_can_desegment = pinfo->can_desegment; - save_writable = col_get_writable(pinfo->cinfo); - col_set_writable(pinfo->cinfo, FALSE); + save_writable = col_get_writable(pinfo->cinfo, -1); + col_set_writable(pinfo->cinfo, -1, FALSE); copy_address_shallow(&save_dl_src, &pinfo->dl_src); copy_address_shallow(&save_dl_dst, &pinfo->dl_dst); copy_address_shallow(&save_net_src, &pinfo->net_src); @@ -799,7 +799,7 @@ call_dissector_work_error(dissector_handle_t handle, tvbuff_t *tvb, /* * Restore the column writability and addresses. */ - col_set_writable(pinfo->cinfo, save_writable); + col_set_writable(pinfo->cinfo, -1, save_writable); copy_address_shallow(&pinfo->dl_src, &save_dl_src); copy_address_shallow(&pinfo->dl_dst, &save_dl_dst); copy_address_shallow(&pinfo->net_src, &save_net_src); @@ -841,7 +841,7 @@ call_dissector_work_error(dissector_handle_t handle, tvbuff_t *tvb, } ENDTRY; - col_set_writable(pinfo->cinfo, save_writable); + col_set_writable(pinfo->cinfo, -1, save_writable); copy_address_shallow(&pinfo->dl_src, &save_dl_src); copy_address_shallow(&pinfo->dl_dst, &save_dl_dst); copy_address_shallow(&pinfo->net_src, &save_net_src); diff --git a/plugins/wimaxasncp/packet-wimaxasncp.c b/plugins/wimaxasncp/packet-wimaxasncp.c index 8e3e781d24..69e328358c 100644 --- a/plugins/wimaxasncp/packet-wimaxasncp.c +++ b/plugins/wimaxasncp/packet-wimaxasncp.c @@ -1632,14 +1632,14 @@ static void wimaxasncp_dissect_tlv_value( eap_tvb = tvb_new_subset_remaining(tvb, offset); /* Disable writing to info column while calling eap dissector */ - save_writable = col_get_writable(pinfo->cinfo); - col_set_writable(pinfo->cinfo, FALSE); + save_writable = col_get_writable(pinfo->cinfo, -1); + col_set_writable(pinfo->cinfo, -1, FALSE); /* Call the EAP dissector. */ call_dissector(eap_handle, eap_tvb, pinfo, eap_tree); /* Restore previous writable state of info column */ - col_set_writable(pinfo->cinfo, save_writable); + col_set_writable(pinfo->cinfo, -1, save_writable); } return; diff --git a/ui/cli/tap-protocolinfo.c b/ui/cli/tap-protocolinfo.c index 8227c1b948..23581bc127 100644 --- a/ui/cli/tap-protocolinfo.c +++ b/ui/cli/tap-protocolinfo.c @@ -59,7 +59,7 @@ protocolinfo_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt, const vo * To prevent a crash, we check whether INFO column is writable * and, if not, we report that error and exit. */ - if (!col_get_writable(pinfo->cinfo)) { + if (!col_get_writable(pinfo->cinfo, COL_INFO)) { fprintf(stderr, "tshark: the proto,colinfo tap doesn't work if the INFO column isn't being printed.\n"); exit(1); }