resolved: extend ResolveHostname() bus call so that it can parse IP addresses
authorLennart Poettering <lennart@poettering.net>
Sat, 13 Feb 2016 19:26:30 +0000 (20:26 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 13 Feb 2016 19:33:49 +0000 (20:33 +0100)
commitc3be369faa5f73c3b97c0088876bafdbfef43dae
tree20de1d39881f77e3099a4c78ae310bd7360f2448
parentee116b54a3d0feb3f724f87ccf3f4cbb647d7e73
resolved: extend ResolveHostname() bus call so that it can parse IP addresses

If the hostname passed to ResolveHostname() is actually an IP address that is
correctly formatted as string parse it as such, avoid any DNS traffic and
return the data in parsed form.

This is useful for clients which can simply call the bus function now without
caring about the precise formatting of specified hostnames. This mimics
getaddrinfo()'s behaviour with the AI_NUMERICHOST flag set.

Note that this logic is only implemented for ResolveHostname(), but not for
calls such as ResolveRecord(), for which only DNS domain names may be used as
input.

The "authenticated" flag is set for look-ups of this type, after all no
untrusted network traffic is involved.
src/resolve/resolved-bus.c