-
Notifications
You must be signed in to change notification settings - Fork 594
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
message CRC checksum is wrong when a mavlink_message_t is converted to a sending buffer #237
Comments
This is the patch:
|
Something to check in the next mavlink call. @hamishwillee can you table this or add the tag please? Thx. |
Thanks Julian
Regards,
James
… On 7 Nov 2018, at 7:31 pm, Julian Oes ***@***.***> wrote:
Something to check in the next mavlink call.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Perhaps better to regenerate this as a PR so that it can be merged if approved? Possibly I'm missing something, but I don't understand why there is an expectation that the @julianoes What is it that you want to discuss about this? I have added to the 20181114 but is intention just getting review or determining whether this is even a good idea? Or to put it another way, why not follow normal PR process? As an aside:
|
the use case is like this: |
@WeifengY Thank you for the more detailed explanation. Some thoughts:
Interested to hear what others think about this. It may be that we should make the code robust enough to handle this case even if it is "off spec" (and I'm not saying it definitely is!) |
@hamishwillee @julianoes |
I believe I do understand what you are saying. The incoming message comes in "untrimmed" and with a CRC calculated for the untrimmed string. You can't use the original CRC from the incoming message because My issue with this is not what is happening, but what the right response should be given that the incoming message is not compliant with the spec. After all, you're adding a CRC calculation to every single time this method is used - even though it should not be needed if the incoming message was correct. @julianoes @auturgy Do you have an opinion? |
@hamishwillee , |
There are two options:
In any case, trim a message without recalculating CRC is incorrect. |
@haiyangyuneec @WeifengY we discussed this in the mavlink coordination call trying to understand it and come to a solution. We wondered again which implementation sends untrimmed mavlink 2? Is it one of the open-source ones? We agreed that the spec is not clear on whether you have to trim the zeros or not, so it probably makes sense that messages with zeros get correctly parsed. It was brought up in the call that you should be using the I also found the function My takeaway after reading all this and the notes at the meeting is that your change makes sense, or at least is a valid workaround for this edge case that exists because the spec is not clear. I suggest that you make a pull request with the change, and hopefully we can get it reviewed. |
Hi @julianoes , |
@WeifengY oh got it. You need to make a fork and make the pull request from there: |
@haiyangyuneec @WeifengY See ... We wondered again which implementation sends untrimmed mavlink 2? Is it one of the open-source ones? |
I'll find some people to get the answer of this question. It may take some time. |
@julianoes . Well, your instruction helps. I made the pull request. #241 |
Hi @julianoes, @hamishwillee , |
Hi @WeifengY Thank you.
Even though we are probably going to add support for handling this kind of message, it is non compliant. I have added a PR to make this clearer in the docs: mavlink/mavlink-devguide#135 Can you forward this information to the implementation and let them know that they should change this? |
Again, if untrimmed message is invalid, please check these, a. The mavlink parse should NOT parse message or accept it, since message with zero at end of itself is INVALID. |
@haiyangyuneec The spec has always said that messages should be trimmed, but that was not forceful enough. The spec mentioned did not mention the case of receiving untrimmed messages because we assumed there would be no one sending such messages. However now that we have a non compliant sender we have a choice to accept the messages or not. This update to the spec says that we will. If you disagree, then please add your reasons as a response to mavlink/mavlink-devguide#135 |
I am quite confused. Why accept invalid message and the parser can get invalid message out of the stream? Even accept the invalid message, the trim logic is definitely wrong without recalculating crc after trimming. Everything is clear and it is up to you to fix such bug or not. |
Hi @hamishwillee , |
Note that neither the refinement to the spec or the PR have been accepted. We don't have a test case for this so even though allows this is easy for C we need to have a look at the other language bindings too. A test case is being written. BUT, if it is possible then ...
Because we wanted to make things easier for you, and because it is easy to do with our current implementation. Even though we will effectively allow non-compliant messages to be sent by letting systems handle them, we can still go to vendors who are sending untrimmed zeros and say "you're not compliant". This means we can encourage the right behaviour without breaking you.
Just to be clear, the proposed refinement to the spec will require the non-compliant messages to be resent. I just changed mavlink/mavlink-devguide#135 to make that clear. But again, it might not happen if the effort to update the other implementations is too great. As you say, in some ways it is better to just reject the invalid messages and remove any confusion or doubt. |
any movement on this? |
@magicrub No. This is waiting on "someone" to write a test case for mavlink 2 untrimmed messages. FWIW IMO we'd have been better saying they are not allowed. |
patch is attached.
recalculate_crc_if_payload_changes.zip
The text was updated successfully, but these errors were encountered: