Commit Graph

34678 Commits

Author SHA1 Message Date
Yu Watanabe 5bad7ebdda network: add more log messages in configuring DHCP6 client 2018-08-02 08:37:18 +02:00
Yu Watanabe 1f6860d984 network: add more log messages in configuring DHCP4 client 2018-08-02 08:37:18 +02:00
Yu Watanabe 5e5420d1a1
Merge pull request #9770 from keszybz/etc-resolved-no-address
Slightly more efficient handling of /etc/hosts blacklist entries
2018-08-02 12:54:50 +09:00
Zbigniew Jędrzejewski-Szmek be19cdf31c resolved: change error handling for manager_etc_hosts_read()
The choice what errors to ignore is left to the caller, and the caller is
changed to ignore all errors.

On error, previously read data is kept. So if e.g. an oom error happens, we
will continue to return slightly stale data instead of pretending we have no
entries for the given address. I think that's better, for example when
/etc/hosts contains some important overrides that external DNS should not be
queried for.
2018-08-01 12:45:54 +02:00
Zbigniew Jędrzejewski-Szmek fd373593ba resolved: keep addresses mapped to ::0 in a separate set
We'd store every 0.0.0.0 and ::0 entry as a structure without any addresses
allocated. This is a somewhat common use case, let's optimize it a bit.

This gives some memory savings and a bit faster response time too:
'time build/test-resolved-etc-hosts hosts' goes from 7.7s to 5.6s, and
memory use as reported by valgrind for ~10000 hosts is reduced
==18097==   total heap usage: 29,902 allocs, 29,902 frees, 2,136,437 bytes allocated
==18240==   total heap usage: 19,955 allocs, 19,955 frees, 1,556,021 bytes allocated

Also rename 'suppress' to 'found' (with reverse meaning). I think this makes
the intent clearer.
2018-08-01 12:38:39 +02:00
Zbigniew Jędrzejewski-Szmek 78fc21a11a test-resolved-etc-hosts: add tests for /etc/hosts parsing
Calling 'build/test-resolved-etc-hosts filename' parses just that file.
This is useful to test against https://hosts.ubuntu101.co.za/hosts.
2018-08-01 12:38:39 +02:00
Zbigniew Jędrzejewski-Szmek 37b7cc8d9a resolved: put /etc/hosts hashmaps in a structure and pass that around
This hides the details of juggling the two hashmaps from the callers a bit.
It also makes memory management a bit easier, because those two hashmaps share
some strings, so we can only free them together.

etc_hosts_parse() is made responsible to free the half-filled data structures
on error, which makes the caller a bit simpler.

No functional change. A refactoring to prepare for later changes.
2018-08-01 12:38:34 +02:00
Zbigniew Jędrzejewski-Szmek 8d732e2f71 test-nss-files: simplify module name handling
- drop compatibility with autotools (/.libs/ directory)
- don't special-case "libnss_dns", just try build/libnss_foo.so.2 and libnss_foo.so.2.
  This makes it possible to call e.g. build/test-nss files google.com.
2018-07-31 19:37:49 +02:00
Zbigniew Jędrzejewski-Szmek 5a8b164092 meson: drop parens when appending to list
Meson does not care either way, so let's use the simpler syntax. And files()
already gives a list, so nesting this in a list wouldn't be necessary even
if meson did not flatten everything.
2018-07-31 21:02:01 +09:00
Lennart Poettering 48e0e10ff5
Merge pull request #9760 from yuwata/resolve-etc-hosts-cleanup
resolve: several cleanups of handing /etc/hosts
2018-07-31 10:52:34 +02:00
Evgeni Golov eefe36e64c udev: net_id: document predictable names for SR-IOV virtual devices 2018-07-31 16:41:32 +09:00
Yu Watanabe 7bf8c3ded4 resolve: support address with ifname in /etc/hosts 2018-07-31 16:12:13 +09:00
Yu Watanabe 0351eb1148 resolve: use in_addr_data type for storing address 2018-07-31 15:46:28 +09:00
Yu Watanabe 6c39e02609 basic: introduce in_addr_data_hash_ops 2018-07-31 15:45:38 +09:00
Franck Bui 7f6240fab1 path-util: make use of path_join() in path_make_absolute_cwd() 2018-07-30 16:06:02 +02:00
Franck Bui 9f36a8fb38 tmpfiles: add more tests 2018-07-30 16:04:23 +02:00
Franck Bui addc3e302d tmpfiles: don't follow unsafe transitions in path_set_*()
Since all path_set_*() helpers don't follow symlinks, it's possible to use
chase_symlinks(CHASE_NOFOLLOW) flag to both open the files specified by the
passed paths and check their validity (unlike their counterpart fd_set_*()
helpers).
2018-07-30 16:04:20 +02:00
Franck Bui 1f56e4ce77 fs-util: add new CHASE_NOFOLLOW flag to chase_symlinks()
This flag mimics what "O_NOFOLLOW|O_PATH" does for open(2) that is
chase_symlinks() will not resolve the final pathname component if it's a
symlink and instead will return a file descriptor referring to the symlink
itself.

