-
-
Notifications
You must be signed in to change notification settings - Fork 18
Invalid Decoding JoinRequest on mipsel #52
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
Comments
The problem seems to come from the base64 library, i made little poc to simple decode base64 string, follwoing oficial documention I obtain this use base64::prelude::*;
fn main() {
assert_eq!(BASE64_STANDARD.decode(b"+uwgVQA=").expect("panic"), b"\xFA\xEC\x20\x55\0");
assert_eq!(BASE64_STANDARD.encode(b"\xFF\xEC\x20\x55\0"), "/+wgVQA=");
} on my pc ./base64_test
echo $?
0 All it's ok But on gateway with
This is exactly the same probleme. The problem could be come cross-rs, but I don't know. |
Maybe the compiler. Maybe we should develop our custom base64 decoding for this architecture |
Thanks for reporting. This sound very similar to #50. |
I can confirm that I was able to reproduce this issue. After compiling using the latest Rust toolchain, everything works as expected. I think this was a toolchain related issue. As mips has been moved to a tier 3 target, I have made the following change in the I'm creating a new release right now, which should be available shortly. |
This was released as v4.2.0. |
I just compiled it and it works on my gateway. |
Sorry, v4.2.1 re-introduces this issue because I downgraded the Rust toolchain because of nightly build issues (I forgot about that this might cause this issue). I will release a v4.2.2 shortly. |
MIPS has moved to tier 3, we need the nightly version for cross-compilation to this target. To avoid this, I reverted back to 1.74.1 (latest version with MIPS toolchain pre-compiled), however this re-introduces #52. Currently the latest nightly version returns an error during build: undefined reference to `pthread_getname_np'
Hello,
I have an importante issue.
What happened?
When the MQTT Forwarder deserialize JoinRequest Frame from Semtech UDP GWMP Frame, the MIC code is badly decoded.
For exemple the Semtech UDP GWMP JoinRequest have this MIC code
[1 192 29 90]
but after decoding by MQTT Forwarder have this[1 192 28 90]
.All my JoinRequest with MQTT Packet Forwarder are in MIC Error.
I am sur the problem appears during json deserialization, especially when decoding the payload in base64.
How I found?
I added in code a debug print (only for me), before and After this line https://github.com/chirpstack/chirpstack-mqtt-forwarder/blob/8b2ed3d2a2bc1aab8d11a6a78a2d09929be983b9/src/backend/semtech_udp/mod.rs#L342C5-L342C51
Like this.
And I obtained this :
RAW UDP GWMP Frame :
Manual decoding I optain this Payload in JSON
This LoRaWAN DATA
Contain this MIC
But after
let pl = structs::PushData::from_slice(data)?;
When MQTT Forwarder deserialize the RAW UDP GWMP and decode the DATA of Payload Frame I obtaine this LoRaWAN Frame
The mic code does not correspond to the UDP frame.
GOOD
01c01d5a
, BAD01c01c5a
Material
Gateway :
RAK7268CV2
uname :
Linux RAK7268CV2 5.4.154 #0 Fri Nov 24 07:30:08 2023 mips GNU/Linux
cpuinfo :
OS :
WisGateOS_2.2.1_RAK
based onOpenWRT 21.2
Toolchain :
make dist-mipsel-unknown-linux-musl
The text was updated successfully, but these errors were encountered: