Commit graph

8155 commits

Author SHA1 Message Date
Lennart Poettering 3e2d435b3d exit-status: rename ExitStatusSet's "code" field to "status"
We should follow the naming scheme waitid() uses, not come up with our
own reversed one...
2014-07-03 15:37:46 +02:00
Zbigniew Jędrzejewski-Szmek fd3b401e5d architecture: add tuples for arm 2014-07-03 09:03:16 -04:00
Umut Tezduyar Lindskog 9b3a0ba3e9 arch: add crisv32 to uname check 2014-07-03 12:51:33 +02:00
Lennart Poettering ce38dbc84b nspawn: when running in a service unit, use systemd for restarts
THis way we can remove cgroup priviliges after setup, but get them back
for the next restart, as we need it.
2014-07-03 12:51:07 +02:00
Lennart Poettering 206e7a5f7b machined: don't force terminate registered machines
When a machine is registered in machined with CreateMachine it is OK to
kill the machine when it is terminated, but when an existing unit is
simply registered via RegisterMachine we shouldn't do that, as the unit
is controlled by somebody else.
2014-07-03 12:51:07 +02:00
Lennart Poettering 37520c1bec core: introduce new RestartForceExitStatus= service setting
This does the inverse of RestartPreventExitStatus=: it forces a restart
of a service when a certain exit status is returned by a service
process.
2014-07-03 12:51:07 +02:00
Tom Gundersen ffd488e272 networkd: tuntap - default to no packet information
Susant says:
> ip tuntap turns this off by default.

Let's follow ip(8) here as that should be the least surprising.
2014-07-03 12:19:26 +02:00
Susant Sahani 853284abdd networkd vxlan: Pass correct type
The group argument is a union. We need to
pass the correct type
2014-07-03 11:39:12 +02:00
Tom Gundersen 63dadd9075 networkd: tuntap - enable PacketInfo by default 2014-07-03 11:37:54 +02:00
Tom Gundersen 6ef892fc05 networkd: netdev - move tunnel address parsing to networkd-tunnel.c 2014-07-03 11:00:36 +02:00
Tom Gundersen 4826dd6850 networkd: tunnels - make tunnel address parsing generic
It had a bug in the typing, fix that and also make it save the address family so we
can print proper error messages.
2014-07-03 11:00:36 +02:00
Susant Sahani 30ae9dfda3 networkd: Introduce tun/tap device
This patch introduces TUN/TAP device creation support
to networkd.

Example conf to create a tap device:

file: tap.netdev
------------------
[NetDev]
Name=tap-test
Kind=tap

[Tap]
OneQueue=true
MultiQueue=true
PacketInfo=true
User=sus
Group=sus
------------------

Test:
1. output of ip link
tap-test: tap pi one_queue UNKNOWN_FLAGS:900 user 1000 group 1000

id:
uid=1000(sus) gid=10(wheel) groups=10(wheel),1000(sus)
context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

Modifications:

Added:
1. file networkd-tuntap.c
3. netdev kind NETDEV_KIND_TUN and NETDEV_KIND_TAP
2. Tun and Tap Sections and config params to parse
   conf and gperf conf parameters

[tomegun: tweak the 'kind' checking for received ifindex]
2014-07-03 11:00:02 +02:00
Tom Gundersen 866ee36822 udev: net_setup_link - add a bit more logging 2014-07-03 11:00:02 +02:00
Tom Gundersen ad0774e61e networkd: netdev - drop the link callbacks after calling them once
We should never call them again, so make sure they are cleaned up correctly.
2014-07-03 11:00:01 +02:00
Tom Gundersen 563c69c6b2 networkd: netdev - take ref immediately after calling out
Keeping the refcounting next to the sd_bus_call_async() makes it easier to check.
2014-07-03 11:00:01 +02:00
Tom Gundersen 0372cb2bd2 networkd: split out vlan and macvlan handling 2014-07-03 11:00:01 +02:00
Lennart Poettering 620a687cd2 sd-login: use the same code for verfiying machine names everywhere 2014-07-03 01:19:26 +02:00
Lennart Poettering db9bb83fa5 bus: close a bus that failed to connect 2014-07-03 01:19:21 +02:00
Lennart Poettering 7f0d207d2c sd-bus: support connecting to remote hosts, directly into containers
systemctl -H root@foobar:waldi

will now show a list of services running on container "waldi" on host
"foobar", using "root" for authenticating at "foobar".

Since entereing a container requires priviliges, this will only work
correctly for root logins.
2014-07-03 01:17:26 +02:00
Lennart Poettering 7bb4d371af sd-bus: when an event loop terminates, explicitly close the bus
This makes sure we actually release the bus and all the messages it
references.
2014-07-02 17:36:47 +02:00
Lennart Poettering b5eca3a205 bus: drop bus/message GC logic
When a caller drops all references to a bus and its messages while the
messages where still queue, this causes the bus to reference the
messages, and the messages to reference the bus, without anybody else
keeping a reference, which is something we so far considered a leak, and
tried to fix with a GC logic that would recognize cases like this, and
drop the reference.

This GC logic has been broken sofar, and remained unfixed. This commit
removes it altogther, replacing it with nothing. The rationale is that
simply because all refs to the bus have been dropped its queued messages
should *still* be written to the bus, even if the caller doesn't retain
any reference to either bus nor message. This means it was actually
wrong to attempt to clean up the bus in this case.

The proper way how applications should handle this is by explicitly
invoking sd_bus_close(), when they want busses to go away. This is
probably want they want to do anyway to avoid getting spurious
callbacks after they stopped using a bus.
2014-07-02 17:29:09 +02:00
Lennart Poettering 62bb05f64f bus-proxy: restore operation in non-kdbus mode
bus-proxyd is not only the bridge between legacy dbus clients and kdbus
but is also used to access remote dbus servers via ssh. Let's make sure
it actually works for that.
2014-07-02 17:12:24 +02:00
Michal Sekletar 387066c2e5 localed: consider an unset model as a wildcard 2014-07-02 16:11:50 +02:00
Tom Gundersen 5e91345094 sd-dhcp6-client: initialize variable 2014-07-02 15:54:27 +02:00
Lennart Poettering 01d4590b77 udev: net_setup_link builtin should print the reason why something fails
Let's tell users what is going wrong.
2014-07-02 15:13:29 +02:00
Lennart Poettering e0a33e7ba6 util: when unescaping strings, don't allow smuggling in of additional NUL bytes
Better safe than sorry.
2014-07-02 13:45:49 +02:00
Lennart Poettering fecc80c1ba util: generalize is_localhost() and use it everywhere where applicable 2014-07-02 13:41:31 +02:00
Lennart Poettering 9a00f57a5b path: add new "systemd-path" utility for querying paths described in file-hierarchy(7)
This new tool is based on "sd-path", a new (so far unexported) API for
libsystemd, that can hopefully grow into a workable API covering /opt
and more one day.
2014-07-02 12:23:36 +02:00
Thomas Hindoe Paaboel Andersen cd4ba18a84 coredump: vacuum - fix calculation of 10% of fs size for MaxUse 2014-07-01 23:49:56 +02:00
Thomas Hindoe Paaboel Andersen 926695f1b5 sd-dhcp6-client: check return value
Checking the return values seems to have been forgotten in
ed6ee21953
2014-07-01 23:46:51 +02:00
Filipe Brandenburger 72165d6191 networkd: fix alignment of gperf source 2014-07-01 23:44:27 +02:00
Tom Gundersen 9e358851b4 networkd: netdev - add dummy support 2014-07-01 22:10:07 +02:00
Eugene Yakubovich 4cc7a82c94 networkd: send hostname to dhcp server
Send hostname (option 12) in DISCOVER and REQUEST messages so the
DHCP server could use it to register with dynamic DNS and such.

To opt-out of this behaviour set SendHostname to false in [DHCP]
section of .network file

[tomegun: rebased, made sure a failing set_hostname is a noop and moved
          config from DHCPv4 to DHCP]
2014-07-01 22:02:25 +02:00
Tom Gundersen 8900367cd2 networkd: netdev - take ref when creating netdevs
We were doing this correctly for when the callback takes the Link object, but
must also do it for the cases it takes the NetDev object.
2014-07-01 20:33:30 +02:00
Kay Sievers f841a154ef parse_uid: return -ENXIO for -1 uids 2014-07-01 16:00:05 +02:00
Thadeu Lima de Souza Cascardo 3058e017fc Use dev_port for the ID of a network device.
For network devices on the same PCI function, dev_id should not be used,
since its purpose is for IPv6 support on interfaces with the same MAC
address.

The new dev_port sysfs attribute should be used instead of dev_id.
2014-07-01 15:19:20 +02:00
Tom Gundersen 856f962c7a networkd: link - don't fail if master netdev already exists
This allows restarts to work gracefully.
2014-07-01 13:30:23 +02:00
Tom Gundersen d5b3d845f0 networkd: tunnel - ensure that enslave callback is always invoked
The Link statemachine relies on this, as it would otherwise wait forever. Hook up the tunnels in the
same way as the other NetDev's.
2014-07-01 12:55:19 +02:00
Tom Gundersen 1a941ac4b6 networkd: link - ignore missing MAC address
Currently DHCP/IPv4LL only works on ethernet devices, but no reason not to otherwise
manage them.
2014-07-01 12:55:05 +02:00
Kay Sievers afc3f9cb24 base-filesystem: avoid all searching if the link already exists 2014-07-01 12:25:38 +02:00
Kay Sievers 3fd165e53a base-filesystem: explicitely check existence of the platform's ABI dynamic loader 2014-07-01 12:12:40 +02:00
Kay Sievers e1ae9755ab base-filesystem: create /lib64 symlink to libdir /usr directory 2014-07-01 11:46:12 +02:00
Susant Sahani 0099bc15f1 networkd: address_acquire use cleanup macro
use cleanup macro for Address na

[tomegun: dropped unneccessary braces]
2014-07-01 10:38:07 +02:00
Susant Sahani 8469c1d329 networkd: netdev add one separate line 2014-07-01 10:35:42 +02:00
Tom Gundersen 28aeb07f55 networkd: link - drop assert from _free()
_free() should always succeed, even if object is not fully allocated.
2014-07-01 10:30:37 +02:00
Tom Gundersen 54d61deb7b sd-dhcp6-client: fix free before use 2014-07-01 10:21:18 +02:00
Tom Gundersen 5da8149fd3 networkd: link - improve refcounting
We failed to take a ref when waiting for udev synchronization. Fix that and also
make unreffing in callbacks simpler throughout by using _cleanup_ macros.

Fixes <https://bugs.freedesktop.org/show_bug.cgi?id=80556>.
2014-07-01 10:21:18 +02:00
Zbigniew Jędrzejewski-Szmek 8eea868708 cryptsetup: allow x-systemd.device-timeout
https://bugs.freedesktop.org/show_bug.cgi?id=54210
2014-06-30 18:41:17 -04:00
Zbigniew Jędrzejewski-Szmek b3208b6629 fstab-generator: allow x-systemd.device-timeout for swap units 2014-06-30 18:39:45 -04:00
Zbigniew Jędrzejewski-Szmek 2968644080 Move x-systemd-device.timeout handling from core to fstab-generator
Instead of adjusting job timeouts in the core, let fstab-generator
write out a dropin snippet with the appropriate JobTimeout.
x-systemd-device.timeout option is removed from Options= line
in the generated unit.

The functions to write dropins are moved from core/unit.c to
shared/dropin.c, to make them available outside of core.

generator.c is moved to libsystemd-label, because it now uses
functions defined in dropin.c, which are in libsystemd-label.
2014-06-30 18:39:45 -04:00
Lennart Poettering ded21b6de3 pc: no longer expose exec_prefix in .pc file
There's little reason to export this, so let's drop it to minimize the
file a bit.
2014-06-30 23:19:00 +02:00
Lennart Poettering d4e85aac0b pc: expose more drop-in dirs in the .pc file 2014-06-30 23:19:00 +02:00
Lennart Poettering eb39a6239c pc: export $libdir in the .pc file
This is useful for code that tries to figure out the primary arch's
$libdir on the local system, given that is different on the various
Linuxes.
2014-06-30 23:19:00 +02:00
Lennart Poettering 28650077f3 nspawn: block open_by_handle_at() and others via seccomp
Let's protect ourselves against the recently reported docker security
issue. Our man page makes clear that we do not make any security
promises anyway, but well, this one is easy to mitigate, so let's do it.
While we are at it block a couple of more syscalls that are no good in
containers, too.
2014-06-30 16:22:12 +02:00
Lennart Poettering 840295fc1e nspawn: let's avoid using goto to wildly for non-cleanup purposes 2014-06-30 15:20:59 +02:00
Lennart Poettering ce9f1527b6 nspawn: simplify exit condition check 2014-06-30 15:19:00 +02:00
Luke Shumaker 8baaf7a3d8 nspawn: log a warning on failure from wait_for_terminate()
This is at the suggestion of Djalal Harouni on the mailing list, and
reflects the behavior of shared/util.c:wait_for_terminate_and_warn().
2014-06-30 15:13:53 +02:00
Luke Shumaker 6d416b9cc8 nspawn: Fix regression with exit status
Commit 113cea8 introduced a bug that caused the exit code of systemd-nspawn
to not reflect the exit code of the program executed in the container.
2014-06-30 15:13:47 +02:00
Luke Shumaker 0659e8baf2 shared/util.c:wait_for_terminate_and_warn(): Add a comment on the return values 2014-06-30 15:13:34 +02:00
Tom Gundersen 3e53303ea6 networkd: dhcp - use same metric for all DHCP-related routes 2014-06-30 13:06:33 +02:00
Lennart Poettering 6afeb1cfe4 util: fix comment 2014-06-30 12:41:26 +02:00
Ronny Chevalier 6dbfd10471 tests: add missing XDG_RUNTIME_DIR env variable
Otherwise the test fails because specifier_runtime() returns -ENOTSUP
when XDG_RUNTIME_DIR is not set.
2014-06-30 12:40:47 +02:00
Lennart Poettering 306a55c863 util: refuse considering UID 0xFFFF and 0xFFFFFFFF valid 2014-06-29 22:27:07 +02:00
Tom Gundersen 69f08c8338 network-internal: initialize _cleanup_ variable 2014-06-29 22:26:06 +02:00
Susant Sahani 31db01208b netowrkd:deserialize_dhcp_routes verify strndup ret
strndup need to be chcked
2014-06-29 22:22:35 +02:00
Tom Gundersen 46ba9fbae2 networkd: dhcp - update the lifetime of an existing address
The logic otherwise is that we leave anything preconfigured alone, but in the case of DHCP
we actually need to update it whenever the lease is renewed.
2014-06-29 17:01:23 +02:00
Tom Gundersen fb41e6d7c6 sd-dhcp-client: don't fail hard if UDP socket can not be bound
Even if we cannot renew the lease at T1, we will likely succeed at T2, so warn and ignore the failure.

This could happen if for whatever reason the received address is not yet configured, or it has
been lost.
2014-06-29 16:42:43 +02:00
Tom Gundersen b16665806a networkd: improve DHCP error logging 2014-06-29 16:34:43 +02:00
Tom Gundersen fb6730c498 networkd: set static addresses immediately
Don't wait for IPv4LL nor DHCP to finish before setting statically configured addresses.
2014-06-29 15:18:21 +02:00
Eugene Yakubovich e1ea665eda Add support for DHCP static route options
This adds support for DHCP options 33 and 121: Static Route and
Classless Static Route. To enable this feature, set UseRoutes=true
in .network file. Returned routes are added to the routing table.
2014-06-29 15:18:21 +02:00
Tom Gundersen ed942a9eb2 networkd: merge DHCPv4 and DHCPv6 config
If there are v4 or v6 specific options we can keep those in separate sections,
but for the common options, we will use only one.

Moreovere only use DHCP=[yes/both|no/none|v4|v6] to enable or disable the clients.
2014-06-29 15:18:21 +02:00
Patrik Flykt 68ceb9df6a sd-dhcp-client/networkd: set lifetimes for IPv4 addresses
Note that /proc/sys/net/ipv4/ip_dynaddr needs to be non-zero.

[tomegun: hook up DHCP renew events to increase the lifetime when necessary]
2014-06-29 15:18:21 +02:00
Tom Gundersen 7c16313f11 networkd/sd-dhcp-server: only start dhcp server when necessary 2014-06-29 15:18:21 +02:00
Jan Engelhardt 8d0e0ddda6 doc: grammatical corrections 2014-06-28 00:06:30 -04:00
Kay Sievers 8a7a0c19ed libudev: queue - watch entire directory to allow the re-use of the watch descriptor 2014-06-27 19:56:31 +02:00
Michał Bartoszkiewicz e150e82097 journald: make MaxFileSec really default to 1month
journald.conf(5) states that the default for MaxFileSec is one month,
but the code didn't respect that.
2014-06-27 19:55:47 +02:00
Lennart Poettering b59233e6a3 coredump: simplify compression logic a bit
This also make sure we remove the original coredump temporary file if we
successfully managed to compress the coredump.
2014-06-27 19:35:57 +02:00
Lennart Poettering 8c9571d0ae coredump: replace Compression= setting by simpler Compress= boolean setting
Let's move things closer to journald's configuration settings, which
knows Compress= already, as a boolean. This makes things more uniform,
but also gives us more freedom to possibly swap out the used compression
algorithm one day.
2014-06-27 19:35:57 +02:00
Lennart Poettering cf677ac1b7 coredump: don't expose the compression level as configuration option
This sounds overly low-level and implementation-detaily. Let's just
use the default level XZ suggests. This gives us more room to possibly
swap out the compression algorithm used, as the compression level range
will not leak into user configuration.
2014-06-27 19:35:57 +02:00
Lennart Poettering 168562d7ed journald: invoking fstatvfs() is now redundant in the vacuuming code 2014-06-27 19:35:57 +02:00
Lennart Poettering 9d951bf491 coredump: don't be annoyed if another coredump hook removes our coredump while we work on it 2014-06-27 19:35:57 +02:00
Lennart Poettering cfc194575b coredump: fix how the compression level is verified 2014-06-27 19:35:57 +02:00
Lennart Poettering 0dc5d23c85 coredump: add simple coredump vacuuming
When disk space taken up by coredumps grows beyond a configured limit
start removing the oldest coredump of the user with the most coredumps,
until we get below the limit again.
2014-06-27 19:35:57 +02:00
Lennart Poettering 1f97091d3c main: uid_to_name() might fail due to OOM, protect against that 2014-06-27 19:35:57 +02:00
Kay Sievers 14cb733684 libudev: queue provide file descriptor to watch busy event queue 2014-06-27 17:56:41 +02:00
Kay Sievers 45e60962b7 libudev: fix udev_queue_get_queue_is_empty() logic 2014-06-27 14:21:29 +02:00
Thomas Hindoe Paaboel Andersen d0c8806d4a coredumpctl: fix potential deref of null pointer 2014-06-27 00:17:58 +02:00
Thomas Hindoe Paaboel Andersen 7849c2acd4 coredump: make sure variable is set if uncompressed
reorder the code so the fstat is done before we can jump to
uncompressed
2014-06-27 00:17:58 +02:00
Thomas Hindoe Paaboel Andersen de8f6e5463 coredumpctl: remove unused variable 2014-06-26 23:16:58 +02:00
Thomas Hindoe Paaboel Andersen 2bb9a7a286 coredump: fix debug message
typo from 347272731e
2014-06-26 23:16:58 +02:00
Patrik Flykt ed6ee21953 sd-dhcp6-client: Implement Rapid Commit
Add a Rapid Commit option to Solicit messages and expect a Reply to
be received instead of an Advertise. When receiving a DHCPv6 message
from the server in state Solicit, continue testing whether the
message is a Reply. Ease up the message type checking, it's not fatal
if the message is of a wrong type.

