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

Re-join by UDP gives MAC Payload decrypt error #19

Open
scartill opened this issue Apr 28, 2020 · 4 comments
Open

Re-join by UDP gives MAC Payload decrypt error #19

scartill opened this issue Apr 28, 2020 · 4 comments

Comments

@scartill
Copy link
Collaborator

When trying to join an already joined device via UDP, "downlink error : MACPayload must be of type*MACPayload" happens

@Gillani0
Copy link

Hi @scartill

As we discussed earlier, there was this same issue with the join and rejoin request. After some debugging I've found the culprit.

To decrypt the Join Accept payload, you're using Nwkey, however, you need to use the AppKey. So on this line in lds.go, you need to change d.NwkKey --> d.AppKey. This will properly decode it and will solve the problem. Cheers

Syed

@scartill
Copy link
Collaborator Author

scartill commented Apr 29, 2020

HI @Gillani0

The problem is that the code you point to already assumes that a downlink is a frame, whereas on rejoin it is in fact a join response, hence the wrong key is chosen. So the real problem resides upstream the call chain here.

Boris

@4br3mm0rd
Copy link

Hi everyone,

I read in LoRa's Specification that sending a Re-Join Request requires to change the headers of the PHYPayload. Is this automatically done when clicking the Join button once we already have the Session Keys? Or does LDS send a regular Join Request?

When I press Join after receiving the Session Keys, the request is sent, but my app server throws an error: "object already exists".

I guess in terms of implementations, it would be easier to have a Re-Join button, this could also solve this issue by waiting for the Join-Accept after sending it? Or maybe before decrypting, LDS should check the MType?

(I am quite bad at Go, so I'm trying to help this way, I hope I'm not offending or wasting your time)

@scartill
Copy link
Collaborator Author

scartill commented Jun 6, 2020

Hi @4br3mm0rd ! May thanks for pointing out, separate "re-join" seem more reasonable since we target a flexible simulator, not a regular device. I've been overwhelmed a bit in recent weeks, but will take a look a.s.a.p, and proceeed with new GUI as well.

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

3 participants