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

Max APDU not segmenting correct #498

Open
KlausHammer opened this issue Sep 4, 2023 · 1 comment
Open

Max APDU not segmenting correct #498

KlausHammer opened this issue Sep 4, 2023 · 1 comment

Comments

@KlausHammer
Copy link

Hi,

If i take the example code Sample4_RandomAnalogValueObject.py, and change
RANDOM_OBJECT_COUNT = int(os.getenv('RANDOM_OBJECT_COUNT', 10))
to
RANDOM_OBJECT_COUNT = int(os.getenv('RANDOM_OBJECT_COUNT', 400))

And in the .ini file set maxApduLengthAccepted to 480, YABE can see that the max APDU length is 480, but when i read the the DeviceObject, it does not look like the message is segmentet properly.
image

From WireShark when a read request on object-list is requested, it first sends a total of 1481 bytes in message 1,
image

and 543 bytes in message two.
image

Should it not segment the message into multiple messages with a max length of 480 bytes? Or am i missing something?
No matter what i change maxApduLengthAccepted to, it behaves the same.

Hope you can help!

@KlausHammer
Copy link
Author

So after digging around in the code, it seems that the segmentation happens in appservice.py in the ServerSSM class on line 793:
if (apdu.apduType == ComplexAckPDU.pduType):

If i manually change
self.segmentSize = self.maxApduLengthAccepted

to
self.segmentSize = 480

It now segments the apdu to a size of 485, so i now have 2 question.

  1. How do i provide the device_info information correctly to the ServerSSM class, so it can use the maxapdulengthaccepted defined in the deviceobject?
  2. How come it send 5 bytes more then the max APDU size. That explains why i received 1481 bytes before, when it should limited it to 1476 which is the max apdu size for BACnet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant