Don't Fragment (DF) bit in real time UDP on XPC

7 views (last 30 days)
Mark V
Mark V on 8 Apr 2014
Commented: Suneesh on 14 Apr 2014
Dear all,
Is there a way to unset the Don't Fragment (DF) bit in the header of UDP packets sent using an XPC target running the real time UDP send block?
To give you a description of my problem:
I have a device that is controlled over UDP. I'd like to control this device using a desktop running XPC target, which has a dedicated network card (Intel 82558) for real time UDP.
To test my device I made a simple Simulink model (non real time) and used it to send some UDP packets from my laptop to the device, without the XPC desktop involved. This works fine, and I can control the device.
But if I send the exact same packets from the XPC using real time UDP, nothing happens. I used Wireshark to compare the packets coming from my pc and from the XPC, and the data is exactly the same. However, I noticed that the packets coming from the XPC have the Don't Fragment (DF) bit set in their header, while this is not the case for packets coming from my laptop.
I suspect that my device needs fragmentation to handle the packets, and therefore drops packets if the DF bit is set.
Is there any way to make sure the DF bit is not set for packets coming from the XPC?
Best,
Mark
  3 Comments
Mark V
Mark V on 8 Apr 2014
They are relatively small packets, e.g. containing a string such as "set state enable". Payload won't exceed approx. 200 bytes, so I guess the maximum transmission unit shouldn't be exceeded.
(This made me wonder why the device I'm sending to wants to fragment the packets in the first place, but I can't make any modifications to it and have to take it as it is.)
Walter Roberson
Walter Roberson on 8 Apr 2014
If the packet fits within the MTU, then according to the standards, setting DF is not an error. Setting DF on a call is a technique used in some operating systems to force the packet to not be buffered, which connects to the fact that UDP can be used in Socket mode or in Stream mode.
It is possible that the device's stack does not handle the DF bit properly.
I do not know if the DF bit is configurable in XPC.

Sign in to comment.

Answers (1)

Suneesh
Suneesh on 8 Apr 2014
It is not possible to UN-set the DF flag for packets that are sent from a target using real-time UDP blocks. The blocks are designed this way due to the real-time UDP protocol stack in the target currently not supporting fragmented packets. So if the target is unable to send fragmented IP packets the "do not fragment" flag should always be set.
I tested using the (non real-time UDP) packets in the xPC Target library. They behave similarly, except that when run on the host they can cause fragmentation since the Windows (host OS) drivers are used. DId you not use these blocks? If you did then as long as the data is accommodated within the max MTU size (1512) of the Ethernet packets, the DF bit would still be set. Only when the pack size exceeds this, will the DF flag be unset since the data will be fragmented and sent out.
  6 Comments
Mark V
Mark V on 10 Apr 2014
Thanks for the feedback nevertheless :)
Suneesh
Suneesh on 14 Apr 2014
The "Flags" parameter on the IP Init block does not have anything to do with the DF flag. It sets other flags that are used internally, such as disabling ICMP etc.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!