summaryrefslogtreecommitdiff
path: root/src/shared
Commit message (Collapse)AuthorAge
* shared/util: use signed printf format for PIDsZbigniew Jędrzejewski-Szmek2015-01-22
| | | | gcc 5 started warning about this.
* import: introduce new mini-daemon systemd-importd, and make machinectl a ↵Lennart Poettering2015-01-22
| | | | | | | | | | | | | | client to it The old "systemd-import" binary is now an internal tool. We still use it as asynchronous backend for systemd-importd. Since the import tool might require some IO and CPU resources (due to qcow2 explosion, and decompression), and because we might want to run it with more minimal priviliges we still keep it around as the worker binary to execute as child process of importd. machinectl now has verbs for pulling down images, cancelling them and listing them.
* log: add new log output mode, that prints to console, but prefixes with ↵Lennart Poettering2015-01-22
| | | | | | | syslog priority This is useful when we execute our own programs, reading output from its STDERR, and want to retain priority information.
* util: Add some missing hidden_file() suffixesMartin Pitt2015-01-21
| | | | | dpkg itself also uses *.dpkg-dist, while .dpkg-{bak,backup,remove} are being used by dpkg-maintscript-helper.
* import: add image verification using gpgLennart Poettering2015-01-21
| | | | | | This also adds an initial keyring for the verification, that contains Ubuntu's and Fedora's key. We should probably add more entries sooner or later.
* import: port pull-raw to helper tools implemented for pull-tarLennart Poettering2015-01-20
| | | | | This allows us to reuse a lot more code, and simplify pull-raw drastically.
* util: make http url validity checks more generic, and move them to util.cLennart Poettering2015-01-20
|
* networkd: netdev - add ipvlan supportTom Gundersen2015-01-19
|
* nspawn: support dissecting GPT images that contain only a single generic ↵Lennart Poettering2015-01-19
| | | | | | | linux partition This should allow running Ubuntu UEFI GPT Images with nspawn, unmodified.
* machined: refer to the disk space allocated for an image to "usage" rather ↵Lennart Poettering2015-01-19
| | | | | | | than "size" After all, it's closer to the "du"-reported value than to the file sizes...
* qcow2: when dissecting qcow2, use btrfs clone ioctls for reflinking blocks ↵Lennart Poettering2015-01-19
| | | | to target
* import-raw: when downloading raw images, generate sparse files if we canLennart Poettering2015-01-19
|
* Move DEFINE_TRIVIAL_CLEANUP_FUNC to macro.hZbigniew Jędrzejewski-Szmek2015-01-18
| | | | | This remove the need for various header files to include the (relatively heavyweight) util.h.
* Add initialization helper for file_handle_unionZbigniew Jędrzejewski-Szmek2015-01-18
|
* util: replace RUN_WITH_LOCALE with extended locale functionsCristian Rodríguez2015-01-18
| | | | | | There were two callers, one can use strtod_l() and the other strptime_l(). (David: fix up commit-msg and coding-style)
* missing: add macros for OFD locksMichael Marineau2015-01-17
|
* nspawn,machined: change default container image location from ↵Lennart Poettering2015-01-15
| | | | | | | | | | | /var/lib/container to /var/lib/machines Given that this is also the place to store raw disk images which are very much bootable with qemu/kvm it sounds like a misnomer to call the directory "container". Hence, let's change this sooner rather than later, and use the generic name, in particular since we otherwise try to use the generic "machine" preferably over the more specific "container" or "vm".
* import: rename "gpt" disk image type to "raw"Lennart Poettering2015-01-15
| | | | | | | After all, nspawn can now dissect MBR partition levels, too, hence ".gpt" appears a misnomer. Moreover, the the .raw suffix for these files is already pretty popular (the Fedora disk images use it for example), hence sounds like an OK scheme to adopt.
* nspawn: add file system locks for controlling access to container imagesLennart Poettering2015-01-14
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds three kinds of file system locks for container images: a) a file system lock next to the actual image, in a .lck file in the same directory the image is located. This lock has the benefit of usually being located on the same NFS share as the image itself, and thus allows locking container images across NFS shares. b) a file system lock in /run, named after st_dev and st_ino of the root of the image. This lock has the advantage that it is unique even if the same image is bind mounted to two different places at the same time, as the ino/dev stays constant for them. c) a file system lock that is only taken when a new disk image is about to be created, that ensures that checking whether the name is already used across the search path, and actually placing the image is not interrupted by other code taking the name. a + b are read-write locks. When a container is booted in read-only mode a read lock is taken, otherwise a write lock. Lock b is always taken after a, to avoid ABBA problems. Lock c is mostly relevant when renaming or cloning images.
* pty: minor modernizationLennart Poettering2015-01-14
| | | | We initialize structs during declartion if possible
* machined: use the FS_IMMUTABLE_FL file flag, if available, to implement a ↵Lennart Poettering2015-01-14
| | | | "read-only" concept for raw disk images, too
* util: the chattr flags field is actually unsigned, judging by kernel sourcesLennart Poettering2015-01-14
| | | | Unlike some client code suggests...
* ptyfw: add missing error checkLennart Poettering2015-01-14
|
* networkd: make IP forwarding for IPv4 and IPv6 individually configurableLennart Poettering2015-01-13
|
* fw-util: fix errno typo for !HAVE_LIBIPTCDaniel Mack2015-01-13
|
* networkd: add minimal IP forwarding and masquerading support to .network filesLennart Poettering2015-01-13
| | | | | | | | | | | | | | This adds two new settings to networkd's .network files: IPForwarding=yes and IPMasquerade=yes. The former controls the "forwarding" sysctl setting of the interface, thus controlling whether IP forwarding shall be enabled on the specific interface. The latter controls whether a firewall rule shall be installed that exposes traffic coming from the interface as coming from the local host to all other interfaces. This also enables both options by default for container network interfaces, thus making "systemd-nspawn --network-veth" have network connectivity out of the box.
* shared: add minimal firewall manipulation helpers for establishing NAT ↵Lennart Poettering2015-01-13
| | | | rules, using libiptc
* fstab-util: fix priority parsing and add testZbigniew Jędrzejewski-Szmek2015-01-11
|
* shared/util: respect buffer boundary on incomplete escape sequencesZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | cunescape_length_with_prefix() is called with the length as an argument, so it cannot rely on the buffer being NUL terminated. Move the length check before accessing the memory. When an incomplete escape sequence was given at the end of the buffer, c_l_w_p() would read past the end of the buffer. Fix this and add a test.
* Support negated fstab optionsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | We would ignore options like "fail" and "auto", and for any option which takes a value the first assignment would win. Repeated and options equivalent to the default are rarely used, but they have been documented forever, and people might use them. Especially on the kernel command line it is easier to append a repeated or negated option at the end.
* fstab-util: detect out-of-range pri= assignmentsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | We would silently ignore them. One would have to be crazy to do assign an out of range value, but simply ignoring it bothers me.
* Add new function to filter fstab optionsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | | | | | | | | | | | This fixes parsing of options in shared/generator.c. Existing code had some issues: - it would treate whitespace and semicolons as seperators. fstab(5) is pretty clear that only commas matter. And the syntax does not allow for spaces to be inserted in the field in fstab. Whitespace might be escaped, but then it should not seperate options. Treat whitespace and semicolons as any other character. - it assumed that x-systemd.device-timeout would always be followed by "=". But this is not guaranteed, hasmntopt will return this option even if there's no value. Uninitialized memory could be read. - some error paths would log, and inconsistently, some would just return an error code. Filtering is split out to a separate function and tests are added. Similar code paths in other places are adjusted to use the new function.
* shared/list: add LIST_APPENDZbigniew Jędrzejewski-Szmek2015-01-11
|
* path-lookup: allow /run to override /etc in generator searchZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | Generators are different than unit files: they are never automatically generated, so there's no point in allowing /etc to override /run. On the other hand, overriding /etc might be useful in some cases.
* Implement masking and overriding of generatorsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | | | | | | | | | | | | | Sometimes it is necessary to stop a generator from running. Either because of a bug, or for testing, or some other reason. The only way to do that would be to rename or chmod the generator binary, which is inconvenient and does not survive upgrades. Allow masking and overriding generators similarly to units and other configuration files. For the systemd instance, masking would be more common, rather than overriding generators. For the user instances, it may also be useful for users to have generators in $XDG_CONFIG_HOME to augment or override system-wide generators. Directories are searched according to the usual scheme (/usr/lib, /usr/local/lib, /run, /etc), and files with the same name in higher priority directories override files with the same name in lower priority directories. Empty files and links to /dev/null mask a given name. https://bugs.freedesktop.org/show_bug.cgi?id=87230
* Simplify execute_directory()Zbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | Remove the optional sepearate opening of the directory, it would be just too complicated with the change to multiple directories. Move the middle of execute_directory() to a seperate function to make it easier to grok.
* log: fix log_full_errno() with custom facilitiesDavid Herrmann2015-01-11
| | | | | | | Make sure to extract the log-priority when comparing against max-log-level, otherwise, we will always drop those messages. This fixes bus-proxyd to properly send warnings on policy blocks.
* logind: unify how we cast between uid_t and pointers for hashmap keysLennart Poettering2015-01-09
|
* machined: when cloning a raw disk image, also set the NOCOW flagLennart Poettering2015-01-08
|
* loginctl: show the 10 most recent log user/session log lines in "loginctl ↵Lennart Poettering2015-01-08
| | | | user-status" and "loginctl session-status"
* path-util: plug leakTom Gundersen2015-01-08
|
* journal: bump RLIMIT_NOFILE when journal files to 16K (if possible)Lennart Poettering2015-01-08
| | | | | | | | | | | When there are a lot of split out journal files, we might run out of fds quicker then we want. Hence: bump RLIMIT_NOFILE to 16K if possible. Do these even for journalctl. On Fedora the soft RLIMIT_NOFILE is at 1K, the hard at 4K by default for normal user processes, this code hence bumps this up for users to 4K. https://bugzilla.redhat.com/show_bug.cgi?id=1179980
* util: make it easy to initialize the crtime from the current time in ↵Lennart Poettering2015-01-08
| | | | fd_setcrtime()
* journald: turn off COW for journal files on btrfsLennart Poettering2015-01-08
| | | | | | | | | | | | | | btrfs' COW logic results in heavily fragment journal files, which is detrimental for perfomance. Hence, turn off COW for journal files as we create them. Turning off COW comes at the cost of data integrity guarantees, but this should be acceptable, given that we do our own checksumming, and generally have a pretty conservative write pattern. Also see discussion on linux-btrfs: http://www.spinics.net/lists/linux-btrfs/msg41001.html
* util: upgrade default $TERM from vt102 to vt220 if we have no idea about the ↵Lennart Poettering2015-01-07
| | | | | | | | | | | | | | | | | connected terminal So far, if we had no knowledge about the correct $TERM we defaulted to v102, as a safe, conservative choice. However, the terminfo data for vt102 is not aware of pageup/pagedown, which makes "less" much harder work with than necessary. Setting vt220 allows them to work correctly. "vt220" should be a sufficiently safe choice too, given that xterm, gnome-terminal and the linux console all strive to implement vt220 as baseline, already to pass pageup/pagedown correctly to apps. Effectively, with this change "journalctl -e" run inside a "systemd-nspawn" terminal will now run a pager where pageup/pagedown works, which is quite an improvement of usability for containers.
* conf-parse: make syntax logging functions behave more like other log functonsLennart Poettering2015-01-07
| | | | | | | In particular, don't patch the error number to EINVAL if 0, and don't negate it. (Also, add do {} while (false) around multi-line macro)
* ptyfwd: simplify how we handle vhangups a bitLennart Poettering2015-01-07
|
* btrfs-util: rework how we iterate through the results of the TREE_SEARCH resultsLennart Poettering2015-01-07
| | | | | Let's introduce some syntactic sugar with iteration macros, and add correct key increment calls.
* machinectl: make sure that "machinectl login" exits immediately when the ↵Lennart Poettering2015-01-07
| | | | machine it is connected to dies
* util: make use of kcmp() to compare fds, if it is availableLennart Poettering2015-01-07
|