From e77dac09f14623d41050a9652e6a79fd12bbb28a Mon Sep 17 00:00:00 2001 From: "gizem.yurdagul" Date: Fri, 1 Dec 2017 15:38:06 +0300 Subject: PROFINET: AdjustDCPBoundary disection is added. According to specification, AdjustDCPBoundary is a sub block for adjusting the DCP boundary. Change-Id: I2515e2b3592ff0e5e67487b1785db41015964b21 Reviewed-on: https://code.wireshark.org/review/24673 Reviewed-by: Alexis La Goutte Petri-Dish: Alexis La Goutte Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- plugins/profinet/packet-dcerpc-pn-io.c | 80 +++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/plugins/profinet/packet-dcerpc-pn-io.c b/plugins/profinet/packet-dcerpc-pn-io.c index 191bd84404..8703a4b288 100644 --- a/plugins/profinet/packet-dcerpc-pn-io.c +++ b/plugins/profinet/packet-dcerpc-pn-io.c @@ -762,6 +762,10 @@ 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; +static int hf_pn_io_dcp_boundary_value = -1; +static int hf_pn_io_dcp_boundary_value_bit0 = -1; +static int hf_pn_io_dcp_boundary_value_bit1 = -1; +static int hf_pn_io_dcp_boundary_value_otherbits = -1; /* static int hf_pn_io_packedframe_SFCRC = -1; */ static gint ett_pn_io = -1; static gint ett_pn_io_block = -1; @@ -832,6 +836,8 @@ static gint ett_pn_io_asset_management_info = -1; static gint ett_pn_io_asset_management_block = -1; static gint ett_pn_io_am_location = -1; +static gint ett_pn_io_dcp_boundary = -1; + #define PD_SUB_FRAME_BLOCK_FIOCR_PROPERTIES_LENGTH 4 #define PD_SUB_FRAME_BLOCK_FRAME_ID_LENGTH 2 #define PD_SUB_FRAME_BLOCK_SUB_FRAME_DATA_LENGTH 4 @@ -2562,6 +2568,17 @@ static const value_string pn_io_mau_type_mode[] = { }; +static const value_string pn_io_dcp_boundary_value_bit0[] = { + { 0x00, "Do not block the multicast MAC address 01-0E-CF-00-00-00" }, + { 0x01, "Block an outgoing DCP_Identify frame (egress filter) with the multicast MAC address 01-0E-CF-00-00-00" }, + { 0, NULL } +}; + +static const value_string pn_io_dcp_boundary_value_bit1[] = { + { 0x00, "Do not block the multicast MAC address 01-0E-CF-00-00-01" }, + { 0x01, "Block an outgoing DCP_Hello frame (egress filter) with the multicast MAC address 01-0E-CF-00-00-01" }, + { 0, NULL } +}; static const value_string pn_io_port_state[] = { { 0x0000, "reserved" }, { 0x0001, "up" }, @@ -6670,6 +6687,43 @@ dissect_PDPortFODataCheck_block(tvbuff_t *tvb, int offset, return offset; } +/* dissect the AdjustDCPBoundary block */ +static int +dissect_AdjustDCPBoundary_block(tvbuff_t *tvb, int offset, + packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) +{ + proto_item *sub_item; + proto_tree *sub_tree; + guint32 u32DcpBoundary; + guint16 u16AdjustProperties; + + if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { + expert_add_info_format(pinfo, item, &ei_pn_io_block_version, + "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); + return offset; + } + + /* Padding */ + offset = dissect_pn_align4(tvb, offset, pinfo, tree); + + sub_item = proto_tree_add_item(tree, hf_pn_io_dcp_boundary_value, tvb, offset, 4, ENC_BIG_ENDIAN); + sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_dcp_boundary); + + /* DcpBoundary.Bit0 */ + dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_dcp_boundary_value_bit0, &u32DcpBoundary); + + /* DcpBoundary.Bit1 */ + dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_dcp_boundary_value_bit1, &u32DcpBoundary); + + /* DcpBoundary.OtherBits */ + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_dcp_boundary_value_otherbits, &u32DcpBoundary); + + /* Properties */ + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, + hf_pn_io_adjust_properties, &u16AdjustProperties); + + return offset; +} static int dissect_MrpInstanceDataAdjust_block(tvbuff_t *tvb, int offset, @@ -10534,6 +10588,9 @@ dissect_block(tvbuff_t *tvb, int offset, case(0x0223): dissect_PDPortFODataCheck_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; + case(0x0225): + dissect_AdjustDCPBoundary_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); + break; case(0x0226): dissect_AdjustPreambleLength_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; @@ -13507,6 +13564,26 @@ proto_register_pn_io (void) FT_UINT16, BASE_HEX, VALS(pn_io_mau_type_mode), 0x0, NULL, HFILL } }, + { &hf_pn_io_dcp_boundary_value, + { "DCPBoundary", "pn_io.dcp_boundary_value", + FT_UINT32, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, + { &hf_pn_io_dcp_boundary_value_bit0, + { "DCPBoundary", "pn_io.dcp_boundary_value_bit0", + FT_UINT32, BASE_HEX, VALS(pn_io_dcp_boundary_value_bit0), 0x1, + NULL, HFILL } + }, + { &hf_pn_io_dcp_boundary_value_bit1, + { "DCPBoundary", "pn_io.dcp_boundary_value_bit1", + FT_UINT32, BASE_HEX, VALS(pn_io_dcp_boundary_value_bit1), 0x2, + NULL, HFILL } + }, + { &hf_pn_io_dcp_boundary_value_otherbits, + { "DCPBoundary", "pn_io.dcp_boundary_value_otherbits", + FT_UINT32, BASE_HEX, NULL, 0xFFFFFFFC, + NULL, HFILL } + }, { &hf_pn_io_port_state, { "PortState", "pn_io.port_state", FT_UINT16, BASE_HEX, VALS(pn_io_port_state), 0x0, @@ -14822,7 +14899,8 @@ proto_register_pn_io (void) &ett_pn_io_am_location, &ett_pn_io_sr_properties, &ett_pn_io_line_delay, - &ett_pn_io_counter_status + &ett_pn_io_counter_status, + &ett_pn_io_dcp_boundary }; static ei_register_info ei[] = { -- cgit v1.2.3