summaryrefslogtreecommitdiff
path: root/src/resolve-host/resolve-host.c
Commit message (Collapse)AuthorAgeFilesLines
* parse-util: introduce parse_ifindex() and make use of it everywhereLennart Poettering2015-11-031-3/+2
| | | | | We have enough places where we parse an ifindex, hence introduce a proper parsing function for it, that verifies all parameters.
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util: introduce common version() implementation and use it everywhereLennart Poettering2015-09-291-8/+5
| | | | | | This also allows us to drop build.h from a ton of files, hence do so. Since we touched the #includes of those files, let's order them properly according to CODING_STYLE.
* tree-wide: drop {} from one-line if blocksLennart Poettering2015-09-091-2/+1
| | | | Patch via coccinelle.
* resolve-host: support parsing numeric interface namesLennart Poettering2015-08-241-5/+15
| | | | | | If the user specifies an interface by its ifindex we should handle this nicely. Hence let's try to parse the ifindex as a number before we try to resolve it as an interface name.
* resolve-host: Minor wording improvementLennart Poettering2015-08-211-2/+2
|
* resolved: when passing RRs across the bus, make sure not to use name compressionLennart Poettering2015-08-211-0/+2
| | | | | | We explicitly need to turn off name compression when marshalling or demarshalling RRs for bus transfer, since they otherwise refer to packet offsets that reference packets that are not transmitted themselves.
* resolved: rework synthesizing logicLennart Poettering2015-08-211-68/+65
| | | | | | | | | | | | | | | | | | | With this change we'll now also generate synthesized RRs for the local LLMNR hostname (first label of system hostname), the local mDNS hostname (first label of system hostname suffixed with .local), the "gateway" hostname and all the reverse PTRs. This hence takes over part of what nss-myhostname already implemented. Local hostnames resolve to the set of local IP addresses. Since the addresses are possibly on different interfaces it is necessary to change the internal DnsAnswer object to track per-RR interface indexes, and to change the bus API to always return the interface per-address rather than per-reply. This change also patches the existing clients for resolved accordingly (nss-resolve + systemd-resolve-host). This also changes the routing logic for queries slightly: we now ensure that the local hostname is never resolved via LLMNR, thus making it trustable on the local system.
* resolve-host: print RTTTom Gundersen2015-08-161-4/+24
|
* resolve-host: enable auto start of resolvedLennart Poettering2015-08-161-4/+0
| | | | | | | | | There's no reason to explicitly turn off bus activation for resolved here. The reason this was done before was that the code was copied from nss-resolve, which has a fallback to glibc's nss-dns if resolved is not reachable. However, such a logic makes no sense for resolve-host since such a fallback doesn't make sense here, which means we can actually turn on activation. Let's do it hence.
* resolve-host: enable dbus-activationDavid Herrmann2015-07-091-4/+0
| | | | | | | | Right now, systemd-resolve-host fails if resolved is not running. However, resolved supports bus-activation (at least on kdbus) just fine. Enable this so we can use resolve-host at all times. This was disabled right from the beginning, without any comment why.
* sd-bus: introduce new sd_bus_flush_close_unref() callLennart Poettering2015-07-031-1/+1
| | | | | | | | | | | | | | | | sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush() (which writes all unwritten messages out) + sd_bus_close() (which terminates the connection, releasing all unread messages) + sd_bus_unref() (which frees the connection). The combination of this call is used pretty frequently in systemd tools right before exiting, and should also be relevant for most external clients, and is hence useful to cover in a call of its own. Previously the combination of the three calls was already done in the _cleanup_bus_close_unref_ macro, but this was only available internally. Also see #327
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-2/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* sd-bus: move common errors src/shared/bus-errors.h → ↵Lennart Poettering2014-12-101-1/+1
| | | | | | src/libsystemd/sd-bus/bus-common-errors.h Stuff in src/shared/ should not use stuff from src/libsystemd/ really.
* treewide: another round of simplificationsMichal Schmidt2014-11-281-4/+2
| | | | | Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-281-1/+1
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-281-2/+2
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-281-2/+2
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* cmdline: for new tools avoid introduce new negative switches, and properly ↵Lennart Poettering2014-08-201-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | align --help texts Negative switches are a bad un-normalized thing. We alerady have some, but we should try harder to avoid intrdoucing new ones. Hence, instead of adding two switches: --foobar --no-foobar Let's instead use the syntax --foobar --foobar=yes --foobar=no Where the first two are equivalent. The boolean argument is parsed following the usual rules. Change all new negative switches this way. This patch also properly aligns the --help table, so that single char switches always get a column separate of the long switches.
* resolved: allow passing on which protocol, family and interface to look ↵Lennart Poettering2014-08-141-40/+98
| | | | | | something up Also, return on which protocol/family/interface we found something.
* resolve-host: properly align long arguments in help textLennart Poettering2014-08-041-1/+1
|
* bus: always explicitly close bus from main programsLennart Poettering2014-08-041-1/+1
| | | | | | | | | | | | | | Since b5eca3a2059f9399d1dc52cbcf9698674c4b1cf0 we don't attempt to GC busses anymore when unsent messages remain that keep their reference, when they otherwise are not referenced anymore. This means that if we explicitly want connections to go away, we need to close them. With this change we will no do so explicitly wherver we connect to the bus from a main program (and thus know when the bus connection should go away), or when we create a private bus connection, that really should go away after our use. This fixes connection leaks in the NSS and PAM modules.
* resolve-host: fix missed search&replaceZbigniew Jędrzejewski-Szmek2014-08-031-1/+1
|
* resolve-host: make arg_type an intZbigniew Jędrzejewski-Szmek2014-08-031-3/+5
| | | | We are using it also to store _DNS_TYPE_INVALID, so it should be signed.
* Unify parse_argv styleZbigniew Jędrzejewski-Szmek2014-08-031-2/+1
| | | | | | | | | | | | | | | | getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
* resolve-host: use correct format specifierThomas Hindoe Paaboel Andersen2014-08-031-1/+1
|
* resolve-host: list types and classesZbigniew Jędrzejewski-Szmek2014-07-311-0/+46
| | | | Also update systemctl to similar style.
* resolved: add API for resolving specific RRsLennart Poettering2014-07-301-8/+141
|
* resolve-host: add reverse lookup supportLennart Poettering2014-07-301-28/+167
|
* resolve-host: use the usual log message when encountering a dbus parse failureLennart Poettering2014-07-301-34/+21
|
* resolved: add tool to query resolvedZbigniew Jędrzejewski-Szmek2014-07-301-0/+270