Add helper functions to set/get the rapid commit of a lease. See
RFC 3315, sections 17., 17.1.2., 17.1.4. and 18.1.8.
2014-06-26 16:10:47 +03:00
Patrik Flykt 3dc34fcc97 sd-dhcp6-client: Implement Renew and Rebind
Start sending Renew and Rebind DHCPv6 messages when respective timers T1
and T2 expire. Rebind messages do not include a Server ID option and the
Rebind procedure ends when the last IPv6 address valid lifetime expires,
whereafter the client restarts the address acquisition procedure by
Soliciting for available servers.

See RFC 3315, sections 18.1.3. and 18.1.4. for details.
2014-06-26 16:10:38 +03:00
Patrik Flykt 709d6710d0 sd-dhcp6-lease: Add helper function to compute remaining expiry time
Create a helper function to compute the remaining time in seconds from
time T2 to the IPv6 address with the longest lifetime. The computed
time is used as the Maximum Retransmission Duration in Rebinding state.
See RFC 3315, section 18.1.4. for details.
2014-06-26 16:10:21 +03:00
Patrik Flykt da6fe470e1 sd-dhcp6-client: Add Option Request Option support
Provide a function to request more options from the DHCPv6 server.
Provide a sensible default set at startup and add test basic test
cases for the intended usage.

Define DNS and NTP related option codes and add comments for the
unassigned codes.
2014-06-26 16:10:11 +03:00
Patrik Flykt 1873a3d344 networkd: Properly stop router solicitation and DHCPv6 client
When a link fails or looses carrier, always stop ongoing router
solicitation and any DHCPv6 client that may be running.
2014-06-26 16:09:50 +03:00
Patrik Flykt 836cf0905c sd-icmp6-nd: Add function to stop ongoing ICMPv6 discovery
In some use cases stopping an ongoing ICMPv6 discovery is more
useful than always unreferencing the whole structure.
2014-06-26 16:09:40 +03:00
Patrik Flykt 3f0c075f8e sd-dhcp6-client: return NULL from _unref() like the other sd-* libraries
In order to keep the refcounting working, a DONT_DESTROY macro similar
to the one in sd-bus has been added also to DHCPv6.
2014-06-26 16:09:29 +03:00
Michał Bartoszkiewicz bd34b310fb timer: name the stamp file consistently
The stamp file for systemd --user timers was named stamp-foo.timer if
XDG_DATA_HOME was unset, but foo.timer otherwise.
2014-06-26 07:18:27 -04:00
Daniel Mack 8ac8c5817f coredumpctl: fix HAVE_XZ check 2014-06-26 10:35:52 +02:00
Daniel Mack 2fb8159fb3 coredumpctl: fix build with !HAVE_XZ
Fixes the following build error:

  CCLD     coredumpctl
src/journal/coredumpctl.o: In function `save_core':
/src/systemd-master/src/journal/coredumpctl.c:656:
undefined reference to `decompress_stream'
collect2: error: ld returned 1 exit status
make[2]: *** [coredumpctl] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
2014-06-26 10:31:23 +02:00
Uoti Urpala 375ae4aa4d core/transaction: fix cycle break attempts outside transaction
Patch fixes some incorrect-looking code in transaction.c.
It could fix cases where Debian users with bad package configurations
had systemd go into an infinite loop printing messages about breaking an
ordering cycle, though I have not reproduced that problem myself.

transaction_verify_order_one() considers jobs/units outside current
transaction when checking whether ordering dependencies cause cycles.
It would also incorrectly try to break cycles at these jobs; this
cannot work, as the break action is to remove the job from the
transaction, which is a no-op if the job isn't part of the transaction
to begin with. The unit_matters_to_anchor() test also looks like it
would not work correctly for non-transaction jobs. Add a check to
verify that the unit is part of the transaction before considering a
job a candidate for deletion.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=752259
2014-06-26 01:41:05 -04:00
Tom Hirst 908f8b9cbb core: Don't require cgroups xattr support
Failure to mount cgroups with xattr should not be fatal
2014-06-26 01:41:05 -04:00
Michał Bartoszkiewicz d6239dc4b0 core: use correct format string for UIDs 2014-06-26 01:41:04 -04:00
Zbigniew Jędrzejewski-Szmek 3cc765d271 man: add coredump.conf(5) 2014-06-26 01:41:04 -04:00
Zbigniew Jędrzejewski-Szmek 9fe13294a9 coredump+coredumpctl: add COREDUMP_FILENAME, use in coredumpctl 2014-06-26 01:41:04 -04:00
Zbigniew Jędrzejewski-Szmek 347272731e coredump: make compression configurable
Add Compression={none,xz} and CompressionLevel=0-9 settings. Defaults
are xz/6.

