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

Position module should enforce precision for phone originated BROADCAST position packets #3752

Merged
merged 1 commit into from
May 1, 2024

Conversation

thebentern
Copy link
Contributor

@thebentern thebentern commented Apr 30, 2024

No description provided.

@GUVWAF
Copy link
Member

GUVWAF commented Apr 30, 2024

I'm afraid this only works for broadcasts and not for DMs because the packet from the phone comes in at PhoneAPI::handleToRadio() and then MeshService::handleToRadio() and eventually in Router::sendLocal() it calls handleReceived() (where the modules are called and thus packet will be altered) only when it's a broadcast:

// If we are sending a broadcast, we also treat it as if we just received it ourself
// this allows local apps (and PCs) to see broadcasts sourced locally
if (p->to == NODENUM_BROADCAST) {
handleReceived(p, src);

@thebentern
Copy link
Contributor Author

I'm afraid this only works for broadcasts and not for DMs because the packet from the phone comes in at PhoneAPI::handleToRadio() and then MeshService::handleToRadio() and eventually in Router::sendLocal() it calls handleReceived() (where the modules are called and thus packet will be altered) only when it's a broadcast:

Good point. We generally only see position DMs in the case of the "Exchange positions" feature in the nodes list for the apps, right? Do you have any thoughts on a better place to dilute the precision? Hoping to avoid making changes at the end of the pipeline.

@GUVWAF
Copy link
Member

GUVWAF commented Apr 30, 2024

In the iOS app you can also send your position in a DM.

Yeah, it's hard, I've not found a nice place to put this yet.

@thebentern
Copy link
Contributor Author

thebentern commented Apr 30, 2024

In the iOS app you can also send your position in a DM.

Perhaps, this is a messaging issue we can just call out better? I could even make the case that when you explicitly DM a position to a node, you want the full precision.

@jp-bennett
Copy link
Collaborator

In the iOS app you can also send your position in a DM.

Perhaps, this is a messaging issue we can just call out better? I could even make the case that when you explicitly DM a position to a node, you want the full precision.

Yeah, I'd argue that a DM only incidentally uses a channel, and shouldn't use the channel's precision setting.

@garthvh
Copy link
Member

garthvh commented Apr 30, 2024

In the iOS app you can also send your position in a DM.

Perhaps, this is a messaging issue we can just call out better? I could even make the case that when you explicitly DM a position to a node, you want the full precision.

Yeah, I'd argue that a DM only incidentally uses a channel, and shouldn't use the channel's precision setting.

Same

@thebentern thebentern marked this pull request as ready for review April 30, 2024 21:21
@jp-bennett
Copy link
Collaborator

Same

Though maybe with a warning for the security conscious, that it does re-use the channel password, so could be intercepted.

@thebentern thebentern changed the title Position module should enforce precision for phone originated position packets Position module should enforce precision for phone originated BROADCAST position packets Apr 30, 2024
@thebentern
Copy link
Contributor Author

We already have the caveat of DMs only being private in a sense within the channel. Not sure how / where we want to admonish the user.

@garthvh
Copy link
Member

garthvh commented May 1, 2024

We already have the caveat of DMs only being private in a sense within the channel. Not sure how / where we want to admonish the user.

I can figure it out, I am the only client with this functionality currently.

Copy link
Member

@garthvh garthvh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it

@thebentern thebentern requested a review from andrekir May 1, 2024 01:11
@thebentern
Copy link
Contributor Author

@andrekir will this work on the Android app as well? I want to make sure I don't double dip on reducing precision for channel.

@andrekir
Copy link
Member

andrekir commented May 1, 2024

@andrekir will this work on the Android app as well? I want to make sure I don't double dip on reducing precision for channel.

Android only sends position to the local node (phone GPS) with full precision, so should be good.

@thebentern thebentern merged commit 57da37c into master May 1, 2024
71 checks passed
@thebentern thebentern deleted the firmware-enforced-precision branch May 1, 2024 13:05
@garthvh
Copy link
Member

garthvh commented May 2, 2024

Closes meshtastic/Meshtastic-Apple#617

@ianmcorvidae
Copy link
Contributor

Glad to see this since I just added request position to Python too. I believe I shouldn't need to do anything special to get this? i.e. sending a regular want-response position packet with the full-precision will get diluted by this

@thebentern
Copy link
Contributor Author

Glad to see this since I just added request position to Python too. I believe I shouldn't need to do anything special to get this? i.e. sending a regular want-response position packet with the full-precision will get diluted by this

Yes, if it's sent as a broadcast, it will be diluted based on the channel's precision. DMs will get full precision positions.

@ianmcorvidae
Copy link
Contributor

Ah, okay, so this isn't terribly valuable for the request-positions type features, since those are rarely broadcast. Still potentially valuable for things that do get sent broadcast.

Maybe more relevant, though: I guess that the PositionModule also handles packets promiscuously, so (if I'm understanding right), those DM'd positions will still update the nodedbs for those on the same channel who aren't the destination of the DM. That might be an unintended effect here -- unsure?

@garthvh
Copy link
Member

garthvh commented May 3, 2024

When you add persistence you need to make sure and only use node info, positions and messages that are DMs to update the appropriate node

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

Successfully merging this pull request may close these issues.

6 participants