-
Notifications
You must be signed in to change notification settings - Fork 964
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
Add MQTT exception for private IP address server #5072
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this and congratulations on your first patch to Meshtastic :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this catch something sneaky like 10.mydomain.com? I started working on this a couple days ago, and went down that rabbit hole. I think we should check that we only have dots and decimals in the address.
@jp-bennett Might be able to do that with some regex to make sure it's an IP first?
|
I can only imagine how much flash space adding regex to the firmware is going to cost. We only need to check once per boot. Just make a char array of "0123456789." and a nested for loop. |
@jp-bennett Yup, didnt think of that, how about cstring as this is already loaded in many places in the firmware?
Just trying to keep memory safe and keep things in bounds (avoid buffer overflows etc) |
Good catch on decimal prefixes of domains. I'll include the check in the next iteration (avoiding regex). |
Thanks for the additional review folks. |
@Talie5in, it's great to see your idea of confirming a valid IPv4, but for the simple purpose of determining whether to consider the server as a private address or not, I think it's more than what's required. As long as we can determine it's not a valid domain (i.e. it has only digits and dots) I think that's sufficient. If we determine it's a private address after that, even if it's not a valid address, I don't think it matters since a connection will never be able to be made anyway. |
@JohnathonMohr All goodly! |
Related to issue #5000 and implementing what was suggested in #5023.
Allowing MQTT publishing regardless of the flag setting if the server being published to is local (for local automation scenarios).
I have not completed testing yet, but wanted to get early feedback.