Compression=filesystem may be added later.

I picked "xz" for the compression "type", since we might want to add
different compressors later on. XZ is fairly memory and CPU intensive, and
embedded users will likely want to use LZO or some other lightweight compression
mechanism.
2014-06-26 01:41:04 -04:00
Zbigniew Jędrzejewski-Szmek cfd652ed61 coredump: compress core files
Unfortunately the core is first written uncompressed, then compressed
by reading from disk and writing to the output file. This is ugly and
slow, but I don't see a way around, if we want to get the backtrace
without keeping everything in memory.
2014-06-26 01:41:04 -04:00
Zbigniew Jędrzejewski-Szmek 355b59e252 journal/compress: add stream compression/decompression functions 2014-06-26 01:41:04 -04:00
Zbigniew Jędrzejewski-Szmek 76cc0bf682 journal/compress: simplify compress_blob 2014-06-26 01:41:04 -04:00
Zbigniew Jędrzejewski-Szmek 8c9778383b shutdown: rework messages during shutdown
When running in 'quiet' mode, the only message printed from shutdown
binary would be 'Cannot finalize remaining file systems and devices,
giving up.', the only log line at error level before switch back to
initramfs. This is misleading, because in initramfs everything will
be cleaned up properly.

Avoid printing anything at error level before the attempt to switch
back to initramfs. Rework the messages to contain a bit more
information what is still remaining, to help people diagnose shutdown
issues.
2014-06-26 01:41:04 -04:00
Thomas Hindoe Paaboel Andersen 260ad50f5b sysv-generator: fix incorect ordering of Wants 2014-06-26 00:37:26 +02:00
Lennart Poettering 99813a1912 systemctl: add new "is-system-running" command to check whether system is fully up
https://bugs.freedesktop.org/show_bug.cgi?id=66926
2014-06-25 12:31:03 +02:00
Lennart Poettering 571d0134bd fsck: consider a fsck implementation linked to /bin/true non-existant 2014-06-25 10:04:36 +02:00
Ronny Chevalier 843fecc076 tests: add test-compress 2014-06-25 02:04:42 +02:00
Thomas Hindoe Paaboel Andersen d171ed1c50 sysv-generator: rename PidFile to PIDFile
Spotted by Alexey Shabalin
2014-06-24 23:07:48 +02:00
Ronny Chevalier e1d758033d use more _cleanup_ macro 2014-06-24 19:09:57 +02:00
Ronny Chevalier 6ec60d2072 sd-dhcp6-client: use %m instead of strerror(errno) 2014-06-24 19:09:57 +02:00
Kay Sievers 971ff8c78b switch-root: create essential base directories at system bootup
This allows us to bootup a rootfs with a /usr directory only.
2014-06-24 18:12:31 +02:00
Tom Gundersen 574cc92888 sd-dhcp-client: return NULL from _unref() like the other sd-* libraries
Let's keep this behavior consistent across our libraries.

In order to keep the refcounting working, a DONT_DESTROY macro similar
to the one in sd-bus was introduced.
2014-06-24 17:05:39 +02:00
Kay Sievers 3577de7ac3 nspawn: create essential base directories at system bootup
This allows us to bootup a rootfs with a /usr directory only.
2014-06-24 15:41:03 +02:00
Zbigniew Jędrzejewski-Szmek 2424a4755d coredump: log coredump even if core dumping fails
Journal might be functional even if we cannot write to
/var/lib/systemd/coredump.
2014-06-23 23:14:54 -04:00
Zbigniew Jędrzejewski-Szmek 1eef15b181 coredump: retrieve comm information from /proc
Kernel mangles comm information in an irreversible way when comm
constains repeated spaces. Retrieve comm information from /proc, and
only fallback to the information provided on the commandline when
retrieving information from /proc fails.

Add exe information to the list of saved xattr.

https://bugs.freedesktop.org/show_bug.cgi?id=62043
2014-06-23 23:14:54 -04:00
Zbigniew Jędrzejewski-Szmek 75a59316ea fstab-generator: simplify add_root_mount 2014-06-23 23:14:54 -04:00
Ronny Chevalier e80cde5e96 tests: add test-ratelimit 2014-06-24 02:40:50 +02:00
Ronny Chevalier 068ae9fb7c tests: add tests to test-unit-name
add tests for:
  - unit_instance_is_valid
  - unit_prefix_is_valid
  - unit_name_change_suffix
  - unit_name_build
  - unit_name_is_instance
  - build_subslice
  - unit_name_to_instance
  - unit_name_escape
2014-06-24 02:40:50 +02:00
Lennart Poettering bde29068aa cryptsetup: don't add unit dependency on /dev/null devices when it is listed as password file
As special magic, don't create device dependencies for /dev/null. Of
course, there might be similar devices we might want to include, but
given that none of them really make sense to specify as password source
there's really no point in checking for anything else here.

https://bugs.freedesktop.org/show_bug.cgi?id=75816
2014-06-23 19:18:44 +02:00
Ronan Le Martret d1d8e5d49f core: You can not put the cached result of use_smack fct, as we are not sure the "/sys" is mounted. So we should mount "sys" before "/proc"
https://bugs.freedesktop.org/show_bug.cgi?id=77646
2014-06-23 18:59:28 +02:00
Hristo Venev cdd7b7dfd4 core: make sure Environment fields passed in for transient units are properly written to unit files
https://bugs.freedesktop.org/show_bug.cgi?id=76744
2014-06-23 18:53:56 +02:00
Carl Schaefer ff452e76e2 vconsole: also copy character maps (not just fonts) from vt1 to vt2, vt3, ...
https://bugs.freedesktop.org/show_bug.cgi?id=78796
2014-06-23 18:24:52 +02:00
Lennart Poettering 93240d3aba coredump: never write more than the configured processing size limit to disk 2014-06-23 16:28:05 +02:00
Lennart Poettering 81cef14fce coredumpctl: show comm name next to PID 2014-06-23 15:55:24 +02:00
Lennart Poettering 6388c31525 coredump: quit early if we cannot store ay coredump to disk 2014-06-23 15:53:03 +02:00
Lennart Poettering 4b8cbe9a71 coredumpctl: include timestamp information in "coredumpctl info" output 2014-06-23 15:51:09 +02:00
Lennart Poettering b0b21dce0e coredump: also escape spaces in comm fields when formatting file names 2014-06-23 12:40:38 +02:00
Zbigniew Jędrzejewski-Szmek 6f8bd5c94e core/snapshot: log info when snapshots are created and removed
Snapshot mechanism is not used very much, but snapshot creation/destruction
should be at least as verbose as normal unit starting/stopping.
2014-06-22 15:30:28 -04:00
Zbigniew Jędrzejewski-Szmek 04ef5b03f6 core/transaction: avoid misleading error message when unit not found
There's no point in telling the user to look at the logs when
an attempt to load the unit file failed with ENOENT.

