Commit Graph

23 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 5248e7e1f1 resolved,nss-myhostname: use _gateway for the gateway
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.
2017-07-31 14:41:56 -04:00
Lennart Poettering d91e8e1b69 hostname-util: default to the compile time default hostname in gethostname_malloc()
Currently, if the hostname is not set gethostname_malloc() defaults to
the "sysname", which is "linux" on Linux. Let's change that to also
honour the compile-time fallback hostname as specified on the configure
command line.
2017-02-17 10:19:26 +01:00
Lennart Poettering 2ae0858e6c hostnamectl: rework pretty hostname validation (#3985)
Rework 17eb9a9ddb a bit.

Let's make sure we don't clobber the input parameter args[1], following our
coding style to not clobber parameters unless explicitly indicated. (in
particular, as we don't want to have our changes appear in the command line
shown in "ps"...)

No functional change.
2016-08-18 21:16:16 -04:00
Zbigniew Jędrzejewski-Szmek 77384fb0ed Merge pull request #2959 from keszybz/stop-resolving-localdomain
*.localdomain != localhost
2016-04-04 22:06:37 -04:00
David R. Hedges 63003524cb *.localdomain != localhost
".localdomain" is not a reserved suffix (or prefix). I'm not aware of any
product expecting *.localdomain to resolve to localhost, however I am aware of
at least one product that defaults to ".localdomain" as its DNS suffix provided
via DHCP (pfSense). This leads to unexpected results when attempting to access
a host that's offline (or a host that's online, when nsswitch.conf is
[mis-]configured to have myhostname ahead of DNS).

Operate on:
localhost (and localhost.)
*.localhost (and *.localhost.)
localhost.localdomain (and localhost.localdomain.)
*.localhost.localdomain (and *.localhost.localdomain.)

We should not cover:
*.localdomain (nor *.localdomain.)
localdomain (nor localdomain.)
2016-04-04 13:28:57 -04:00
Thomas Blume 46e1a22781 shorten hostname before checking for trailing dot
Shortening can lead to a hostname that has a trailing dot.
Therefore it should be done before checking from trailing dots.
2016-02-29 10:19:01 +01:00
Lennart Poettering 0ab0c01490 Merge pull request #2717 from keszybz/networkctl-prettification
Networkctl prettification
2016-02-23 16:54:52 +01:00
Zbigniew Jędrzejewski-Szmek 953d28cc21 Fix two typos 2016-02-23 08:48:22 -05:00
Vito Caputo 313cefa1d9 tree-wide: make ++/-- usage consistent WRT spacing
Throughout the tree there's spurious use of spaces separating ++ and --
operators from their respective operands.  Make ++ and -- operator
consistent with the majority of existing uses; discard the spaces.
2016-02-22 20:32:04 -08:00
Lennart Poettering 8e1ad1eaf7 networkd: add basic LLDP transmission support
Let's add some minimalistic LLDP sender support. The idea is that this is
either on or off, and all fields determined automatically rather than
configured explicitly.
2016-02-21 20:58:59 +01:00
Nathan McSween e306723ec4 Remove/add (un)needed includes 2016-02-18 23:34:30 +00:00
Daniel Mack b26fa1a2fb tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file.
2016-02-10 13:41:57 +01:00
Thomas Hindoe Paaboel Andersen 11c3a36649 basic: include only what we use
This is a cleaned up result of running iwyu but without forward
declarations on src/basic.
2015-11-30 21:51:03 +01:00
Beniamino Galvani 06d91ad77e hostname-util: fix code comment 2015-11-17 15:06:01 +01:00
Lennart Poettering 0d39fa9c69 util-lib: move more file I/O related calls into fileio.[ch] 2015-10-27 13:25:55 +01:00
Lennart Poettering 3ffd4af220 util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over.
2015-10-25 13:19:18 +01:00
Lennart Poettering 07630cea1f util-lib: split our string related calls from util.[ch] into its own file 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.
2015-10-24 23:05:02 +02:00
Lennart Poettering b59abc4d1e util: make hostname_is_valid() easier to read
Add more comments, and rename some parameters and variables to be more
expressive.
2015-08-24 22:46:45 +02:00
Lennart Poettering 46a5e0e742 hostname-util: introduce new is_gateway_hostname() call
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).
2015-08-21 12:07:13 +02:00
Zbigniew Jędrzejewski-Szmek 90365b043a hostname-util: ignore case when checking if hostname is localhost 2015-08-05 20:49:21 -04:00
Zbigniew Jędrzejewski-Szmek ae691c1d93 hostname-util: get rid of unused parameter of hostname_cleanup()
All users are now setting lowercase=false.
2015-08-05 20:49:21 -04:00
Zbigniew Jędrzejewski-Szmek 8fb4944358 hostname-util: add relax parameter to hostname_is_valid
Tests are modified to check behaviour with relax and without relax.
New tests are added for hostname_cleanup().
Tests are moved a new file (test-hostname-util) because there's
now a bunch of them.

New parameter is not used anywhere, except in tests, so there should
be no observable change.
2015-08-05 20:49:20 -04:00
Kay Sievers a095315b3c build-sys: split internal basic/ library from shared/
basic/      can be used by everything
            cannot use anything outside of basic/

libsystemd/ can use basic/
            cannot use shared/

shared/     can use libsystemd/
2015-06-11 10:52:46 +02:00
Renamed from src/shared/hostname-util.c (Browse further)