Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreadman committed Feb 6, 2025
2 parents 3883882 + f66f426 commit ad33ce7
Show file tree
Hide file tree
Showing 14 changed files with 146 additions and 40 deletions.
3 changes: 3 additions & 0 deletions doc/Wireshark_Release_Notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ The following features are either new or have been significantly updated since v
the "Print" and "Export Packet Dissection" dialogs, and in TShark with
the `--hexdump time` option. wsbuglink:17132[]

* Lua now has a `Conversation` object, which exposes conversations and conversation
data to Lua. Resolves wsbuglink:15396[]

=== Removed Features and Support

Wireshark no longer supports AirPcap and WinPcap.
Expand Down
25 changes: 16 additions & 9 deletions epan/dissectors/packet-cesoeth.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,22 @@ dissect_cesoeth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data

int rtp_header_len = dissect_rtp_shim_header(tvb, offset, pinfo, cesoeth_tree, &rtp_info);

col_set_str(pinfo->cinfo, COL_PROTOCOL, "CESoETH (w RTP)");
col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "RTP PT: %u, SSRC: 0x%X, Seq: %u, Time=%u",
rtp_info.info_payload_type,
rtp_info.info_sync_src,
rtp_info.info_seq_num,
rtp_info.info_timestamp
);

next_tvb = tvb_new_subset_length(tvb, offset + rtp_header_len, payload_len - rtp_header_len);
if (rtp_header_len > 0)
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CESoETH (w RTP)");
col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "RTP PT: %u, SSRC: 0x%X, Seq: %u, Time=%u",
rtp_info.info_payload_type,
rtp_info.info_sync_src,
rtp_info.info_seq_num,
rtp_info.info_timestamp
);

next_tvb = tvb_new_subset_length(tvb, offset + rtp_header_len, payload_len - rtp_header_len);
}
else
{
col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RTP header missing");
}
}

call_data_dissector(next_tvb, pinfo, tree);
Expand Down
10 changes: 8 additions & 2 deletions epan/dissectors/packet-geonw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2963,6 +2963,12 @@ display_heading( char *result, uint32_t hexver )
snprintf( result, ITEM_LABEL_LENGTH, "%.1f degrees", hexver/10.);
}

static void
display_cbr( char *result, uint8_t hexver )
{
snprintf( result, ITEM_LABEL_LENGTH, "%.2f %% (%u)", hexver * 100.0 / 255.0, hexver);
}