https://bugzilla.redhat.com/show_bug.cgi?id=996133
2014-06-22 15:30:24 -04:00
Zbigniew Jędrzejewski-Szmek 9ba6c18532 core/transaction: reindent and split very long lines 2014-06-22 15:30:19 -04:00
Zbigniew Jędrzejewski-Szmek bfff8f072d readahead: avoid gcc warning about format
src/readahead/readahead-common.c:55:17: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 7 has type ‘__off64_t’ [-Wformat=]
                 log_debug("Not preloading file %s with size out of bounds %zu", fn, st->st_size);
                 ^
2014-06-22 15:30:19 -04:00
Michal Sekletar 68328ed63c dhcp-network: don't bother with IP fragments 2014-06-22 12:26:09 -04:00
Marc-Antoine Perennou 57827c087c fix in_addr_prefix_intersect for 32bits
shifting from a non fixed number of bits >= to the size of the type
leads to weird results, handle the special case of << 32 to fix it.

This was causing a test failure from test-socket-util:
Assertion 'in_addr_prefix_intersect(f, &ua, apl, &ub, bpl) == result' failed at
/var/tmp/paludis/build/sys-apps-systemd-scm/work/systemd-scm/src/test/test-socket-util.c:147, function
test_in_addr_prefix_intersect_one(). Aborting.

Minimal reproducer:

paludisbuild@Lou /tmp $ cat test.c
static void test(unsigned m) {
        unsigned nm = 0xFFFFFFFFUL << (32-m);
        printf("%u: %x\n", m, nm);
}

int main (void) {
        test(1);
        test(0);
        return 0;
}
paludisbuild@Lou /tmp $ gcc -m32 -std=gnu99 test.c -o test32
paludisbuild@Lou /tmp $ ./test32
1: 80000000
0: ffffffff
paludisbuild@Lou /tmp $ gcc -std=gnu99 test.c -o test64
paludisbuild@Lou /tmp $ ./test64
1: 80000000
0: 0
2014-06-22 12:26:09 -04:00
Thomas Hindoe Paaboel Andersen c8b32e11ee consistently order cleanup attribute before type 2014-06-22 00:45:15 +02:00
Ronny Chevalier 2de61bbebf tests: add test_fdset_remove 2014-06-22 00:36:19 +02:00
Ronny Chevalier e6b5c5d03c tests: add test-async 2014-06-22 00:36:19 +02:00
Ronny Chevalier 6160e473fc tests: add test-capability 2014-06-22 00:36:19 +02:00
Kay Sievers 706b7936d0 gudev: replace regex with sym file 2014-06-21 16:25:15 +02:00
Kay Sievers e09c69d9fd pam_systemd: replace regex with sym file 2014-06-21 15:45:49 +02:00
Kay Sievers dfb0c6cc3b pam_systemd: rename source file to match the module 2014-06-21 15:44:14 +02:00
Tom Gundersen d122f9ee3a sd-dhcp-server: change default lease time form 1m to 1h
The short lease was useful for testing, but in real-world usage it is pointless to keep leases
this short. That said, the cost of lease renewal is really low, so we keep the lease still
relatively short at one hour to not get into hard-to-hit problems with lease exhaustion etc.
2014-06-21 15:26:41 +02:00
Tom Gundersen d6bd972d06 sd-dhcp-server: fix broadcast of DHCP packets
The destination IP address should be INADDR_BROADCAST, but was
accidentally left as INADDR_ANY.
2014-06-21 15:02:30 +02:00
Zbigniew Jędrzejewski-Szmek da92ca5eb5 util: treat fuse.sshfs as a network filesystem
https://bugs.freedesktop.org/show_bug.cgi?id=73727
2014-06-20 22:44:01 -04:00
Zbigniew Jędrzejewski-Szmek 81577dc228 missing.h: add various network enums
We used to check if e.g. IFLA_BOND_MAX is defined and provide fallback
values in missing.h is it wasn't. But over time, various kernel
versions added IFLA_* defines, so checking for IFLA_BOND_MAX is not
enough if the kernel is new enough to have some of them but too old to
have all. In case we detect that the latest known enum value is
missing, #define most of them.

https://bugs.freedesktop.org/show_bug.cgi?id=80095
2014-06-20 22:05:43 -04:00
Zbigniew Jędrzejewski-Szmek 0d460faf73 util: do not strip /dev prefix twice 2014-06-20 18:44:39 -04:00
Thomas Hindoe Paaboel Andersen 88675ae97c sd-dhcp-server: remove unused cleanup function
Removes _cleanup_dhcp_lease_free_. While the automatic cleanup
functions are great to have this one is never used and causes
a warning in clang.
2014-06-20 19:32:51 +02:00
Lennart Poettering 9bfcda9528 core: clean-up signal reset logic when reexec
There's no need to save the old sigmask, if we are going to die. Let's
simplify this. Also, reset all the signal handlers, so that we don't
leave SIG_IGN set for some of them across reexec.
2014-06-20 19:32:05 +02:00
Kay Sievers 2f3b873a49 tmpfiles: copy/link /usr/share/factory/ files when the source argument is omitted 2014-06-20 15:57:43 +02:00
Lennart Poettering 3c5a87a879 debug-generator: add new kernel cmdline option systemd.wants= to add units to the initial transaction 2014-06-20 13:36:28 +02:00
Tom Gundersen 6b66097b95 networkd: link - fix memleak of icmp6 struct 2014-06-20 13:04:02 +02:00
Tom Gundersen 6278a20190 networkd: veth - fix creation of veth netdev
Avoid freeing the netdev structure in the cleanup macro.
2014-06-20 12:59:22 +02:00
Michael Marineau 375eadd911 shared: fix search_and_fopen with alternate roots
Update for the current behavior of path_strv_resolve which now returns
paths relative to the given root, not the full absolute paths.
2014-06-20 00:10:47 -04:00
Michael Marineau 09e00c524f test: ensure conf_files_list returns absolute paths 2014-06-20 00:10:47 -04:00
Michael Marineau cba2ef0272 conf-files: include root in returned file paths
This restores the original root handling logic that was present prior to
112cfb18 when path expansion moved to path_strv_canonicalize_absolute.
That behavior partially went away in 12ed81d9.

