diff options
author | Gizem Yurdagul <gizemnuryurdagul@gmail.com> | 2018-03-19 10:28:09 +0300 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2018-03-22 07:02:21 +0000 |
commit | fd69d893ff5ff252411753cfc7de576470fd5487 (patch) | |
tree | 38de29f9e03b5aa4e958a1af6c87df0fe29d1de9 /plugins | |
parent | 79d6dc31ffa0bc417a9ca34a50ca1def95f96460 (diff) |
PROFINET: Am_location dissection was wrong byte order.
Dissection is updated according to spec.
Unnecessary tab and spaces are removed.
Change-Id: Ia9b3252f5e9dcdc3617286a802fffeef250888c2
Reviewed-on: https://code.wireshark.org/review/26542
Reviewed-by: Birol Capa <birol.capa@siemens.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/epan/profinet/packet-dcerpc-pn-io.c | 144 |
1 files changed, 96 insertions, 48 deletions
diff --git a/plugins/epan/profinet/packet-dcerpc-pn-io.c b/plugins/epan/profinet/packet-dcerpc-pn-io.c index ef2ba3d3a0..61ef3943a9 100644 --- a/plugins/epan/profinet/packet-dcerpc-pn-io.c +++ b/plugins/epan/profinet/packet-dcerpc-pn-io.c @@ -746,6 +746,10 @@ static int hf_pn_io_am_location_reserved1 = -1; static int hf_pn_io_am_location_reserved2 = -1; static int hf_pn_io_am_location_reserved3 = -1; static int hf_pn_io_am_location_reserved4 = -1; +static int hf_pn_io_am_location_beginslotnum = -1; +static int hf_pn_io_am_location_beginsubslotnum = -1; +static int hf_pn_io_am_location_endslotnum = -1; +static int hf_pn_io_am_location_endsubslotnum = -1; static int hf_pn_io_am_software_revision = -1; static int hf_pn_io_am_hardware_revision = -1; static int hf_pn_io_am_type_identification = -1; @@ -4492,88 +4496,112 @@ packet_info *pinfo, proto_tree *tree, guint8 *drep) guint16 am_location_reserved2; guint16 am_location_reserved3; guint16 am_location_reserved4; + sub_item = proto_tree_add_item(tree, hf_pn_io_am_location, tvb, offset, 16, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_am_location); - offset = dissect_dcerpc_char(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_am_location_structure, - &am_location_structtype); + am_location_structtype = tvb_get_guint8(tvb, offset+15); bit_offset = offset << 3; + switch (am_location_structtype) { case (0x01): - /* level 0 */ - proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_0, tvb, bit_offset, 10, ENC_BIG_ENDIAN); - bit_offset += 10; - /* level 1 */ - proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_1, tvb, bit_offset, 10, ENC_BIG_ENDIAN); + + /* level 11 */ + proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_11, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; - /* level 2 */ - proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_2, tvb, bit_offset, 10, ENC_BIG_ENDIAN); + + /* level 10 */ + proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_10, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; - /* level 3 */ - proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_3, tvb, bit_offset, 10, ENC_BIG_ENDIAN); + + /* level 9 */ + proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_9, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; - /* level 4 */ - proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_4, tvb, bit_offset, 10, ENC_BIG_ENDIAN); + + /* level 8 */ + proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_8, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; - /* level 5 */ - proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_5, tvb, bit_offset, 10, ENC_BIG_ENDIAN); + + /* level 7 */ + proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_7, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; + /* level 6 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_6, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; - /* level 7 */ - proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_7, tvb, bit_offset, 10, ENC_BIG_ENDIAN); + + /* level 5 */ + proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_5, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; - /* level 8 */ - proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_8, tvb, bit_offset, 10, ENC_BIG_ENDIAN); + + /* level 4 */ + proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_4, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; - /* level 9 */ - proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_9, tvb, bit_offset, 10, ENC_BIG_ENDIAN); + + /* level 3 */ + proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_3, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; - /* level 10 */ - proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_10, tvb, bit_offset, 10, ENC_BIG_ENDIAN); + + /* level 2 */ + proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_2, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; - /* level 11 */ - proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_11, tvb, bit_offset, 10, ENC_BIG_ENDIAN); + + /* level 1 */ + proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_1, tvb, bit_offset, 10, ENC_BIG_ENDIAN); + bit_offset += 10; + + /* level 0 */ + proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_0, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; - offset = bit_offset >> 3; + + /* level 0 */ + proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_structure, tvb, bit_offset, 8, ENC_BIG_ENDIAN); + bit_offset += 8; + + offset += 16; + break; case (0x02): - /* Reserved1 */ - offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, - hf_pn_io_am_location_reserved1, &am_location_reserved1); - - /* BeginSlotNumber */ + /* Reserved 4 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, - hf_pn_io_slot_nr, &am_location_begin_slot_number); + hf_pn_io_am_location_reserved4, &am_location_reserved4); - /* BeginSubslotNumber */ + /* Reserved 3 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, - hf_pn_io_subslot_nr, &am_location_begin_subslot_number); + hf_pn_io_am_location_reserved3, &am_location_reserved3); - /* EndSlotNumber*/ + /* Reserved 2 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, - hf_pn_io_slot_nr, &am_location_end_slot_number); + hf_pn_io_am_location_reserved2, &am_location_reserved2); /* EndSubSlotNumber*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, - hf_pn_io_subslot_nr, &am_location_end_subslot_number); + hf_pn_io_am_location_endsubslotnum, &am_location_end_subslot_number); - /* Reserved 2 */ + /* EndSlotNumber*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, - hf_pn_io_am_location_reserved2, &am_location_reserved2); + hf_pn_io_am_location_endslotnum, &am_location_end_slot_number); - /* Reserved 3 */ + /* BeginSubslotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, - hf_pn_io_am_location_reserved3, &am_location_reserved3); + hf_pn_io_am_location_beginsubslotnum, &am_location_begin_subslot_number); - /* Reserved 4 */ + /* BeginSlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, - hf_pn_io_am_location_reserved4, &am_location_reserved4); + hf_pn_io_am_location_beginslotnum, &am_location_begin_slot_number); + + /* Reserved1 */ + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, + hf_pn_io_am_location_reserved1, &am_location_reserved1); + + /* Structure */ + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, + hf_pn_io_am_location_structure, &am_location_structtype); + break; default: /* will not execute because of the line preceding the switch */ - offset += 15; + offset += 16; break; } @@ -14955,25 +14983,45 @@ proto_register_pn_io (void) NULL, HFILL } }, { &hf_pn_io_am_location_reserved1, - { "Reserved 1", "pn_io.am_location.reserved1", + { "AM_Location.Reserved1", "pn_io.am_location.reserved1", FT_UINT8, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_reserved2, - { "Reserved 2", "pn_io.am_location.reserved2", + { "AM_Location.Reserved2", "pn_io.am_location.reserved2", FT_UINT16, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_reserved3, - { "Reserved 3", "pn_io.am_location.reserved3", + { "AM_Location.Reserved3", "pn_io.am_location.reserved3", FT_UINT16, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_reserved4, - { "Reserved 3", "pn_io.am_location.reserved4", + { "AM_Location.Reserved4", "pn_io.am_location.reserved4", FT_UINT16, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0, NULL, HFILL } }, + { &hf_pn_io_am_location_beginslotnum, + { "AM_Location.BeginSlotNumber", "pn_io.slot_nr", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, + { &hf_pn_io_am_location_beginsubslotnum, + { "AM_Location.BeginSubSlotNumber", "pn_io.subslot_nr", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, + { &hf_pn_io_am_location_endslotnum, + { "AM_Location.EndSlotNumber", "pn_io.slot_nr", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, + { &hf_pn_io_am_location_endsubslotnum, + { "AM_Location.EndSubSlotNumber", "pn_io.subslot_nr", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, { &hf_pn_io_am_software_revision, { "AM Software Revision", "pn_io.am_software_revision", FT_STRING, BASE_NONE, NULL, 0x0, |