static void
display_elevation( char *result, int32_t hexver )
{
Expand Down Expand Up @@ -3231,12 +3237,12 @@ proto_register_geonw(void)

{ &hf_geonw_dccmco_cbr_l_0_hop,
{ "Local channel busy ratio", "geonw.cbr_l0hop",
FT_UINT8, BASE_DEC, NULL, 0x80,
FT_UINT8, BASE_CUSTOM, CF_FUNC(display_cbr), 0x00,
NULL, HFILL }},

{ &hf_geonw_dccmco_cbr_l_1_hop,
{ "Max neighbouring CBR", "geonw.cbr_l1hop",
FT_UINT8, BASE_DEC, NULL, 0x80,
FT_UINT8, BASE_CUSTOM, CF_FUNC(display_cbr), 0x00,
NULL, HFILL }},

{ &hf_geonw_dccmco_output_power,
Expand Down
2 changes: 1 addition & 1 deletion epan/dissectors/packet-rtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2747,7 +2747,7 @@ dissect_rtp_shim_header(tvbuff_t *tvb, int start, packet_info *pinfo _U_, proto_
proto_tree_add_uint( rtp_tree, hf_rtp_version, tvb,
offset, 1, octet1);
}
return offset;
return 0;
}

padding_set = RTP_PADDING( octet1 );
Expand Down
10 changes: 9 additions & 1 deletion epan/dissectors/packet-rtp.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,15 @@ bluetooth_add_address(packet_info *pinfo, address *addr, uint32_t stream_number,
const char *setup_method, uint32_t setup_frame_number,
uint32_t media_types, void *data);

/* Dissect the header only, without side effects */
/* Dissects the RTP header only, without side effects.
@param tvb The tv buffer of the current data
@param start The start of RTP data in tvb
@param pinfo Packet info from the current protocol
@param tree The tree to append the RTP header dissection to
@param rtp_info structure with RTP header info
@return number of bytes consumed
*/
WS_DLL_PUBLIC
int dissect_rtp_shim_header(tvbuff_t *tvb, int start,
packet_info *pinfo, proto_tree *tree,
Expand Down
29 changes: 29 additions & 0 deletions epan/dissectors/packet-smb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -6818,6 +6818,13 @@ dissect_smb2_close_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
which_tree = tree;
}

if (si->file && si->file->delete_on_close) {
if (si->file->is_dir)
col_append_str(pinfo->cinfo, COL_INFO, ", (delete dir)");
else
col_append_str(pinfo->cinfo, COL_INFO, ", (delete file)");
}

/* Filename */
if (si->file && si->file->name) {
item = proto_tree_add_string(which_tree, hf_smb2_filename, tvb, 0, 0, si->file->name);
Expand Down Expand Up @@ -6893,6 +6900,13 @@ dissect_smb2_close_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t
/* File Attributes */
offset = dissect_fscc_file_attr(tvb, tree, offset, NULL);

if (si->file && si->file->delete_on_close) {
if (si->file->is_dir)
col_append_str(pinfo->cinfo, COL_INFO, ", (dir was deleted)");
else
col_append_str(pinfo->cinfo, COL_INFO, ", (file was deleted)");
}

if (pinfo->fd->visited) {
if (si->file && si->file->name) {
if (strcmp(si->file->name, "") == 0)
Expand Down Expand Up @@ -10463,6 +10477,12 @@ dissect_smb2_create_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset = dissect_smb_access_mask(tvb, tree, offset);

/* File Attributes */
if (si->file) {
if (tvb_get_letohl(tvb, offset) & 0x10)
si->file->is_dir = TRUE;
else
si->file->is_dir = FALSE;
}
offset = dissect_fscc_file_attr(tvb, tree, offset, NULL);

/* share access */
Expand All @@ -10475,6 +10495,12 @@ dissect_smb2_create_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* create options */
offset = dissect_nt_create_options(tvb, tree, offset);

if (tvb_get_letohl(tvb, offset-4) & 0x1000) {
col_append_fstr(pinfo->cinfo, COL_INFO, ", (delete on close)");
if (si->file)
si->file->delete_on_close = TRUE;
}

if (si->file)
si->file->frame_beg = pinfo->fd->num;
if (si->saved)
Expand Down Expand Up @@ -10624,6 +10650,9 @@ dissect_smb2_create_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
if (si->saved)
si->saved->uuid_fid = tag_guid;

if (si->file && si->file->delete_on_close)
col_append_fstr(pinfo->cinfo, COL_INFO, ", (delete on close)");

/* Display the GUID subtree */
offset = dissect_smb2_fid(tvb, pinfo, tree, offset, si, FID_MODE_OPEN);

Expand Down
2 changes: 2 additions & 0 deletions epan/dissectors/packet-smb2.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ typedef struct _smb2_fid_info_t {
uint32_t frame_end;
/* file name used to open this FID */
char *name;
gboolean is_dir;
gboolean delete_on_close;
} smb2_fid_info_t;

typedef enum {
Expand Down
36 changes: 21 additions & 15 deletions epan/dissectors/packet-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -2845,7 +2845,7 @@ dissect_thread_mc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat

static int
// NOLINTNEXTLINE(misc-no-recursion)
dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
dissect_thread_nwd_with_server_decode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int server_decode)
{
proto_item *proto_root;
proto_tree *thread_nwd_tree;
Expand All @@ -2854,7 +2854,6 @@ dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
unsigned offset = 0, tlv_offset;
proto_item *ti;
uint8_t tlv_type, tlv_len;
int g_server_decode = 1; /* used to check if the full decoding of Server TLV has to be done or not */

/* Create the protocol tree. */
proto_root = proto_tree_add_item(tree, proto_thread_nwd, tvb, 0, tvb_reported_length(tvb), ENC_NA);
Expand Down Expand Up @@ -2954,7 +2953,7 @@ dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
sub_tlv_tree = proto_item_add_subtree(ti, ett_thread_nwd_prefix_sub_tlvs);
/* Call this dissector for sub-TLVs */
sub_tvb = tvb_new_subset_length(tvb, offset, remaining); /* remove prefix length (1) and prefix (prefix_byte_len) */
dissect_thread_nwd(sub_tvb, pinfo, sub_tlv_tree, data);
dissect_thread_nwd_with_server_decode(sub_tvb, pinfo, sub_tlv_tree, server_decode);
offset += remaining;
}
}
Expand Down Expand Up @@ -3060,7 +3059,7 @@ dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
proto_tree_add_item(tlv_tree, hf_thread_nwd_tlv_service_anycast_seqno, tvb, offset + 1, 1, ENC_NA);
offset += 2;
tlv_offset += 2;
g_server_decode = 2;
server_decode = 2;
} else if(((s_data_len == 1) && (thread_service_data == 0x5d)) || ((s_data_len == 19) && (thread_service_data == 0x5d)))
{
proto_tree_add_item(tlv_tree, hf_thread_nwd_tlv_service_s_data, tvb, offset, s_data_len, ENC_NA);
Expand All @@ -3069,11 +3068,11 @@ dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
tlv_offset += 1;
if(s_data_len == 1)
{
g_server_decode = 3;
server_decode = 3;
}
else if(s_data_len == 19)
{
g_server_decode = 2;
server_decode = 2;
proto_tree_add_item(tlv_tree, hf_thread_nwd_tlv_service_unicast_ipv6_address, tvb, offset, 16, ENC_NA);
proto_tree_add_item(tlv_tree, hf_thread_nwd_tlv_service_unicast_port_number, tvb, offset + 16, 2, ENC_NA);
offset += 18;
Expand All @@ -3088,10 +3087,10 @@ dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
//Flag to be 1 (BIG_ENDIAN so check the MSB) and thread_service_data = 1 then Server Sub TLV needs to be decoded with s_server_data fields
if(((flags & THREAD_NWD_TLV_SERVICE_T) == THREAD_NWD_TLV_SERVICE_T) &&
(thread_service_data == THREAD_SERVICE_DATA_BBR)) {
g_server_decode = 1;
server_decode = 1;
}
else {
g_server_decode = 0;
server_decode = 0;
}
}

Expand All @@ -3101,10 +3100,10 @@ dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
// //Flag to be 1 (BIG_ENDIAN so check the MSB) and thread_service_data = 1 then Server Sub TLV needs to be decoded with s_server_data fields
// if(((flags & THREAD_NWD_TLV_SERVICE_T) == THREAD_NWD_TLV_SERVICE_T) &&
// (thread_service_data == THREAD_SERVICE_DATA_BBR)) {
// g_server_decode = 1;
// server_decode = 1;
// }
// else {
// g_server_decode = 0;
// server_decode = 0;
// }
// Thread 1.3 Service TLV code

Expand All @@ -3118,15 +3117,15 @@ dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
sub_tlv_tree = proto_item_add_subtree(ti, ett_thread_nwd_prefix_sub_tlvs);
/* Call this dissector for sub-TLVs. Should only be server TLVs */
sub_tvb = tvb_new_subset_length(tvb, offset, remaining); /* remove prefix length (1) and prefix (prefix_byte_len) */
dissect_thread_nwd(sub_tvb, pinfo, sub_tlv_tree, data);
dissect_thread_nwd_with_server_decode(sub_tvb, pinfo, sub_tlv_tree, server_decode);
offset += remaining;
}
}
break;

case THREAD_NWD_TLV_SERVER:
{
if(g_server_decode == 1) {
if(server_decode == 1) {
//2 bytes of server 16
proto_tree_add_item(tlv_tree, hf_thread_nwd_tlv_server_16, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
Expand All @@ -3141,7 +3140,7 @@ dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
proto_tree_add_item(tlv_tree, hf_thread_nwd_tlv_service_s_data_mlrtimeout, tvb, offset, 4, ENC_NA);
offset += 4;
}
else if(g_server_decode == 0) {
else if(server_decode == 0) {
//2 bytes of server 16
proto_tree_add_item(tlv_tree, hf_thread_nwd_tlv_server_16, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
Expand All @@ -3157,7 +3156,7 @@ dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da

}
// Thread 1.3 Service TLV code
else if(g_server_decode == 2) {
else if(server_decode == 2) {
//2 bytes of server 16
proto_tree_add_item(tlv_tree, hf_thread_nwd_tlv_server_16, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
Expand All @@ -3170,7 +3169,7 @@ dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
offset += remaining;
}
}
else if(g_server_decode == 3) {
else if(server_decode == 3) {
//2 bytes of server 16
proto_tree_add_item(tlv_tree, hf_thread_nwd_tlv_server_16, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
Expand Down Expand Up @@ -3201,6 +3200,13 @@ dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
return tvb_captured_length(tvb);
}

static int
// NOLINTNEXTLINE(misc-no-recursion)
dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
return dissect_thread_nwd_with_server_decode(tvb, pinfo, tree, 1);
}

static int
dissect_thread_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
Expand Down
20 changes: 13 additions & 7 deletions epan/wscbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <wsutil/array.h>
#include <epan/exceptions.h>
#include <epan/expert.h>
#include <epan/prefs.h>
#include <stdio.h>
#include <inttypes.h>
#include "wscbor.h"
Expand Down Expand Up @@ -365,7 +366,12 @@ bool wscbor_is_indefinite_break(const wscbor_chunk_t *chunk) {
* an indefinite break.
* @return True if the skipped item was fully valid.
*/
static bool wscbor_skip_next_item_internal(wmem_allocator_t *alloc, tvbuff_t *tvb, int *offset, bool *is_break) {
// NOLINTNEXTLINE(misc-no-recursion)
static bool wscbor_skip_next_item_internal(wmem_allocator_t *alloc, tvbuff_t *tvb, int *offset, bool *is_break, unsigned depth) {
if (depth > prefs.gui_max_tree_depth) {

return false;
}
wscbor_chunk_t *chunk = wscbor_chunk_read(alloc, tvb, offset);
if (wscbor_has_errors(chunk)) {
wscbor_chunk_free(chunk);
Expand All @@ -386,7 +392,7 @@ static bool wscbor_skip_next_item_internal(wmem_allocator_t *alloc, tvbuff_t *tv
// wait for indefinite break
bool was_break = false;
do {
if (!wscbor_skip_next_item_internal(alloc, tvb, offset, &was_break)) {
if (!wscbor_skip_next_item_internal(alloc, tvb, offset, &was_break, depth + 1)) {
return false;
}
}
Expand All @@ -395,7 +401,7 @@ static bool wscbor_skip_next_item_internal(wmem_allocator_t *alloc, tvbuff_t *tv
else {
const uint64_t count = chunk->head_value;
for (uint64_t ix = 0; ix < count; ++ix) {
if (!wscbor_skip_next_item_internal(alloc, tvb, offset, NULL)) {
if (!wscbor_skip_next_item_internal(alloc, tvb, offset, NULL, depth + 1)) {
return false;
}
}
Expand All @@ -407,7 +413,7 @@ static bool wscbor_skip_next_item_internal(wmem_allocator_t *alloc, tvbuff_t *tv
// wait for indefinite break
bool was_break = false;
do {
if (!wscbor_skip_next_item_internal(alloc, tvb, offset, &was_break)) {
if (!wscbor_skip_next_item_internal(alloc, tvb, offset, &was_break, depth + 1)) {
return false;
}
}
Expand All @@ -416,10 +422,10 @@ static bool wscbor_skip_next_item_internal(wmem_allocator_t *alloc, tvbuff_t *tv
else {
const uint64_t count = chunk->head_value;
for (uint64_t ix = 0; ix < count; ++ix) {
if (!wscbor_skip_next_item_internal(alloc, tvb, offset, NULL)) {
if (!wscbor_skip_next_item_internal(alloc, tvb, offset, NULL, depth + 1)) {
return false;
}
if (!wscbor_skip_next_item_internal(alloc, tvb, offset, NULL)) {
if (!wscbor_skip_next_item_internal(alloc, tvb, offset, NULL, depth + 1)) {
return false;
}
}
Expand All @@ -438,7 +444,7 @@ static bool wscbor_skip_next_item_internal(wmem_allocator_t *alloc, tvbuff_t *tv
}

bool wscbor_skip_next_item(wmem_allocator_t *alloc, tvbuff_t *tvb, int *offset) {
return wscbor_skip_next_item_internal(alloc, tvb, offset, NULL);
return wscbor_skip_next_item_internal(alloc, tvb, offset, NULL, 0);
}

bool wscbor_skip_if_errors(wmem_allocator_t *alloc, tvbuff_t *tvb, int *offset, const wscbor_chunk_t *chunk) {
Expand Down
Loading

0 comments on commit ad33ce7

Please sign in to comment.