Alternatively all users of conf_files_list* could be updated to
concatenate the paths themselves as unit_file_query_preset did but since
no user needs the un-concatenated form that is pointless duplication.
2014-06-20 00:10:47 -04:00
Michael Marineau 3e8a78c8dc test: unit test for using alternate roots with path_strv_resolve 2014-06-20 00:10:47 -04:00
Michael Marineau 7d8da2c964 shared: rename path_strv_canonicalize_absolute functions
Since 12ed81d9 path_strv_canonicalize_absolute leaves the search list
relative to the given root directory instead of resolving paths to their
true location as the name implies. To better reflect this behavior
rename to the less strongly worded path_strv_resolve.
2014-06-20 00:10:46 -04:00
Zbigniew Jędrzejewski-Szmek a2ae516a25 getty-generator: properly escape instance names
Otherwise the add_symlink() function tries to make directories for
each slash even for the slash after the @ symbol in the final link
name, failing for /dev/3270/tty1.

Based on a patch by Werner Fink <werner@suse.de>.
2014-06-19 22:04:29 -04:00
Zbigniew Jędrzejewski-Szmek f56506141c getty-generator: use strappenda
Allocating on the stack should be fine for the fixed number
of items.
2014-06-19 22:04:29 -04:00
Zbigniew Jędrzejewski-Szmek dede0e335d util.c: simplify rm_rf_children_dangerous 2014-06-19 20:08:44 -04:00
Ronny Chevalier 4a336a69fd tests: add tests for strv_extendf 2014-06-19 19:59:57 -04:00
Ronny Chevalier 927be00cb3 tests: add tests to test-util
add tests for:
  - filename_is_safe
  - ascii_strlower
  - files_same
  - is_valid_documentation_url
  - file_in_same_dir
  - endswith
  - close_nointr
  - unlink_noerrno
  - readlink_and_make_absolute
  - read_one_char
  - ignore_signals
  - strshorten
2014-06-19 19:59:57 -04:00
Ronny Chevalier 4630bbb766 tests: add missing return 2014-06-19 19:59:57 -04:00
Ronny Chevalier f277be6768 tests: fix test-icmp6-rs
Don't close the fd given to sd-icmp6-nd, since it will be aynschonously closed
by sd_icmp6_nd_unref
2014-06-20 00:32:02 +02:00
Ronny Chevalier 03de7ed905 sd-icmp6-nd: fix uninitialized fd 2014-06-20 00:27:38 +02:00
Ronny Chevalier 513a6fa867 sd-dhcp6-client: fix uninitialized variables 2014-06-20 00:26:54 +02:00
Filipe Brandenburger cacd6403a0 coredump: fix include of xattr.h
The correct path is now <sys/xattr.h> (from glibc-headers) and no longer
<attr/xattr.h> (from libattr-devel.)

Fixes: 34c10968cb
2014-06-20 00:26:03 +02:00
Lennart Poettering 2c455af4c7 copy: don't eat up error from chown()/chmod()
The idea was to not fail on, nor to ignore errors from chown()/chmod(),
but to proceed and simply return the most recent error...
2014-06-20 00:20:35 +02:00
Steven Noonan ae94176262 networkd: fix refcounting with UseMTU=yes
The link was unintentionally being unreferenced instead of referenced for the
MTU setup.
2014-06-19 20:40:20 +02:00
Lennart Poettering e156347e04 tmpfiles: make sure "C" doesn't copy anything if the destination already exists
Previously it would recursively copy the entire tree in, and descend
into subdirectories even if the destination already exists. Let's do
what the documentation says and not do that.

If files down the tree shall be copied too, they should get their own
"C" lines.
2014-06-19 19:36:08 +02:00
Kay Sievers 19f3934057 tmpfiles: do not fail when copying an empty directory 2014-06-19 18:58:17 +02:00
Lennart Poettering 31a020ced3 coredumpctl: add missing entries to --help 2014-06-19 17:36:22 +02:00
Lennart Poettering c3f841063d coredumpctl: fix columns sizing for timestamp 2014-06-19 17:29:39 +02:00
Lennart Poettering 8501384436 stop complaining about unknown kernel cmdline options
Also stop warning about unknown kernel cmdline options in the various
tools, not just in PID 1
2014-06-19 16:55:20 +02:00
Lennart Poettering 9e01adfa90 main: don't show help text anymore when we detect an unknown kernel cmdline value starting with "systemd."
As generators and other components started to maintain their own kernel
command line options this help text needed more and more exceptions and
wasn't complete anyway. Fixing that would leak more information about
specific generators into PID 1, which we should avoid.

Given that kernel cmdline handling traditionally doesn't generate errors
or show help texts, let's just remove the logic for it for systemd too.
2014-06-19 16:33:01 +02:00
Lennart Poettering ca05941b9a main: honour rd.systemd.unit= only in the initrd, not the host 2014-06-19 16:33:01 +02:00
Lennart Poettering 326bb68c40 debug-generator: add new generator
debug-generator can mask specific units if they are specified on the
kernel command line with systemd.mask=.

