Commit graph

13433 commits

Author SHA1 Message Date
Lennart Poettering c89f52ac69 core: fix dependency parsing
3d793d2905 broke parsing of unit file
names that include backslashes, as extract_first_word() strips those.
Fix this, by introducing a new EXTRACT_RETAIN_ESCAPE flag which disables
looking at any flags, thus being compatible with the classic
FOREACH_WORD() behaviour.
2015-11-11 22:53:05 +01:00
Lennart Poettering ea0ec5cea7 core: simplify mount unit dependency generation a bit
Let's make the code a bit more explicit. Should not change execution
logic in any way.
2015-11-11 20:46:34 +01:00
Lennart Poettering 4c9ea260ae core: simplify things a bit by checking default_dependencies boolean in callee, not caller
It's nicer to hide the check away in the various
xyz_add_default_dependencies() calls, rather than making it explicit in
the caller, and thus require deeper nesing.
2015-11-11 20:42:39 +01:00
Lennart Poettering 45f06b3450 core: pull in dbus.socket from Type=dbus services
Do so only on non-kdbus systems. And on non-kdbus systems don't bother
with .busname units.
2015-11-11 20:40:57 +01:00
Lennart Poettering cb4c247d48 core: change default deps of services to require sysinit.target instead of basic.target
With this change services by default will no longer require
basic.target, but instead only after it it via After=basic.target.
However, they will still Require= on sysinit.target.

This has the benefit that when booting into emergency mode it is
relatively safe to actviate individual services, as this will not pull
the entirety of basic.target anymore, thus avoid everything listed in
sockets.target and suchlike. However, during the usual boot no change
should be noticed.
2015-11-11 20:40:57 +01:00
Lennart Poettering a020b3b332 journalctl: change repeated if checks into switch blocks
No functional changes.
2015-11-11 16:21:30 +01:00
Lennart Poettering 176ee07b69 journalctl: refuse to --machine= in combination with --flush, --sync or --rotate 2015-11-11 16:04:29 +01:00
Tom Gundersen 4058d339f5 networkd: improve logging 2015-11-11 15:42:38 +01:00
Tom Gundersen e7ab854c6c networkd: link - track state of IPv6LL address
This is managed by the kernel, but we should track whether or not we have
a configured IPv6LL address. This fixes two issues:
 - we now wait for IPv6LL before considering the link ready
 - we now wait for IPv6LL before attempting to do NDisc or DHCPv6
   these protocols relies on an LL address being available.
2015-11-11 15:42:38 +01:00
Tom Gundersen 3b015d40c1 networkd: ndisc - handle router advertisement in userspace
Router Discovery is a core part of IPv6, which by default is handled by the kernel.
However, the kernel implementation is meant as a fall-back, and to fully support
the protocol a userspace implementation is desired.

The protocol essentially listens for Router Advertisement packets from routers
on the local link and use these to configure the client automatically. The four
main pieces of information are: what kind (if any) of DHCPv6 configuration should
be performed; a default gateway; the prefixes that should be considered to be on
the local link; and the prefixes with which we can preform SLAAC in order to pick
a global IPv6 address.

A lot of additional information is also available, which we do not yet fully
support, but which will eventually allow us to avoid the need for DHCPv6 in the
common case.

Short-term, the reason for wanting this is in userspace was the desire to fully
track all the addresses on links we manage, and that is not possible for addresses
managed by the kernel (as the kernel does not expose to us the fact that it
manages these addresses). Moreover, we would like to support stable privacy
addresses, which will soon be mandated and the legacy MAC-based global addresses
deprecated, to do this well we need to handle the generation in userspace. Lastly,
more long-term we wish to support more RA options than what the kernel exposes.
2015-11-11 15:42:38 +01:00
Tom Gundersen f5a8c43f39 networkd: IPv6 router discovery - follow IPv6AcceptRouterAdvertisemnt=
The previous behavior:
When DHCPv6 was enabled, router discover was performed first, and then DHCPv6 was
enabled only if the relevant flags were passed in the Router Advertisement message.
Moreover, router discovery was performed even if AcceptRouterAdvertisements=false,
moreover, even if router advertisements were accepted (by the kernel) the flags
indicating that DHCPv6 should be performed were ignored.

New behavior:
If RouterAdvertisements are accepted, and either no routers are found, or an
advertisement is received indicating DHCPv6 should be performed, the DHCPv6
client is started. Moreover, the DHCP option now truly enables the DHCPv6
client regardless of router discovery (though it will probably not be
very useful to get a lease withotu any routes, this seems the more consistent
approach).

