summaryrefslogtreecommitdiff
path: root/src/nss-myhostname
Commit message (Collapse)AuthorAgeFilesLines
* nss-myhostname: do not return empty result with NSS_STATUS_SUCCESSYu Watanabe2023-02-091-2/+3
| | | | | | Fixes a bug introduced by db50d326a46beca3cc24b6354b6e1b3591902d45. Fixes RHBZ#2167468 (https://bugzilla.redhat.com/show_bug.cgi?id=2167468).
* nss-myhostname: fix inverted condition inYu Watanabe2023-02-091-1/+1
| | | | Fixes a bug introduced by db50d326a46beca3cc24b6354b6e1b3591902d45.
* resolved: introduce common macro for 127.0.0.2 IP addressLennart Poettering2022-11-251-1/+2
|
* nss-myhostname: do not return IPv6 local address if IPv6 is disabledYu Watanabe2022-04-231-30/+36
|
* nss-myhostname: do not apply non-zero offset to null pointerYu Watanabe2021-12-311-3/+3
| | | | Fixes https://github.com/systemd/systemd/issues/21935#issuecomment-1003216503.
* nss-myhostname: expose the "outbound" IP addresses under the synthetic ↵Lennart Poettering2021-04-231-2/+17
| | | | | | | | | | | "_outbound" hostname I found myself often looking for a quick way to determine "the local IP address", and then being lost in the "ip addr" output to find for the right one to use. This is supposed to help a bit with that. Let's introduce a new special hostname "_outbound" with semantics similar to "_gateway" that resolves to addresses that are the closest I could come up with that maps to "the" local IP address.
* tree-wide: use in_addr_is_set() or friendsYu Watanabe2021-02-181-1/+1
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-092-2/+2
|
* tree-wide: use "hostname" spelling everywhereZbigniew Jędrzejewski-Szmek2020-04-211-1/+1
| | | | | | | | It's not that I think that "hostname" is vastly superior to "host name". Quite the opposite — the difference is small, and in some context the two-word version does fit better. But in the tree, there are ~200 occurrences of the first, and >1600 of the other, and consistent spelling is more important than any particular spelling choice.
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-041-1/+0
|
* nss-myhostname: unify code that handles NOT_FOUND caseLennart Poettering2019-04-111-16/+16
| | | | Just some minor rework to make this more like nss-resolve.
* util: split out errno related stuffLennart Poettering2019-03-141-1/+1
|
* nss: unportect errno before writing to NSS' *errnopLennart Poettering2019-02-081-0/+13
| | | | Fixes: #11321
* Revert "nss: prevent PROTECT_ERRNO from squashing changes to *errnop"Zbigniew Jędrzejewski-Szmek2019-01-101-12/+11
| | | | | | | This reverts commit b26c90411343d74b15deb24bd87077848e316dab. I don't see anythign wrong, but Ubuntu autopkgtest CI started failing fairly consistently since this was merged. Let's see if reverting fixes things.
* nss: prevent PROTECT_ERRNO from squashing changes to *errnopSam Morris2019-01-101-11/+12
| | | | | | | glibc passes in &errno for errnop, which means PROTECT_ERRNO ends up squashing our intentional changes to *errnop. Fixes #11321.
* nss: do not modify errno when NSS_STATUS_NOTFOUND or NSS_STATUS_SUCCESSYu Watanabe2018-07-251-9/+7
| | | | | | | | | This also adds PROTECT_ERRNO for all nss module functions. C.f. glibc NSS documents https://www.gnu.org/software/libc/manual/html_node/NSS-Modules-Interface.html and discussion in https://sourceware.org/bugzilla/show_bug.cgi?id=23410. Fixes #9585.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-3/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-142-4/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Add SPDX license headers to various assorted filesZbigniew Jędrzejewski-Szmek2017-11-191-0/+2
|
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* tree-wide: use `!IN_SET(..)` for `a != b && a != c && …`Andreas Rammhold2017-10-021-1/+1
| | | | | | The included cocci was used to generate the changes. Thanks to @flo-wer for pointing this case out.
* Merge pull request #6420 from keszybz/gateway-nameLennart Poettering2017-08-011-3/+3
|\ | | | | Rename "gateway" to "_gateway" and other resolved changes
| * resolved,nss-myhostname: use _gateway for the gatewayZbigniew Jędrzejewski-Szmek2017-07-311-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the symbolic name for the default gateway from "gateway" to "_gateway". A new configuration option -Dcompat-gateway-hostname=true|false is added. If it is set, the old name is also supported, but the new name is used as the canonical name in either case. This is intended as a temporary measure to make the transition easier, and the option should be removed after a few releases, at which point only the new name will be used. The old "gateway" name mostly works OK, but hasn't gained widespread acceptance because of the following (potential) conflicts: - it is completely legal to have a host called "gateway" - there is no guarantee that "gateway" will not be registered as a TLD, even though this currently seems unlikely. (Even then, there would be no conflict except for the case when the top-level domain itself was being resolved. The "gateway" or "_gateway" labels have only special meaning when the whole name consists of a single label, so resolution of any subdomain of the hypothetical gateway. TLD would still work OK. ) Moving to "_gateway" avoids those issues because underscores are not allowed in host names (RFC 1123, §2.1) and avoids potential conflicts with local or global names. v2: - simplify the logic to hardcode "_gateway" and allow -Dcompat-gateway-hostname=true as a temporary measure.
* | string-util: add strlen_ptr() helperLennart Poettering2017-07-311-1/+1
|/ | | | | strlen_ptr() is to strlen() what streq_ptr() is to streq(): i.e. it handles NULL strings in a smart way.
* build-sys: drop automake supportZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
| | | | | v2: - also mention m4
* nss: fix error to ERANGE for nss calls with too little buffer space (#5365)Lennart Poettering2017-02-161-4/+4
| | | | | | | This is a follow-up for #5359, fixing the error codes in a similar way for the other NSS modules. (user/group lookup calls don't have h_errnop, hence we don't update that in those cases)
* nss-myhostname: don't fill scopeid for non-link-local addressesLennart Poettering2017-02-091-7/+4
| | | | Inspired by #4465, we shouldn't do this for nss-myhostname either.
* treewide: fix typos and remove accidental repetition of wordsTorstein Husebø2016-07-111-1/+1
|
* tree-wide: htonl() is weird, let's use htobe32() instead (#3538)Lennart Poettering2016-06-151-5/+5
| | | Super-important change, yeah!
* nss-myhostname: remove dead test of variable that was not setZbigniew Jędrzejewski-Szmek2016-04-051-3/+2
|
* nss-myhostname: trivial style fixesZbigniew Jędrzejewski-Szmek2016-04-021-17/+13
|
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* nss: block various signals while running NSS lookupsLennart Poettering2016-01-271-0/+7
| | | | | | | Let's make sure our poll() calls don't get interrupted where they shouldn't (SIGALRM, ...), but allow them to be interrupted where they should (SIGINT, ...). Fixes #1965
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-4/+5
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* hostname-util: introduce new is_gateway_hostname() callLennart Poettering2015-08-211-9/+2
| | | | | | | | | This moves is_gateway() from nss-myhostname into the basic APIs, and makes it more like is_localhost(). Also, we rename it to is_gateway_hostname() to make it more expressive. Sharing this function in src/basic/ allows us to reuse the function for routing name requests in resolved (in a later commit).
* nss-myhostname: use LOOPBACK_IFINDEX instead of if_nametoindex("lo")Lennart Poettering2015-08-141-2/+1
| | | | | | Given that we already hardocde the loopback ifindex, following the kernel's own logic, we can replace the invocation of if_nametoindex("lo") with LOOPBACK_IFINDEX.
* tree-wide: introduce mfree()David Herrmann2015-07-311-2/+1
| | | | | | | | | Pretty trivial helper which wraps free() but returns NULL, so we can simplify this: free(foobar); foobar = NULL; to this: foobar = mfree(foobar);
* util: split all hostname related calls into hostname-util.cLennart Poettering2015-05-181-0/+1
|
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-4/+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.
* nss-myhostname: always will in canonical hostname field when resolving ↵Lennart Poettering2015-01-051-17/+19
| | | | | | addresses to hostnames https://bugs.freedesktop.org/show_bug.cgi?id=87634
* nss-myhostname: introduce is_gateway() similar to the existing is_hostname()Lennart Poettering2014-12-191-2/+9
|
* nss-myhostname: also recognize "gateway."Harald Hoyer2014-12-161-2/+2
| | | | | "gateway." skips adding the domain search path and saves some queries to the nameserver.
* rtnl: when querying local addresses and gateways, take address family into ↵Lennart Poettering2014-12-041-6/+6
| | | | account
* nss-myhostname: always resolve the host name "gateway" to the local default ↵Lennart Poettering2014-12-031-19/+59
| | | | | | | | gateway This is useful inside of containers or local networks to intrdouce a stable name of the default gateway host (in case of containers usually the host, in case of LANs usually local router).
* networkd: add minimal client tool "networkd" to query network statusLennart Poettering2014-08-121-3/+3
| | | | | | | In the long run this should become a full fledged client to networkd (but not before networkd learns bus support). For now, just pull interesting data out of networkd, udev, and rtnl and present it to the user, in a simple but useful output.
* nss: always explicitly reset all error variablesLennart Poettering2014-08-011-0/+10
| | | | | | | glibc appears to be broken if we don't explicitly reset all error variables, let's work around that. https://bugzilla.redhat.com/show_bug.cgi?id=1125975
* nss-myhostname: don't include assert.h twiceLennart Poettering2014-07-231-5/+0
|
* shared: rename PROTO_ADDRESS_SIZE() to FAMILY_ADDRESS_SIZE()Lennart Poettering2014-07-181-3/+3
| | | | | We mostly use "family" to refer to AF_INET, AF_INET6, etc, let's use this terminology here, too