debug-generator can pull in debug-shell.service is systemd.debug-shell
is passed on the kernel command line.
2014-06-19 16:33:01 +02:00
Zbigniew Jędrzejewski-Szmek c806ffb959 sd-dhcp6-client: Initialize fd to -1 and rename function
client_initialize name is misleading, since the function is actually
useful at the *end*, to reinitialize the object. But reset is shorter,
so rename it to client_reset.
2014-06-19 09:09:56 -04:00
Zbigniew Jędrzejewski-Szmek 61c024b328 journal-send.c: use automatic cleanup 2014-06-19 08:53:31 -04:00
Patrik Flykt 4138fb2c79 networkd: Add initial DHCPv6 support
Enable DHCPv6 support by creating a DHCPv6 boolean in the Network
section. Add necessary DHCPv6 structures and initial function calls.
2014-06-19 15:44:44 +03:00
Patrik Flykt 947527f832 sd-dhcp6-client: Add reply sending for test
Enhance the test case by generating a Reply. With a properly formed
Reply the callback function will be called and the additional
earlier event loop exit can now be removed.
2014-06-19 15:44:44 +03:00
Patrik Flykt a34b57c0d4 sd-dhcp6-client: Receive and parse a reply and set T1 and T2 timers
Receive and parse a Reply from the server. Set up T1 and T2 timers and
notify the library user of an acquired DHCPv6 lease.
2014-06-19 15:44:44 +03:00
Patrik Flykt 5e256ea7d3 sd-dhcp6-client: Add Advertise sending for test case
Enhance the test case by replying with an Advertise message to the
client. Copy the transaction id, IAID and DUID from the Solicit
message. Verify the Request message created by the DHCPv6 client
implementation and move the main loop exit to the end of the Request
message verification.
2014-06-19 15:44:44 +03:00
Patrik Flykt 7246333cb8 sd-dhcp6-client: Add Request message sending
As described in RFC 3315, Section 17.1.2, a client has to wait until the
first timeout has elapsed before it is allowed to request IPv6 addresses
from the DHCPv6 server. This is indicated by a non-NULL lease and a
non-zero resend count. Should the Advertisement contain a preference
value of 255 or be received after the first timeout, IPv6 address
requesting is started immediately.

In response to these events, create a Request message and set up proper
resend timers to send the message to the server.
2014-06-19 15:44:44 +03:00
Patrik Flykt c3e2adeaba sd-dhcp6-client: Update start function to take a state
Update the start function so that the client state can be conveniently
changed with the previous message resend timers cleared. On initial
startup also create and bind to the UDP socket.
2014-06-19 15:44:44 +03:00
Patrik Flykt 859cca44f8 sd-dhcp6-client: Add test case for Advertise message parsing
Add a basic test case excersising once more option parsing function
in addition to lease handling. Check that the address iteration
functions return the correct IPv6 address and lifetimes and that
only one address is returned. Also verify that the server ID and
preference values are read correctly.
2014-06-19 15:44:44 +03:00
Patrik Flykt ea3b3a75ab sd-dhcp6-lease: Add functions for accessing lease and addresses
Add support functions for accessing the current client lease as well
as iterating over the addresses and get their preferred and valid
lifetimes.
2014-06-19 15:44:44 +03:00
Patrik Flykt 631bbe7129 sd-dhcp6-client: Receive and parse Advertise messages
When receiving DHCPv6 messages, discard the ones that are not meant
for DHCPv6 clients and verify the transaction id. Once that is done,
process the Advertise message and select the Advertise with the
highest preference.

Create a separate function for lease information parsing so that it
can be reused in other parts of the protocol. Verify both DUID and
IAID in the received message and store other necessary information
with the lease structure.
2014-06-19 15:44:44 +03:00
Patrik Flykt c6affce874 sd-dhcp6-client: Add IA Address option parsing
Add functionality to parse DHCPv6 Identity Association for
Non-temporary (IA_NA) and Temporary Addresses (IA_TA) options.
Both of them contain one or more IA Address (IAADDR) options
and optinally a status code option. Only the IA_NA option
contains lease lifetimes. See RFC 3315, sections 22.4., 22.5.,
22.6., 22.13. and appendix B. for details. If the lease
timeouts are not set, use the ones recommended for servers in
section 22.4.

Factor out common code in the form of an option header parsing
helper function.
2014-06-19 15:44:44 +03:00
Patrik Flykt 3fb2c57038 sd-dhcp6-lease: Add DHCPv6 lease handling
Create a structure describing a DHCPv6 lease. Add internal functions
for creating a new lease and accessing the server ID, preference and
IAID. Provide functions for clearing addresses and associated timers.

External users are initially given only the capabilities of
referencing and unreferencing the lease structure.
2014-06-19 15:44:44 +03:00
Patrik Flykt 2ea8857eff sd-dhcp6-client: Add DHCPv6 Solicit test case
Verify the Solicit message created by the DHCPv6 client code.

Provide local variants for detect_vm(), detect_container() and
detect_virtualization() defined in virt.h. This makes the DHCPv6
library believe it is run in a container and does not try to request
interface information from udev for the non-existing interface index
used by the test case code.
2014-06-19 15:44:44 +03:00
Patrik Flykt a9aff3615b sd-dhcp6-client: Add DHCPv6 Solicit message creation and sending
Implement the initial functionality used for creating a DHCPv6 Solicit
message containing the needed options and send it to the DHCPv6
broadcast address. Increase the sent message count and ensure that
the Solicit Initial Retransmission Time is strictly greater than
the Solicitation IRT as described in RFC 3315, section 17.1.2.
2014-06-19 15:44:44 +03:00
Patrik Flykt 34e8c5a23c sd-dhcp6-client: Add functions to bind to DHCPv6 UDP socket
Add a function that creates a UDP socket bound to the given interface
and optionally to an IPv6 address. Add another function that will
send the DHCPv6 UDP packet to its destination.

Using IPV6_PKTINFO in setsockopt to bind the IPv6 socket to an
interface is documented in section 4. of RFC 3542, "Advanced Sockets
Application Program Interface (API) for IPv6"

Add a define for DHCPv6 Relay Agents and Servers multicast address as
its not available elsewhere.
2014-06-19 15:44:44 +03:00
Patrik Flykt f12ed3bf0b sd-dhcp6-client: Add basic DHCPv6 option handling
Add option appending and parsing. DHCPv6 options are not aligned, thus
the option handling code must be able to handle options starting at
any byte boundary.

Add a test case for the basic option handling.
2014-06-19 15:44:43 +03:00