Note: if CHASE_SAFE is also passed, no safety checking is performed on the
transition done if the symlink would have been followed.
2018-07-30 15:54:03 +02:00
Franck Bui 7ea5a87f92 tmpfiles: make create_fifo() safe 2018-07-30 15:54:03 +02:00
Franck Bui 4fe3828c58 fs-util: introduce mkfifoat_atomic() helper 2018-07-30 15:54:03 +02:00
Franck Bui 43231f00c2 fileio: make tempfn_random_child() accept empty string as path
In this case it simply returns the random generated filename with anything
prefixed.
2018-07-30 15:54:03 +02:00
Franck Bui a2fc2f8dd3 tmpfiles: introduce create_fifo() 2018-07-30 15:54:03 +02:00
Franck Bui 5494602195 tmpfiles: introduce empty_directory() 2018-07-30 15:54:03 +02:00
Franck Bui 4c39d899ff tmpfiles: introduce create_directory() and create_subvolume() and make them safe 2018-07-30 15:54:03 +02:00
Franck Bui a12e4ade1b basic/stat-util: introduce is_dir_fd() 2018-07-30 15:54:03 +02:00
Franck Bui 62f9666ae0 btrfs-util: introduce btrfs_subvol_make_fd() 2018-07-30 15:54:03 +02:00
Franck Bui 1e9126316f basic/label: introduce mkdirat_label()/mkdirat_errno_wrapper() helpers 2018-07-30 15:54:03 +02:00
Franck Bui 7e531a5265 selinux: introduce mac_selinux_create_file_prepare_at() 2018-07-30 15:54:03 +02:00
Franck Bui 2c3d5adde0 smack: introduce mac_smack_fix_at() 2018-07-30 15:54:03 +02:00
Franck Bui 4ad3684410 tmpfiles: introduce create_directory_or_subvolume()
No functional changes.
2018-07-30 15:54:03 +02:00
Franck Bui c7700a7748 tmpfiles: make create_device() safe 2018-07-30 15:54:03 +02:00
Franck Bui 074bd73fd3 tmpfiles: introduce create_device() 2018-07-30 15:54:03 +02:00
Franck Bui 16ba55adb1 tmpfiles: make copy_files() safe 2018-07-30 15:54:02 +02:00
Franck Bui b1f7b17f9a tmpfiles: introduce copy_files() routine
No functional changes.
2018-07-30 15:54:02 +02:00
Franck Bui 551470ecf2 tmpfiles: make write_one_file() safe 2018-07-30 15:54:02 +02:00
Franck Bui 14ab804e14 tmpfiles: make truncate_file() safe 2018-07-30 15:54:02 +02:00
Franck Bui 5ec9d06512 tmpfiles: introduce truncate_file() which deals with 'F' exclusively
TRUNCATE_FILE is now handled by a new dedicated function
truncate_file(). Indeed we have to take special care when truncating existing
file since the behavior is only specified for regular files.

Well that's not entirely true for fifo and terminal devices since O_TRUNC is
ignored in this case but even in for these types of file, truncating is
probably not the right thing to do.

It is worth noting that both truncate_file() and create_file() have been
modified so they use fstat(2) instead of stat(2) since both functions are not
supposed to follow symlinks.
2018-07-30 15:53:53 +02:00
Franck Bui 31c84ff11e tmpfiles: introduce create_file() which deals with 'f'/'F' exclusively
write_one_file() only deals with the 'w' command and 'f'/'F' are now handled by
a new function create_file().

This is primarly done because 'w' is allowed to operate on any kind of files,
not just regular ones.
2018-07-30 14:44:58 +02:00
Franck Bui b206ac8e54 tmpfiles: make the stat struct parameter in fd_set_*() optional
So every callers are not forced to stat() the passed file descriptor before
calling those functions.
2018-07-30 14:44:58 +02:00
Franck Bui 14f3480af1 tmpfiles: stat file in item_do() rather than in its callers
This a slight simplification since all callers of item_do()
(glob_item_recursively() and item_do() itself) stat the file descriptor only
for passing it to item_do().
2018-07-30 14:44:58 +02:00
Yu Watanabe 1c57fa90be man: move explanations about boolean and time-span value from systemd.unit to systemd.syntax
Fixes #9735.
2018-07-30 14:13:42 +02:00
Lennart Poettering f6f8a1aee0
Merge pull request #9734 from irtimmer/feature/dns-over-tls-openssl
resolved: Add OpenSSL as alternative SSL library
2018-07-30 14:13:05 +02:00
Lennart Poettering faf739a73d
Merge pull request #9747 from yuwata/workaround-structured-initialization
sd-resolve: use structured initialization and a workaround for nested structs
2018-07-30 13:25:37 +02:00
Mike Palmer 4da3d1d10b Expanding evdev device match for Razer Blade Stealth (2017) 2018-07-30 13:24:18 +02:00
Lennart Poettering 150a509c9f
Merge pull request #9742 from yuwata/workaround-9718
resolve: add option to toggle reading /etc/hosts
2018-07-30 12:40:20 +02:00
Yu Watanabe b127bc99d1 sd-resolve: workaround for structured initialization to nested structs
When a nested struct is initialized by structured initializer, then
padding space is not cleared by zero. So, before setting values,
this makes explicitly set zero including padding.

This fixes the following false positive warning by valgrind:
```
==492== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s)
==492==    at 0x56D0CF7: sendmsg (in /usr/lib64/libpthread-2.27.so)
==492==    by 0x4FDD3C5: sd_resolve_getaddrinfo (sd-resolve.c:975)
==492==    by 0x110B9E: manager_connect (timesyncd-manager.c:879)
==492==    by 0x10B729: main (timesyncd.c:165)
==492==  Address 0x1fff0008f1 is on thread 1's stack
==492==  in frame #1, created by sd_resolve_getaddrinfo (sd-resolve.c:928)
==492==
```
2018-07-29 16:05:23 +09:00
Yu Watanabe 2a12960bcd sd-resolve: use structured initialization at more places 2018-07-29 16:01:37 +09:00
Yu Watanabe 494c5676b3 man: use literal tag 2018-07-28 21:46:22 +09:00
Yu Watanabe 8631708741 resolve: add option to toggle reading /etc/hosts
Workaround for #9718.
2018-07-28 21:46:00 +09:00
Yu Watanabe 452ca09152 resolve: make manager_etc_hosts_read() static 2018-07-28 20:36:13 +09:00