The recommended default setting should be to set DHCP=ipv4 and to leave
IPv6AcceptRouterAdvertisements unset.
2015-11-11 15:42:38 +01:00
Tom Gundersen 7a695d8e1f networkd: dhcp6 - split up configure() method
Enabling address acquisition, configuring the client and starting the client are now
split out. This to better handle the client being repeatedly enabled due to router
advertisements.
2015-11-11 15:42:38 +01:00
Tom Gundersen 9d96e6c3ef sd-ndisc: introduce separate callbacks
As the data passed is very different, we introduce four different callbacks:
 - Generic - router discovery timed out or state machine stopped
 - Router - router and link configuration received
 - Prefix onlink - configuration for an onlink prefix received
 - Prefix autonomous - configuration for to configure a SLAAC address for a prefix received
2015-11-11 15:42:38 +01:00
Tom Gundersen cb53894d3b sd-ndisc: notify user on STOP
Also, stop the state machine when we get into a broken state, rather than just notify the user.
2015-11-11 15:42:38 +01:00
Tom Gundersen b69015efd2 sd-netlink: add support for RTA_PREF 2015-11-11 15:42:38 +01:00
Tom Gundersen 8ae4b6d12c sd-netlink: types - let tables be sized implicitly
This way we do not rely on the size MAX* constants from the kernel headers, as these will
be out-of-sync in case we have old headers and new defines in missing.h.
2015-11-11 15:42:38 +01:00
Tom Gundersen 6b9e85a7de sd-netlink: add sd_rtnl_message_route_{s,g}et_flags() 2015-11-11 15:42:38 +01:00
Tom Gundersen f667c150a9 sd-dhcp6-client: add is_running() method 2015-11-11 15:42:38 +01:00
Tom Gundersen 63bbe5c767 networkd: address - drop the 'added' flag
Instead instantiate the kernel flags to TENTATIVE until the kernel
updates us with the real value.
2015-11-11 15:42:38 +01:00
Tom Gundersen 6cf4a01c36 networkd: dhcp4 - style fixes 2015-11-11 15:42:38 +01:00
Lennart Poettering 91d0f17e03 systemctl: make sure list-jobs doesn't return failure on success 2015-11-11 14:35:44 +01:00
Lennart Poettering dbd6e31cf9 journalctl: make --rotate synchronous, too
Of course, ideally we'd just use normal synchronous bus calls, but this
is out of the question as long as we rely on dbus-daemon (which logs to
journald, and thus cannot use to avoid cyclic sync loops). Hence,
instead, reuse the wait logic already implemented for --sync, and use a
signal in one direction, and a mtime watch file for the reply.
2015-11-11 14:29:10 +01:00
Lennart Poettering 94b6551662 journalctl: add new --sync switch for syncing the journal to disk
With this new "--sync" switch we add a synchronous way to sync
everything queued to disk, and return only after that's complete. This
command gives the guarantee that anything queued before has hit the disk
before the command returns.

While we are at it, also improve the man pages and help text for
journalctl a bit.
2015-11-11 13:39:18 +01:00
Lennart Poettering 404f08d341 systemctl: add a comment that clarifies why we do "return r" at the end of main()
To avoid confusion as outlined in #1845.
2015-11-11 12:57:40 +01:00
Lennart Poettering 7fc04b12e0 sd-bus: don't try to acquire connection selinux label unless selinux is actually enabled
Otherwise we might end up mistaking a SMACK label for an selinux label.

Also, fixes unexpect debug messages:

http://lists.freedesktop.org/archives/systemd-devel/2015-November/034913.html
2015-11-11 12:55:32 +01:00
Lennart Poettering 9eb4a5012c Revert "systemctl: return EXIT_SUCCESS on success"
This reverts commit 6a32563caa.
2015-11-11 10:59:11 +01:00
Martin Pitt 5c280bcc5a test-parse-util: cover negative numbers, leading spaces, and more range errors
Motivated by https://github.com/systemd/systemd/issues/1829 where negative
numbers were mis-handled on 32 bit platforms by safe_atou*().
2015-11-11 10:09:18 +01:00
Tom Gundersen 7042fc14ff Merge pull request #1837 from poettering/grabbag2
variety of fixes
2015-11-11 02:31:29 +01:00
Tom Gundersen 620b7793fc Merge pull request #1839 from evverx/fix-systemctl-cancel
systemctl: fix cancel
2015-11-11 02:25:57 +01:00
Tom Gundersen 827d04b68b Merge pull request #1841 from keszybz/remove-snapshot
Remove snapshot unit type
2015-11-11 02:24:45 +01:00
Tom Gundersen 8b61781d80 Merge pull request #1655 from ssahani/net
network: port to extract_first_word
2015-11-11 02:22:11 +01:00
Evgeny Vereshchagin 6a32563caa systemctl: return EXIT_SUCCESS on success 2015-11-11 01:17:13 +00:00
Zbigniew Jędrzejewski-Szmek 36b4a7ba55 Remove snapshot unit type
Snapshots were never useful or used for anything. Many systemd
developers that I spoke to at systemd.conf2015, didn't even know they
existed, so it is fairly safe to assume that this type can be deleted
without harm.

