-
Notifications
You must be signed in to change notification settings - Fork 518
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
[network] interface-aware DNS lookups #2864
base: develop
Are you sure you want to change the base?
Conversation
78ff74d
to
069beee
Compare
third_party/lwip/lwip
Outdated
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.
roundRobinInterfaceForDns_++; | ||
} | ||
} | ||
CHECK(getCloudHostnameAndPort(&info, &type, !fullTest, iface)); |
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.
Will using the iface
from the round robin selection above filter out all the other resolved addresses from the other interfaces dns_table
s?
Are we relying on there being multiple entries in info
in order to implicitly associate a resolved address with a network interface? Do we only test one interface with this change?
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.
I guess in situations where lastTestFailed
did not fail, we will still test all interfaces. IE iface = NETWORK_INTERFACE_ALL
. So in effect, we will round robin test 1 interface at a time with its DNS until it succeeds. Then all subsequent tests will use all available interfaces
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.
Something like that, yes. It's just a trade-off to get out of this weird state:
This may have undesired effect even on cloud connectivity. For example, in case of M SoM with eth, wifi and cellular available, but eth and wifi providing bogus DNS responses (app firewall or other reasons), while the connection can still be performed over cellular, it might fail because we are unable to correctly resolve cloud server address.
Again, ideally during the test we'd resolve X number of times per each iface with its set of servers, but it's a blocking call and might take a while, so as a trade off - normally we use NETWORK_INTERFACE_ALL - so the default prioritization in DNS server list, in case we see a complete reachability failure we'll round robin through all ifaces/their dns servers to try to correctly resolve, yes, this might take several iterations - but we'll recover. And cloud connection layer subsequently will use the same servers/interface to resolve before establishing connection.
069beee
to
f7ac87e
Compare
Problem
Despite the fact that we store all interface-specific DNS servers (statically configured or over DHCP/PPP etc) the resolver only uses the first and then on failure subsequent servers in this table. There is no API to tell the resolver to use only interface X.
This may have undesired effect even on cloud connectivity. For example, in case of M SoM with eth, wifi and cellular available, but eth and wifi providing bogus DNS responses (app firewall or other reasons), while the connection can still be performed over cellular, it might fail because we are unable to correctly resolve cloud server address.
Solution
Steps to Test
TODO
References
particle-iot/lwip#17
Completeness