Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: EIP only working with variables with an odd character count (in second path segment) #1602

Open
2 of 16 tasks
luedi128 opened this issue May 16, 2024 · 1 comment
Open
2 of 16 tasks
Labels
bug driver-ethernet/ip java Pull requests that update Java code plc4j

Comments

@luedi128
Copy link

What happened?

We have a Rockwell function block that is offering the following variables, that we want to read out.

The following request with eight variables showed that only one of them is working - the other caused INTERNAL_ERROR responses from the Rockwell PLC.

  readRequestBuilder = plcConnection.readRequestBuilder();
  readRequestBuilder.addTagAddress("v1", "xxx1.timestamp_xxxxxxx_OFF");   // ok - working
  readRequestBuilder.addTagAddress("v2", "xxx1.timestamp_xxxxxxx_ON"); // INTERNAL_ERROR

We have had a look at the CIP packages on network level and it looks like the size of the second path segment was wrongly calculated - the following part of the CIP with slot/address are not recognized as a valid part of CIP protocol in wireshark (screenshot attached).

For testing we renamed the last variable by adding an additional character at the end (in the FB and in the java code) e.g. xxx1.timestamp_xxxxxxx_ONN then everything worked fine. We have this situations with other variables as well (8 variables in our test - only have of them (the once with an even character count) are working - the others result in INTERNAL_ERRORs)

We have been able to fix the problem by changing org.apache.plc4x.java.eip.base.protocol.EipProtocolLogic.class in line 692 to:
newSegment = new DataSegment(new AnsiExtendedSymbolSegment(identifier, (identifier.length() % 2 == 0) ? null : (short) 0));
More or less copy & paste from line 696/697.

From out point of view this is a bug in the path segment length calculation only affecting path variables with an odd character count (or second path segments with an odd character count).

Tested on a Rockwell 1769-L18ER/B LOGIX5318ER.

Version

v0.12.0

Programming Languages

  • plc4j
  • plc4go
  • plc4c
  • plc4net

Protocols

  • AB-Ethernet
  • ADS /AMS
  • BACnet/IP
  • CANopen
  • DeltaV
  • DF1
  • EtherNet/IP
  • Firmata
  • KNXnet/IP
  • Modbus
  • OPC-UA
  • S7
@luedi128 luedi128 added the bug label May 16, 2024
@luedi128
Copy link
Author

Wireshark screenshot.

plc4x_second_path_segment

@ottlukas ottlukas added java Pull requests that update Java code driver-ethernet/ip plc4j labels May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug driver-ethernet/ip java Pull requests that update Java code plc4j
Projects
None yet
Development

No branches or pull requests

2 participants