The fundamental problem with snapshots is that the state of the system
is dynamic, devices come and go, users log in and out, timers fire...
and restoring all units to some state from the past would "undo"
those changes, which isn't really possible.

Tested by creating a snapshot, running the new binary, and checking
that the transition did not cause errors, and the snapshot is gone,
and snapshots cannot be created anymore.

New systemctl says:
Unknown operation snapshot.
Old systemctl says:
Failed to create snapshot: Support for snapshots has been removed.

IgnoreOnSnaphost settings are warned about and ignored:
Support for option IgnoreOnSnapshot= has been removed and it is ignored

http://lists.freedesktop.org/archives/systemd-devel/2015-November/034872.html
2015-11-10 19:33:06 -05:00
Evgeny Vereshchagin 75fbd19388 systemctl: fix cancel
http://www.freedesktop.org/software/systemd/man/systemctl.html#cancel%20JOB...
> If no job ID is specified, cancel all pending jobs
2015-11-11 00:03:24 +00:00
Lennart Poettering be6d467c1f tmpfiles: don't consider it a problem if quota is not enabled on btrfs
If quota is not enabled on a btrfs file system, accept that, and only
log a debug message, but do not consider this a reason for failure.

Fixes: #1809
2015-11-10 21:41:22 +01:00
Lennart Poettering 12ee6186dc btrfs: when querying quota, make sure we don't choke if quota is disabled
When quota is disabled there's no quota tree on the fs, which results in
the SEARCH ioctl to return ENOENT. Handle this nicely: treat this the
same way as the case where the quota tree is around but doesn't carry
the searched for fields.
2015-11-10 21:37:49 +01:00
Lennart Poettering 17afc8f27b journald: be less picky when receiving epoll events
The event might be flagged with stuff we don't expect, hence don't
be needlessly picky, just rely on the kernel passing us sensible events.
2015-11-10 21:04:39 +01:00
Lennart Poettering 9ff1a6f1d6 core: change type of distribute_fds() prototype to return void
We can't handle errors of thisc all sanely anyway, and we never actually
return any errors from the unit type that implements the call.  Hence,
let's make this void, in order to simplify things.
2015-11-10 21:03:49 +01:00
Lennart Poettering 5a6158b641 core: try to continue if coldplugging of a unit fails 2015-11-10 21:03:49 +01:00
Lennart Poettering ba64af90ec core: change return value of the unit's enumerate() call to void
We cannot handle enumeration failures in a sensible way, hence let's try
hard to continue without making such failures fatal, and log about it
with precise error messages.
2015-11-10 21:03:49 +01:00
Lennart Poettering 1e603a482f journald: never accept fds from file systems with mandatory locking enabled
This is pretty much a work-around for a security vulnerability in
kernels that allow unprivileged user namespaces.

Fixes #1822.
2015-11-10 21:03:49 +01:00
Daniel Mack e3c4a681db Merge pull request #1835 from poettering/grabbag-of-stuff
Lots of small fixes
2015-11-10 21:01:35 +01:00
Lennart Poettering 092b6e188b Merge pull request #1785 from ssahani/word
core: unit deps port to extract_first_word
2015-11-10 19:55:30 +01:00
Lennart Poettering 79b7278da0 Merge pull request #1793 from filbranden/extract1
More refactorings in extract_first_word
2015-11-10 19:43:09 +01:00
Lennart Poettering f63be4b2b6 Merge pull request #1783 from vcaputo/still_make_progress_when_throttling
core: still make progress when throttling the manager loop
2015-11-10 19:33:27 +01:00
Susant Sahani 3d793d2905 core: unit deps port to extract_first_word 2015-11-10 22:24:00 +05:30
Susant Sahani af40397dea networkctl: lldp port to extract_first_word 2015-11-10 22:17:58 +05:30
Susant Sahani 022833c897 bond: port to extract_first_word 2015-11-10 22:17:58 +05:30
Lennart Poettering 2d49a208f8 parse-util: really refuse parsing negative values as positive ones, even on x86-32
strtoull() doesn't make it particularly easy to detect passed-in
negative numbers, as it silently converts them to positive ones without
generating any error. Since we are not interested in negative values we
should hence explicitly filter them out by looking at the string
directly and returning ERANGE if we see a leading "-".

Fixes: #1829
2015-11-10 17:36:52 +01:00
Lennart Poettering b374689c02 journald: dispatch SIGTERM/SIGINT with a low priority
Let's make sure to process all queued log data before exiting, so that
we don't unnecessary lose messages when shutting down.

https://github.com/systemd/systemd/pull/1812#issuecomment-155149871
2015-11-10 17:36:52 +01:00