darling
darling copied to clipboard
Defer to host for networking/DNS
Darling currently does DNS resolution itself. Ideally, we should instead defer to the host's libc for networking calls. That way, we get the host's networking/DNS setup "for free".
Problem
- Darling's current networking setup is disjoint from the host's setup.
- We have our own
resolv.confwhich has its own DNS servers, different from what the user might want on the host. - This means that, if users want the same setup in Darling, they'll need to duplicate their work and make sure to keep it in sync with their host configuration.
- We have our own
- There are certain additional configurations which can be set up on the host that would require significant work to support in Darling with the current model (e.g. mDNS resolution).
Solution
- Use libelfloader to call into the host's libc and have it perform DNS resolution for us.
- It should be okay to keep using Apple's libinfo, because it's modular and actually uses resolvers to perform the resolution.
- What would have to change is our current
darling-resolver; it would need to make libelfloader calls instead of calling into libresolv. - Similarly, we should modify libresolv to call into the host (for applications that use it directly). This one will require a bit more intrusion (i.e. function replacement).