etw: use PACK_FLAGS_DIRECTION() to extract the direction from the flags.

Use PACK_FLAGS_DIRECTION() rather than making with
PACK_FLAGS_DIRECTION_MASK.  They happen to be at the bottom of the flags
option, so no shifing is needed, but it's cleaner to use the macro.

Make the packet flags variable local to the code that uses it, and fix
indentation (don't use tabs - they're not used elsewhere), while we're
at it.
This commit is contained in:
Guy Harris 2021-08-09 15:57:29 -07:00
parent 410cfdd7da
commit 4aee405974
1 changed files with 5 additions and 3 deletions

View File

@ -67,7 +67,7 @@ dissect_etw(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree _U_, void* data
{
proto_tree* etw_header, * etw_descriptor, * etw_buffer_context;
tvbuff_t* mbim_tvb;
guint32 message_offset, message_length, provider_name_offset, provider_name_length, user_data_offset, user_data_length, pack_flags;
guint32 message_offset, message_length, provider_name_offset, provider_name_length, user_data_offset, user_data_length;
e_guid_t provider_id;
gint offset = 0;
@ -137,8 +137,10 @@ dissect_etw(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree _U_, void* data
col_set_str(pinfo->cinfo, COL_DEF_SRC, "windows");
col_set_str(pinfo->cinfo, COL_DEF_DST, "windows");
if (memcmp(&mbim_net_providerid, &provider_id, sizeof(e_guid_t)) == 0) {
if (WTAP_OPTTYPE_SUCCESS == wtap_block_get_uint32_option_value(pinfo->rec->block, OPT_PKT_FLAGS, &pack_flags)) {
switch(pack_flags & PACK_FLAGS_DIRECTION_MASK) {
guint32 pack_flags;
if (WTAP_OPTTYPE_SUCCESS == wtap_block_get_uint32_option_value(pinfo->rec->block, OPT_PKT_FLAGS, &pack_flags)) {
switch(PACK_FLAGS_DIRECTION(pack_flags)) {
case PACK_FLAGS_DIRECTION_INBOUND:
col_set_str(pinfo->cinfo, COL_DEF_SRC, "device");
col_set_str(pinfo->cinfo, COL_DEF_DST, "host");