Add some patches

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2014-06-23 00:30:03 -04:00
parent 7823b319da
commit 5509c00d0f
47 changed files with 2800 additions and 3 deletions

View File

@ -0,0 +1,26 @@
From ac0013190eb64a6528b56a09c29ba595f6ac19e4 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 11 Jun 2014 18:42:38 +0200
Subject: [PATCH] NEWS: add missing comment about the "floppy" group
(cherry picked from commit 4c0d13bdd5ef971a3003899064af1717c8960bee)
---
NEWS | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/NEWS b/NEWS
index 54d9e9e6..1274c30a 100644
--- a/NEWS
+++ b/NEWS
@@ -179,6 +179,11 @@ CHANGES WITH 214:
added which is useful for services that shall run before any
network is configured, for example firewall scripts.
+ * The "floppy" group that previously owned the /dev/fd*
+ devices is no longer used. The "disk" group is now used
+ instead. Distributions should probably deprecate usage of
+ this group.
+
Contributions from: Camilo Aguilar, Christian Hesse, Colin Ian
King, Cristian Rodríguez, Daniel Buch, Dave Reisner, David
Strauss, Denis Tikhomirov, John, Jonathan Liu, Kay Sievers,

View File

@ -0,0 +1,23 @@
From 4bf7b81ac71311d2cd44b8a14d133f613a04a030 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com>
Date: Wed, 11 Jun 2014 17:09:11 +0300
Subject: [PATCH] NEWS: fix directory name
(cherry picked from commit c54bed5d515771c21250b8e0c052cb6600e21d37)
---
NEWS | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 1274c30a..4f3c5222 100644
--- a/NEWS
+++ b/NEWS
@@ -52,7 +52,7 @@ CHANGES WITH 214:
transports. Instead it is assumed the kernel loads them
automatically when required. This only works correctly on
very new kernels. On older kernels, please consider adding
- the kernel modules to /etc/load-modules.d/ as a work-around.
+ the kernel modules to /etc/modules-load.d/ as a work-around.
* The resolv.conf file systemd-resolved generates has been
moved to /run/systemd/resolve/, if you have a symlink from

View File

@ -0,0 +1,53 @@
From 8f8fb5044e90f60e065c5bbceba21aab2986edd5 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Thu, 12 Jun 2014 14:59:53 +0200
Subject: [PATCH] udev: assign group "input" to all input devices
(cherry picked from commit 3dff3e00e044e2d53c76fa842b9a4759d4a50e69)
---
NEWS | 6 ++++++
README | 2 +-
rules/50-udev-default.rules | 1 +
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 4f3c5222..318f3d49 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,11 @@
systemd System and Service Manager
+CHANGES WITH 215:
+ * A new system group "input" is introduced, all input
+ device nodes get this group assigned. This is useful for
+ system-level software to get access to input devices. It
+ complements what is already done for "audio" and "video".
+
CHANGES WITH 214:
* As an experimental feature, udev now tries to lock the
diff --git a/README b/README
index 529c6e19..de159feb 100644
--- a/README
+++ b/README
@@ -168,7 +168,7 @@ USERS AND GROUPS:
even in the very early boot stages, where no other databases
and network are available:
- tty, dialout, kmem, video, audio, lp, cdrom, tape, disk
+ audio, cdrom, dialout, disk, input, kmem, lp, tape, tty, video
During runtime, the journal daemon requires the
"systemd-journal" system group to exist. New journal files will
diff --git a/rules/50-udev-default.rules b/rules/50-udev-default.rules
index 122d07c9..1ecd47a2 100644
--- a/rules/50-udev-default.rules
+++ b/rules/50-udev-default.rules
@@ -23,6 +23,7 @@ KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP=
SUBSYSTEM=="mem", KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640"
+SUBSYSTEM=="input", GROUP="input"
SUBSYSTEM=="input", KERNEL=="js[0-9]*", MODE="0664"
SUBSYSTEM=="video4linux", GROUP="video"

View File

@ -0,0 +1,27 @@
From 89053aff0cc36dfcee6fda6e83b13f6f68c05a82 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Thu, 12 Jun 2014 22:50:04 +0200
Subject: [PATCH] cryptsetup: check that password is not null
Beef up the assert to protect against passing null to strlen.
Found with scan-build.
(cherry picked from commit f268f57f6344d3a2ccf447352ff3ed1313c4a199)
---
src/cryptsetup/cryptsetup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 812b32f6..a67d85e6 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -344,7 +344,7 @@ static int attach_tcrypt(struct crypt_device *cd,
assert(cd);
assert(name);
- assert(key_file || passwords);
+ assert(key_file || (passwords && passwords[0]));
if (arg_tcrypt_hidden)
params.flags |= CRYPT_TCRYPT_HIDDEN_HEADER;

View File

@ -0,0 +1,31 @@
From 3f4dbb254a7ca90dd025a5de24f0fbaf53a9342e Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <andreas@fatal.se>
Date: Fri, 13 Jun 2014 18:48:19 +0200
Subject: [PATCH] core: fix invalid free() in killall()
static int killall(....) in ./src/core/killall.c tries to get "s"
initialized by calling get_process_comm(...) which calls
read_one_line_file(...) which if it fails will mean it is left
uninitialized.
It is then used in argument to strna(s) call where it is
dereferenced(!), in addition to nothing else initializing it before
the scope it is in finishes.
(cherry picked from commit 3e09eb5c83e56bc0184bd9d9c44f76047464f77c)
---
src/core/killall.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/killall.c b/src/core/killall.c
index 57ed41c5..eab48f7d 100644
--- a/src/core/killall.c
+++ b/src/core/killall.c
@@ -168,7 +168,7 @@ static int killall(int sig, Set *pids, bool send_sighup) {
continue;
if (sig == SIGKILL) {
- _cleanup_free_ char *s;
+ _cleanup_free_ char *s = NULL;
get_process_comm(pid, &s);
log_notice("Sending SIGKILL to PID "PID_FMT" (%s).", pid, strna(s));

View File

@ -0,0 +1,29 @@
From e6e0462204a04517c6f31b7ca631d715c6ab04f8 Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <andreas@fatal.se>
Date: Fri, 13 Jun 2014 18:48:21 +0200
Subject: [PATCH] udev: fix invalid free() in enable_name_policy()
static bool enable_name_policy(...) in ./src/udev/net/link-config.c
calls proc_cmdline(...) to get "line" initialized, but
proc_cmdline(...) does not guarantee that atleast when both
conditions (detect_container(NULL) > 0) and
read_full_file(...) returned < 0.
(cherry picked from commit f8a0bb5285024b6ce372c3157e761e6543ebdcd2)
---
src/udev/net/link-config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index a9acc3dd..7a9d01bc 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -185,7 +185,7 @@ static int load_link(link_config_ctx *ctx, const char *filename) {
}
static bool enable_name_policy(void) {
- _cleanup_free_ char *line;
+ _cleanup_free_ char *line = NULL;
char *w, *state;
int r;
size_t l;

View File

@ -0,0 +1,29 @@
From 09220715e259bf23cbe33d497ed92259a9670320 Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <andreas@fatal.se>
Date: Fri, 13 Jun 2014 18:48:18 +0200
Subject: [PATCH] install: fix invalid free() in unit_file_mask()
int unit_file_mask(...) in ./src/shared/install.c calls
get_config_path(...) which can in 4 error cases return without setting
"ret", and thus "prefix" can be uninitialized when unit_file_mask(...)
finishes (which it does directly after the error is returned from
get_config_path(...)).
(cherry picked from commit 223217749e57996336d5730b0a28716cca56d45d)
---
src/shared/install.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/install.c b/src/shared/install.c
index 487d0f66..f5620633 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -563,7 +563,7 @@ int unit_file_mask(
unsigned *n_changes) {
char **i;
- _cleanup_free_ char *prefix;
+ _cleanup_free_ char *prefix = NULL;
int r;
assert(scope >= 0);

View File

@ -0,0 +1,72 @@
From 3c96e9e0757281a04bb066c67fc5f509871e27b0 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 13 Jun 2014 19:05:22 +0200
Subject: [PATCH] rpm: don't hardcode the binary paths in the macros, rely on
$PATH
this gives us a little bit more freedom to move things around later on,
as we don't hardcode the systemd paths in old RPMs that shall work with
new systemds.
(cherry picked from commit 8cf7c96517c3688d29b30651adcda9e71e7fcb07)
---
src/core/macros.systemd.in | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/core/macros.systemd.in b/src/core/macros.systemd.in
index 89b48259..167016a8 100644
--- a/src/core/macros.systemd.in
+++ b/src/core/macros.systemd.in
@@ -37,42 +37,42 @@ Requires(postun): systemd \
%systemd_post() \
if [ $1 -eq 1 ] ; then \
# Initial installation \
- @rootbindir@/systemctl preset %{?*} >/dev/null 2>&1 || : \
+ systemctl preset %{?*} >/dev/null 2>&1 || : \
fi \
%{nil}
%systemd_preun() \
if [ $1 -eq 0 ] ; then \
# Package removal, not upgrade \
- @rootbindir@/systemctl --no-reload disable %{?*} > /dev/null 2>&1 || : \
- @rootbindir@/systemctl stop %{?*} > /dev/null 2>&1 || : \
+ systemctl --no-reload disable %{?*} > /dev/null 2>&1 || : \
+ systemctl stop %{?*} > /dev/null 2>&1 || : \
fi \
%{nil}
%systemd_postun() \
-@rootbindir@/systemctl daemon-reload >/dev/null 2>&1 || : \
+systemctl daemon-reload >/dev/null 2>&1 || : \
%{nil}
%systemd_postun_with_restart() \
-@rootbindir@/systemctl daemon-reload >/dev/null 2>&1 || : \
+systemctl daemon-reload >/dev/null 2>&1 || : \
if [ $1 -ge 1 ] ; then \
# Package upgrade, not uninstall \
- @rootbindir@/systemctl try-restart %{?*} >/dev/null 2>&1 || : \
+ systemctl try-restart %{?*} >/dev/null 2>&1 || : \
fi \
%{nil}
%udev_hwdb_update() \
-@rootbindir@/udevadm hwdb --update >/dev/null 2>&1 || : \
+udevadm hwdb --update >/dev/null 2>&1 || : \
%{nil}
%udev_rules_update() \
-@rootbindir@/udevadm control --reload >/dev/null 2>&1 || : \
+udevadm control --reload >/dev/null 2>&1 || : \
%{nil}
%journal_catalog_update() \
-@rootbindir@/journalctl --update-catalog >/dev/null 2>&1 || : \
+journalctl --update-catalog >/dev/null 2>&1 || : \
%{nil}
%tmpfiles_create() \
-@rootbindir@/systemd-tmpfiles --create %{?*} >/dev/null 2>&1 || : \
+systemd-tmpfiles --create %{?*} >/dev/null 2>&1 || : \
%{nil}

View File

@ -0,0 +1,23 @@
From 0da84688a4228368b2039a08337818dd431221ff Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Thu, 12 Jun 2014 16:41:41 +0100
Subject: [PATCH] Fix spelling mistake, scirpt --> script
(cherry picked from commit 855d111304114e922b34b6c4bc2a0b08766c2668)
---
src/sysv-generator/sysv-generator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 0b8d8f73..18dae5c2 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -791,7 +791,7 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
if (hashmap_contains(all_services, name))
service = hashmap_get(all_services, name);
else {
- log_warning("Could not find init scirpt for %s", name);
+ log_warning("Could not find init script for %s", name);
continue;
}

View File

@ -0,0 +1,29 @@
From 5aef99701f6e9504750adf906160ce23cb9851e4 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 16 Jun 2014 13:20:38 +0200
Subject: [PATCH] tmpfiles: set up selinux label proeprly when creating fifos
(cherry picked from commit 45c196a76b2d883552c90807386d9bed40da822b)
Conflicts:
src/shared/util.c
---
src/tmpfiles/tmpfiles.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index bb12dd0b..3e817cca 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -719,9 +719,11 @@ static int create_item(Item *i) {
case CREATE_FIFO:
+ label_context_set(i->path, S_IFIFO);
RUN_WITH_UMASK(0000) {
r = mkfifo(i->path, i->mode);
}
+ label_context_clear();
if (r < 0 && errno != EEXIST) {
log_error("Failed to create fifo %s: %m", i->path);

View File

@ -0,0 +1,50 @@
From ab25a485218194a432a8238b772005f4506059f3 Mon Sep 17 00:00:00 2001
From: Ruediger Oertel <ro@suse.de>
Date: Fri, 13 Jun 2014 16:41:06 +0200
Subject: [PATCH] Reset signal-mask on re-exec to init=..
Process 1 (aka init) needs to be started with an empty signal mask.
That includes the process 1 that's started after the initrd is finished.
When the initrd is using systemd (as it does with dracut based initrds)
then it is systemd that calls the real init. Normally this is systemd
again, except when the user uses for instance "init=/bin/bash" on the
kernel command line.
(cherry picked from commit 5a85ca1cb622fda4a39c8a6f00dccea7f8a1e82a)
---
src/core/main.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/core/main.c b/src/core/main.c
index d5d1ee2b..e87b8cc8 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1831,6 +1831,7 @@ finish:
if (reexecute) {
const char **args;
unsigned i, args_size;
+ sigset_t ss, o_ss;
/* Close and disarm the watchdog, so that the new
* instance can reinitialize it, but doesn't get
@@ -1914,6 +1915,11 @@ finish:
args[i++] = NULL;
assert(i <= args_size);
+ /* reenable any blocked signals, especially important
+ * if we switch from initial ramdisk to init=... */
+ sigemptyset(&ss);
+ sigprocmask(SIG_SETMASK, &ss, &o_ss);
+
if (switch_root_init) {
args[0] = switch_root_init;
execv(args[0], (char* const*) args);
@@ -1932,6 +1938,8 @@ finish:
log_error("Failed to execute /bin/sh, giving up: %m");
} else
log_warning("Failed to execute /sbin/init, giving up: %m");
+
+ sigprocmask(SIG_SETMASK, &o_ss, NULL);
}
if (arg_serialization) {

View File

@ -0,0 +1,49 @@
From 1d4d5cd68c250af3b232fa049bd2cde171272ee9 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 20 Jun 2014 16:58:21 +0200
Subject: [PATCH] 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.
(cherry picked from commit 9bfcda9528636914aef3e0ab91191bb81654c83d)
---
src/core/main.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/core/main.c b/src/core/main.c
index e87b8cc8..c9472929 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1831,7 +1831,7 @@ finish:
if (reexecute) {
const char **args;
unsigned i, args_size;
- sigset_t ss, o_ss;
+ sigset_t ss;
/* Close and disarm the watchdog, so that the new
* instance can reinitialize it, but doesn't get
@@ -1917,8 +1917,10 @@ finish:
/* reenable any blocked signals, especially important
* if we switch from initial ramdisk to init=... */
- sigemptyset(&ss);
- sigprocmask(SIG_SETMASK, &ss, &o_ss);
+ reset_all_signal_handlers();
+
+ assert_se(sigemptyset(&ss) == 0);
+ assert_se(sigprocmask(SIG_SETMASK, &ss, NULL) == 0);
if (switch_root_init) {
args[0] = switch_root_init;
@@ -1938,8 +1940,6 @@ finish:
log_error("Failed to execute /bin/sh, giving up: %m");
} else
log_warning("Failed to execute /sbin/init, giving up: %m");
-
- sigprocmask(SIG_SETMASK, &o_ss, NULL);
}
if (arg_serialization) {

View File

@ -0,0 +1,37 @@
From 84d1cd0b9bea96ba9ef600582b1ab030f49c5046 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Mon, 16 Jun 2014 23:49:10 +0200
Subject: [PATCH] journal-remote: fix memleak
(cherry picked from commit e94b5a7bc201fe73c4a291169c5c1d21cceee128)
---
src/journal/journal-remote.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/journal/journal-remote.c b/src/journal/journal-remote.c
index 915f234a..31401fb3 100644
--- a/src/journal/journal-remote.c
+++ b/src/journal/journal-remote.c
@@ -291,7 +291,7 @@ static int remove_source(RemoteServer *s, int fd) {
static int add_source(RemoteServer *s, int fd, const char* name) {
RemoteSource *source = NULL;
- char *realname;
+ _cleanup_free_ char *realname = NULL;
int r;
assert(s);
@@ -307,11 +307,11 @@ static int add_source(RemoteServer *s, int fd, const char* name) {
return log_oom();
}
- log_debug("Creating source for fd:%d (%s)", fd, name);
+ log_debug("Creating source for fd:%d (%s)", fd, realname);
r = get_source_for_fd(s, fd, &source);
if (r < 0) {
- log_error("Failed to create source for fd:%d (%s)", fd, name);
+ log_error("Failed to create source for fd:%d (%s)", fd, realname);
return r;
}
assert(source);

View File

@ -0,0 +1,57 @@
From 3e59dbfced8ba0e6258ee5ed6c6a3d895b0fd2b5 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 16 Jun 2014 17:01:26 +0200
Subject: [PATCH] unit-name: fix detection of unit templates/instances
We need to check for the last dot, not the first one in a unit name, for
the suffix. Correct that.
(cherry picked from commit 6ef9eeed61a291cc42b7d911f5cf5a4deca742a3)
---
src/shared/unit-name.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c
index 6c167b43..d0e71f24 100644
--- a/src/shared/unit-name.c
+++ b/src/shared/unit-name.c
@@ -332,7 +332,7 @@ char *unit_name_path_unescape(const char *f) {
}
bool unit_name_is_template(const char *n) {
- const char *p;
+ const char *p, *e;
assert(n);
@@ -340,11 +340,15 @@ bool unit_name_is_template(const char *n) {
if (!p)
return false;
- return p[1] == '.';
+ e = strrchr(p+1, '.');
+ if (!e)
+ return false;
+
+ return e == p + 1;
}
bool unit_name_is_instance(const char *n) {
- const char *p;
+ const char *p, *e;
assert(n);
@@ -352,7 +356,11 @@ bool unit_name_is_instance(const char *n) {
if (!p)
return false;
- return p[1] != '.';
+ e = strrchr(p+1, '.');
+ if (!e)
+ return false;
+
+ return e > p + 1;
}
char *unit_name_replace_instance(const char *f, const char *i) {

View File

@ -0,0 +1,122 @@
From 06cd279be2d9597ac7e19d19ac2883874d801bc7 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 16 Jun 2014 17:19:30 +0200
Subject: [PATCH] install: various modernizations
(cherry picked from commit da39f6a63e9ca59bec23cc9d1cb841703bb5ef56)
---
src/shared/install.c | 43 ++++++++++++++-----------------------------
1 file changed, 14 insertions(+), 29 deletions(-)
diff --git a/src/shared/install.c b/src/shared/install.c
index f5620633..115d831d 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -319,7 +319,8 @@ static int remove_marked_symlinks(
unsigned *n_changes,
char** files) {
- int fd, r = 0;
+ _cleanup_close_ int fd = -1;
+ int r = 0;
bool deleted;
assert(config_path);
@@ -347,8 +348,6 @@ static int remove_marked_symlinks(
r = q;
} while (deleted);
- safe_close(fd);
-
return r;
}
@@ -1830,11 +1829,11 @@ int unit_file_preset(
UnitFileChange **changes,
unsigned *n_changes) {
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
_cleanup_install_context_done_ InstallContext plus = {}, minus = {};
- char **i;
- _cleanup_free_ char *config_path = NULL;
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
+ _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_free_ char *config_path = NULL;
+ char **i;
int r, q;
assert(scope >= 0);
@@ -1861,16 +1860,13 @@ int unit_file_preset(
r = install_info_add_auto(&plus, *i);
else
r = install_info_add_auto(&minus, *i);
-
if (r < 0)
return r;
}
- r = install_context_mark_for_removal(&minus, &paths, &remove_symlinks_to,
- config_path, root_dir);
+ r = install_context_mark_for_removal(&minus, &paths, &remove_symlinks_to, config_path, root_dir);
- q = remove_marked_symlinks(remove_symlinks_to, config_path,
- changes, n_changes, files);
+ q = remove_marked_symlinks(remove_symlinks_to, config_path, changes, n_changes, files);
if (r == 0)
r = q;
@@ -1899,8 +1895,6 @@ int unit_file_get_list(
_cleanup_lookup_paths_free_ LookupPaths paths = {};
char **i;
- _cleanup_free_ char *buf = NULL;
- _cleanup_closedir_ DIR *d = NULL;
int r;
assert(scope >= 0);
@@ -1915,22 +1909,19 @@ int unit_file_get_list(
return r;
STRV_FOREACH(i, paths.unit_path) {
+ _cleanup_closedir_ DIR *d = NULL;
+ _cleanup_free_ char *buf = NULL;
const char *units_dir;
- free(buf);
- buf = NULL;
-
- if (root_dir) {
- if (asprintf(&buf, "%s/%s", root_dir, *i) < 0)
+ if (!isempty(root_dir)) {
+ buf = strjoin(root_dir, "/", *i, NULL);
+ if (!buf)
return -ENOMEM;
units_dir = buf;
} else
units_dir = *i;
- if (d)
- closedir(d);
-
d = opendir(units_dir);
if (!d) {
if (errno == ENOENT)
@@ -1960,15 +1951,9 @@ int unit_file_get_list(
if (hashmap_get(h, de->d_name))
continue;
- r = dirent_ensure_type(d, de);
- if (r < 0) {
- if (r == -ENOENT)
- continue;
-
- return r;
- }
+ dirent_ensure_type(d, de);
- if (de->d_type != DT_LNK && de->d_type != DT_REG)
+ if (!IN_SET(de->d_type, DT_LNK, DT_REG))
continue;
f = new0(UnitFileList, 1);

View File

@ -0,0 +1,118 @@
From bf160761cd5d35458779e96fa13655dd88350ccd Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 16 Jun 2014 19:48:31 +0200
Subject: [PATCH] install: simplify and clarify disabling logic for instanced
units
(cherry picked from commit bcafe923a74e702abbba3655b0270febe143499f)
---
src/shared/install.c | 50 ++++++++++++++++++++++++++++----------------------
1 file changed, 28 insertions(+), 22 deletions(-)
diff --git a/src/shared/install.c b/src/shared/install.c
index 115d831d..40dc7beb 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -194,10 +194,10 @@ static int remove_marked_symlinks_fd(
bool *deleted,
UnitFileChange **changes,
unsigned *n_changes,
- char** files) {
+ char** instance_whitelist) {
- int r = 0;
_cleanup_closedir_ DIR *d = NULL;
+ int r = 0;
assert(remove_symlinks_to);
assert(fd >= 0);
@@ -252,9 +252,8 @@ static int remove_marked_symlinks_fd(
}
/* This will close nfd, regardless whether it succeeds or not */
- q = remove_marked_symlinks_fd(remove_symlinks_to, nfd, p, config_path, deleted, changes, n_changes, files);
-
- if (r == 0)
+ q = remove_marked_symlinks_fd(remove_symlinks_to, nfd, p, config_path, deleted, changes, n_changes, instance_whitelist);
+ if (q < 0 && r == 0)
r = q;
} else if (de->d_type == DT_LNK) {
@@ -262,6 +261,14 @@ static int remove_marked_symlinks_fd(
int q;
bool found;
+ if (!unit_name_is_valid(de->d_name, TEMPLATE_VALID))
+ continue;
+
+ if (unit_name_is_instance(de->d_name) &&
+ instance_whitelist &&
+ !strv_contains(instance_whitelist, de->d_name))
+ continue;
+
p = path_make_absolute(de->d_name, path);
if (!p)
return -ENOMEM;
@@ -280,30 +287,29 @@ static int remove_marked_symlinks_fd(
set_get(remove_symlinks_to, dest) ||
set_get(remove_symlinks_to, basename(dest));
- if (unit_name_is_instance(p))
- found = found && strv_contains(files, basename(p));
-
if (found) {
if (unlink(p) < 0 && errno != ENOENT) {
if (r == 0)
r = -errno;
- } else {
- rmdir_parents(p, config_path);
- path_kill_slashes(p);
+ continue;
+ }
+
+ rmdir_parents(p, config_path);
+
+ path_kill_slashes(p);
- add_file_change(changes, n_changes, UNIT_FILE_UNLINK, p, NULL);
+ add_file_change(changes, n_changes, UNIT_FILE_UNLINK, p, NULL);
- if (!set_get(remove_symlinks_to, p)) {
+ if (!set_get(remove_symlinks_to, p)) {
- q = mark_symlink_for_removal(&remove_symlinks_to, p);
- if (q < 0) {
- if (r == 0)
- r = q;
- } else
- *deleted = true;
- }
+ q = mark_symlink_for_removal(&remove_symlinks_to, p);
+ if (q < 0) {
+ if (r == 0)
+ r = q;
+ } else
+ *deleted = true;
}
}
}
@@ -317,7 +323,7 @@ static int remove_marked_symlinks(
const char *config_path,
UnitFileChange **changes,
unsigned *n_changes,
- char** files) {
+ char** instance_whitelist) {
_cleanup_close_ int fd = -1;
int r = 0;
@@ -343,7 +349,7 @@ static int remove_marked_symlinks(
}
/* This takes possession of cfd and closes it */
- q = remove_marked_symlinks_fd(remove_symlinks_to, cfd, config_path, config_path, &deleted, changes, n_changes, files);
+ q = remove_marked_symlinks_fd(remove_symlinks_to, cfd, config_path, config_path, &deleted, changes, n_changes, instance_whitelist);
if (r == 0)
r = q;
} while (deleted);

View File

@ -0,0 +1,115 @@
From f906059875069ef0b72e54581d78fe4e28b375a3 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 17 Jun 2014 00:10:54 +0200
Subject: [PATCH] install: various modernizations
(cherry picked from commit 1dacfd2ad643019f41fb979f5a8c144172911f85)
---
src/shared/install.c | 47 ++++++++++++++++++++++-------------------------
1 file changed, 22 insertions(+), 25 deletions(-)
diff --git a/src/shared/install.c b/src/shared/install.c
index 40dc7beb..0f49f2a9 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -287,30 +287,31 @@ static int remove_marked_symlinks_fd(
set_get(remove_symlinks_to, dest) ||
set_get(remove_symlinks_to, basename(dest));
- if (found) {
+ if (!found)
+ continue;
- if (unlink(p) < 0 && errno != ENOENT) {
- if (r == 0)
- r = -errno;
- continue;
- }
+ if (unlink(p) < 0 && errno != ENOENT) {
+
+ if (r == 0)
+ r = -errno;
+ continue;
+ }
- rmdir_parents(p, config_path);
+ rmdir_parents(p, config_path);
- path_kill_slashes(p);
+ path_kill_slashes(p);
- add_file_change(changes, n_changes, UNIT_FILE_UNLINK, p, NULL);
+ add_file_change(changes, n_changes, UNIT_FILE_UNLINK, p, NULL);
- if (!set_get(remove_symlinks_to, p)) {
+ if (!set_get(remove_symlinks_to, p)) {
- q = mark_symlink_for_removal(&remove_symlinks_to, p);
- if (q < 0) {
- if (r == 0)
- r = q;
- } else
- *deleted = true;
- }
+ q = mark_symlink_for_removal(&remove_symlinks_to, p);
+ if (q < 0) {
+ if (r == 0)
+ r = q;
+ } else
+ *deleted = true;
}
}
}
@@ -417,10 +418,8 @@ static int find_symlinks_fd(
/* This will close nfd, regardless whether it succeeds or not */
q = find_symlinks_fd(name, nfd, p, config_path, same_name_link);
-
if (q > 0)
return 1;
-
if (r == 0)
r = q;
@@ -595,7 +594,6 @@ int unit_file_mask(
if (symlink("/dev/null", path) >= 0) {
add_file_change(changes, n_changes, UNIT_FILE_SYMLINK, path, "/dev/null");
-
continue;
}
@@ -762,7 +760,6 @@ int unit_file_link(
_cleanup_free_ char *dest = NULL;
q = readlink_and_make_absolute(path, &dest);
-
if (q < 0 && errno != ENOENT) {
if (r == 0)
r = q;
@@ -1302,8 +1299,8 @@ static int install_info_symlink_link(
UnitFileChange **changes,
unsigned *n_changes) {
- int r;
_cleanup_free_ char *path = NULL;
+ int r;
assert(i);
assert(paths);
@@ -1314,11 +1311,11 @@ static int install_info_symlink_link(
if (r != 0)
return r;
- if (asprintf(&path, "%s/%s", config_path, i->name) < 0)
+ path = strjoin(config_path, "/", i->name, NULL);
+ if (!path)
return -ENOMEM;
- r = create_symlink(i->path, path, force, changes, n_changes);
- return r;
+ return create_symlink(i->path, path, force, changes, n_changes);
}
static int install_info_apply(

View File

@ -0,0 +1,69 @@
From b533ed36a5ca33ba718ad37b18d1aa175f232d03 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 17 Jun 2014 00:11:47 +0200
Subject: [PATCH] install: use symlink_atomic() instead of unlink()+symlink()
when force creating a symlink
(cherry picked from commit 1f8c46040e824d7367c2f013de13c87d53f249dc)
---
src/shared/install.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/src/shared/install.c b/src/shared/install.c
index 0f49f2a9..f0d3d1b7 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -603,13 +603,9 @@ int unit_file_mask(
continue;
if (force) {
- unlink(path);
-
- if (symlink("/dev/null", path) >= 0) {
-
+ if (symlink_atomic("/dev/null", path) >= 0) {
add_file_change(changes, n_changes, UNIT_FILE_UNLINK, path, NULL);
add_file_change(changes, n_changes, UNIT_FILE_SYMLINK, path, "/dev/null");
-
continue;
}
}
@@ -770,13 +766,9 @@ int unit_file_link(
continue;
if (force) {
- unlink(path);
-
- if (symlink(*i, path) >= 0) {
-
+ if (symlink_atomic(*i, path) >= 0) {
add_file_change(changes, n_changes, UNIT_FILE_UNLINK, path, NULL);
add_file_change(changes, n_changes, UNIT_FILE_SYMLINK, path, *i);
-
continue;
}
}
@@ -1172,17 +1164,14 @@ static int create_symlink(
if (!force)
return -EEXIST;
- r = unlink(new_path);
- if (r < 0 && errno != ENOENT)
- return -errno;
+ r = symlink_atomic(old_path, new_path);
+ if (r < 0)
+ return r;
- if (symlink(old_path, new_path) >= 0) {
- add_file_change(changes, n_changes, UNIT_FILE_UNLINK, new_path, NULL);
- add_file_change(changes, n_changes, UNIT_FILE_SYMLINK, new_path, old_path);
- return 0;
- }
+ add_file_change(changes, n_changes, UNIT_FILE_UNLINK, new_path, NULL);
+ add_file_change(changes, n_changes, UNIT_FILE_SYMLINK, new_path, old_path);
- return -errno;
+ return 0;
}
static int install_info_symlink_alias(

View File

@ -0,0 +1,124 @@
From acefb01e351be2f1dbd05078fdf4522a9dadaa4d Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 17 Jun 2014 00:13:48 +0200
Subject: [PATCH] install: when looking for a unit file for enabling, search
for templates only after traversing all search directories
Let's always make sure to look in all search directories for the full
unit names first, before looking for templates for them.
(cherry picked from commit e50bd775163cd96be1888943a8785a436be710e8)
---
src/shared/install.c | 74 +++++++++++++++++++++++++++-------------------------
1 file changed, 38 insertions(+), 36 deletions(-)
diff --git a/src/shared/install.c b/src/shared/install.c
index f0d3d1b7..e16de4d6 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1035,67 +1035,69 @@ static int unit_file_search(
assert(paths);
if (info->path) {
- char *full_path = NULL;
+ const char *path;
- if (!isempty(root_dir))
- full_path = strappenda(root_dir, info->path);
+ if (isempty(root_dir))
+ path = info->path;
+ else
+ path = strappenda(root_dir, info->path);
- return unit_file_load(c, info, full_path ?: info->path, allow_symlink);
+ return unit_file_load(c, info, path, allow_symlink);
}
assert(info->name);
STRV_FOREACH(p, paths->unit_path) {
- _cleanup_free_ char *path = NULL, *full_path = NULL;
+ _cleanup_free_ char *path = NULL;
- path = strjoin(*p, "/", info->name, NULL);
+ if (isempty(root_dir))
+ path = strjoin(*p, "/", info->name, NULL);
+ else
+ path = strjoin(root_dir, "/", *p, "/", info->name, NULL);
if (!path)
return -ENOMEM;
- if (!isempty(root_dir)) {
- full_path = strappend(root_dir, path);
- if (!full_path)
- return -ENOMEM;
- }
-
- r = unit_file_load(c, info, full_path ?: path, allow_symlink);
+ r = unit_file_load(c, info, path, allow_symlink);
if (r >= 0) {
info->path = path;
path = NULL;
- } else if (r == -ENOENT && unit_name_is_instance(info->name)) {
- /* Unit file doesn't exist, however instance enablement was requested.
- * We will check if it is possible to load template unit file. */
- _cleanup_free_ char *template = NULL, *template_dir = NULL;
+ return r;
+ }
+ if (r != -ENOENT && r != -ELOOP)
+ return r;
+ }
- template = unit_name_template(info->name);
- if (!template)
- return -ENOMEM;
+ if (unit_name_is_instance(info->name)) {
+
+ /* Unit file doesn't exist, however instance
+ * enablement was requested. We will check if it is
+ * possible to load template unit file. */
- /* We will reuse path variable since we don't need it anymore. */
- template_dir = path;
- *(strrchr(template_dir, '/') + 1) = '\0';
+ _cleanup_free_ char *template = NULL, *template_dir = NULL;
+
+ template = unit_name_template(info->name);
+ if (!template)
+ return -ENOMEM;
- path = strappend(template_dir, template);
+ STRV_FOREACH(p, paths->unit_path) {
+ _cleanup_free_ char *path = NULL;
+
+ if (isempty(root_dir))
+ path = strjoin(*p, "/", template, NULL);
+ else
+ path = strjoin(root_dir, "/", *p, "/", template, NULL);
if (!path)
return -ENOMEM;
- if (!isempty(root_dir)) {
- free(full_path);
- full_path = strappend(root_dir, path);
- if (!full_path)
- return -ENOMEM;
- }
-
- /* Let's try to load template unit. */
- r = unit_file_load(c, info, full_path ?: path, allow_symlink);
+ r = unit_file_load(c, info, path, allow_symlink);
if (r >= 0) {
info->path = path;
path = NULL;
+ return r;
}
+ if (r != -ENOENT && r != -ELOOP)
+ return r;
}
-
- if (r != -ENOENT && r != -ELOOP)
- return r;
}
return -ENOENT;

View File

@ -0,0 +1,60 @@
From 90d16404421d61e4e13bcff35f914477b9d04d81 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 17 Jun 2014 00:33:39 +0200
Subject: [PATCH] install: make sure "systemctl disable foobar@.service"
actually removes all instances
(cherry picked from commit 559367add5e22bf32d14fa1496512c68488f48b0)
---
src/shared/install.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/shared/install.c b/src/shared/install.c
index e16de4d6..278350be 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -266,8 +266,22 @@ static int remove_marked_symlinks_fd(
if (unit_name_is_instance(de->d_name) &&
instance_whitelist &&
- !strv_contains(instance_whitelist, de->d_name))
- continue;
+ !strv_contains(instance_whitelist, de->d_name)) {
+
+ _cleanup_free_ char *w;
+
+ /* OK, the file is not listed directly
+ * in the whitelist, so let's check if
+ * the template of it might be
+ * listed. */
+
+ w = unit_name_template(de->d_name);
+ if (!w)
+ return -ENOMEM;
+
+ if (!strv_contains(instance_whitelist, w))
+ continue;
+ }
p = path_make_absolute(de->d_name, path);
if (!p)
@@ -290,18 +304,14 @@ static int remove_marked_symlinks_fd(
if (!found)
continue;
-
if (unlink(p) < 0 && errno != ENOENT) {
-
if (r == 0)
r = -errno;
continue;
}
- rmdir_parents(p, config_path);
-
path_kill_slashes(p);
-
+ rmdir_parents(p, config_path);
add_file_change(changes, n_changes, UNIT_FILE_UNLINK, p, NULL);
if (!set_get(remove_symlinks_to, p)) {

View File

@ -0,0 +1,146 @@
From c88a943a7300a2c206d17aabc733ba3704eb83e5 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 17 Jun 2014 00:53:49 +0200
Subject: [PATCH] install: make sure that --root= mode doesn't make us consider
all units outside of search path
(cherry picked from commit 8f294b45cbb627d31342f6a79444be59ce7e2274)
---
src/shared/install.c | 41 +++++++++++++++++++++++++++++++++++++----
src/shared/util.c | 16 ----------------
src/shared/util.h | 1 -
3 files changed, 37 insertions(+), 21 deletions(-)
diff --git a/src/shared/install.c b/src/shared/install.c
index 278350be..509ae933 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -47,6 +47,37 @@ typedef struct {
#define _cleanup_install_context_done_ _cleanup_(install_context_done)
+static int in_search_path(const char *path, char **search, const char *root_dir) {
+ _cleanup_free_ char *parent = NULL;
+ char **i;
+ int r;
+
+ assert(path);
+
+ r = path_get_parent(path, &parent);
+ if (r < 0)
+ return r;
+
+ STRV_FOREACH(i, search) {
+ _cleanup_free_ char *buf = NULL;
+ const char *p;
+
+ if (root_dir) {
+ buf = strjoin(root_dir, "/", *i, NULL);
+ if (!buf)
+ return -ENOMEM;
+
+ p = buf;
+ } else
+ p = *i;
+
+ if (path_equal(parent, p))
+ return 1;
+ }
+
+ return 0;
+}
+
static int lookup_paths_init_from_scope(LookupPaths *paths,
UnitFileScope scope,
const char *root_dir) {
@@ -746,7 +777,7 @@ int unit_file_link(
continue;
}
- q = in_search_path(*i, paths.unit_path);
+ q = in_search_path(*i, paths.unit_path, root_dir);
if (q < 0)
return q;
@@ -1296,6 +1327,7 @@ static int install_info_symlink_link(
InstallInfo *i,
LookupPaths *paths,
const char *config_path,
+ const char *root_dir,
bool force,
UnitFileChange **changes,
unsigned *n_changes) {
@@ -1308,7 +1340,7 @@ static int install_info_symlink_link(
assert(config_path);
assert(i->path);
- r = in_search_path(i->path, paths->unit_path);
+ r = in_search_path(i->path, paths->unit_path, root_dir);
if (r != 0)
return r;
@@ -1323,6 +1355,7 @@ static int install_info_apply(
InstallInfo *i,
LookupPaths *paths,
const char *config_path,
+ const char *root_dir,
bool force,
UnitFileChange **changes,
unsigned *n_changes) {
@@ -1343,7 +1376,7 @@ static int install_info_apply(
if (r == 0)
r = q;
- q = install_info_symlink_link(i, paths, config_path, force, changes, n_changes);
+ q = install_info_symlink_link(i, paths, config_path, root_dir, force, changes, n_changes);
if (r == 0)
r = q;
@@ -1383,7 +1416,7 @@ static int install_context_apply(
} else if (r >= 0)
r += q;
- q = install_info_apply(i, paths, config_path, force, changes, n_changes);
+ q = install_info_apply(i, paths, config_path, root_dir, force, changes, n_changes);
if (r >= 0 && q < 0)
r = q;
}
diff --git a/src/shared/util.c b/src/shared/util.c
index 91cbf204..9be80887 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4452,22 +4452,6 @@ int dirent_ensure_type(DIR *d, struct dirent *de) {
return 0;
}
-int in_search_path(const char *path, char **search) {
- char **i;
- _cleanup_free_ char *parent = NULL;
- int r;
-
- r = path_get_parent(path, &parent);
- if (r < 0)
- return r;
-
- STRV_FOREACH(i, search)
- if (path_equal(parent, *i))
- return 1;
-
- return 0;
-}
-
int get_files_in_directory(const char *path, char ***list) {
_cleanup_closedir_ DIR *d = NULL;
size_t bufsize = 0, n = 0;
diff --git a/src/shared/util.h b/src/shared/util.h
index 0f8c3933..9c38499a 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -543,7 +543,6 @@ int glob_extend(char ***strv, const char *path);
int dirent_ensure_type(DIR *d, struct dirent *de);
-int in_search_path(const char *path, char **search);
int get_files_in_directory(const char *path, char ***list);
char *strjoin(const char *x, ...) _sentinel_;

View File

@ -0,0 +1,49 @@
From 09fcc5cffa54468595fbf6b81308cd22e896cdfe Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 17 Jun 2014 01:05:39 +0200
Subject: [PATCH] log: don't downgrade log level in non-PID 1 if "quiet" is
passed on kernel cmdline
"debug" should apply to all tools, but "quiet" only to PID1.
(cherry picked from commit d7b15e0a0161e8fd823bffd61a4799364871582f)
---
src/core/main.c | 5 +++++
src/shared/log.c | 3 ---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/core/main.c b/src/core/main.c
index c9472929..80a2ea3a 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -412,11 +412,16 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
}
} else if (streq(key, "quiet") && !value) {
+
+ log_set_max_level(LOG_NOTICE);
+
if (arg_show_status == _SHOW_STATUS_UNSET)
arg_show_status = SHOW_STATUS_AUTO;
} else if (streq(key, "debug") && !value) {
+
log_set_max_level(LOG_DEBUG);
+
if (detect_container(NULL) > 0)
log_set_target(LOG_TARGET_CONSOLE);
diff --git a/src/shared/log.c b/src/shared/log.c
index 6f17705a..9039db34 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -878,9 +878,6 @@ void log_parse_environment(void) {
if (l == 5 && startswith(w, "debug")) {
log_set_max_level(LOG_DEBUG);
break;
- } else if (l == 5 && startswith(w, "quiet")) {
- log_set_max_level(LOG_WARNING);
- break;
}
}
}

View File

@ -0,0 +1,148 @@
From 7e1db29dde294155be972acf6d3e2db4d27266de Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 17 Jun 2014 01:37:54 +0200
Subject: [PATCH] install: simplify symlink --root= logic
(cherry picked from commit 278fa5758c8e30f03c8c50f15873d55edfc4cbaf)
---
src/shared/install.c | 59 +++++++++++++---------------------------------------
1 file changed, 15 insertions(+), 44 deletions(-)
diff --git a/src/shared/install.c b/src/shared/install.c
index 509ae933..8322970a 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -47,9 +47,8 @@ typedef struct {
#define _cleanup_install_context_done_ _cleanup_(install_context_done)
-static int in_search_path(const char *path, char **search, const char *root_dir) {
+static int in_search_path(const char *path, char **search) {
_cleanup_free_ char *parent = NULL;
- char **i;
int r;
assert(path);
@@ -58,24 +57,7 @@ static int in_search_path(const char *path, char **search, const char *root_dir)
if (r < 0)
return r;
- STRV_FOREACH(i, search) {
- _cleanup_free_ char *buf = NULL;
- const char *p;
-
- if (root_dir) {
- buf = strjoin(root_dir, "/", *i, NULL);
- if (!buf)
- return -ENOMEM;
-
- p = buf;
- } else
- p = *i;
-
- if (path_equal(parent, p))
- return 1;
- }
-
- return 0;
+ return strv_contains(search, parent);
}
static int lookup_paths_init_from_scope(LookupPaths *paths,
@@ -777,7 +759,7 @@ int unit_file_link(
continue;
}
- q = in_search_path(*i, paths.unit_path, root_dir);
+ q = in_search_path(*i, paths.unit_path);
if (q < 0)
return q;
@@ -1021,6 +1003,7 @@ static int unit_file_load(
InstallContext *c,
InstallInfo *info,
const char *path,
+ const char *root_dir,
bool allow_symlink) {
const ConfigTableItem items[] = {
@@ -1032,14 +1015,16 @@ static int unit_file_load(
{ NULL, NULL, NULL, 0, NULL }
};
- int fd;
_cleanup_fclose_ FILE *f = NULL;
- int r;
+ int fd, r;
assert(c);
assert(info);
assert(path);
+ if (!isempty(root_dir))
+ path = strappenda3(root_dir, "/", path);
+
fd = open(path, O_RDONLY|O_CLOEXEC|O_NOCTTY|(allow_symlink ? 0 : O_NOFOLLOW));
if (fd < 0)
return -errno;
@@ -1075,30 +1060,19 @@ static int unit_file_search(
assert(info);
assert(paths);
- if (info->path) {
- const char *path;
-
- if (isempty(root_dir))
- path = info->path;
- else
- path = strappenda(root_dir, info->path);
-
- return unit_file_load(c, info, path, allow_symlink);
- }
+ if (info->path)
+ return unit_file_load(c, info, info->path, root_dir, allow_symlink);
assert(info->name);
STRV_FOREACH(p, paths->unit_path) {
_cleanup_free_ char *path = NULL;
- if (isempty(root_dir))
- path = strjoin(*p, "/", info->name, NULL);
- else
- path = strjoin(root_dir, "/", *p, "/", info->name, NULL);
+ path = strjoin(*p, "/", info->name, NULL);
if (!path)
return -ENOMEM;
- r = unit_file_load(c, info, path, allow_symlink);
+ r = unit_file_load(c, info, path, root_dir, allow_symlink);
if (r >= 0) {
info->path = path;
path = NULL;
@@ -1123,14 +1097,11 @@ static int unit_file_search(
STRV_FOREACH(p, paths->unit_path) {
_cleanup_free_ char *path = NULL;
- if (isempty(root_dir))
- path = strjoin(*p, "/", template, NULL);
- else
- path = strjoin(root_dir, "/", *p, "/", template, NULL);
+ path = strjoin(*p, "/", template, NULL);
if (!path)
return -ENOMEM;
- r = unit_file_load(c, info, path, allow_symlink);
+ r = unit_file_load(c, info, path, root_dir, allow_symlink);
if (r >= 0) {
info->path = path;
path = NULL;
@@ -1340,7 +1311,7 @@ static int install_info_symlink_link(
assert(config_path);
assert(i->path);
- r = in_search_path(i->path, paths->unit_path, root_dir);
+ r = in_search_path(i->path, paths->unit_path);
if (r != 0)
return r;

View File

@ -0,0 +1,49 @@
From 90df11b158e4026a73281c4df9b562a74f7045f1 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 17 Jun 2014 01:56:44 +0200
Subject: [PATCH] conf-files: fix when for --root= logic
This is based on parts of similar patches from Michael Marineau and
Lukas Nykrin, but simply uses strappenda3().
(cherry picked from commit cebed5005b5ede17fc52ab50c054fca73bc938b8)
---
src/shared/conf-files.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c
index 52017821..59bc8cee 100644
--- a/src/shared/conf-files.c
+++ b/src/shared/conf-files.c
@@ -37,10 +37,20 @@
#include "hashmap.h"
#include "conf-files.h"
-static int files_add(Hashmap *h, const char *dirpath, const char *suffix) {
+static int files_add(Hashmap *h, const char *dirpath, const char *suffix, const char *root) {
_cleanup_closedir_ DIR *dir = NULL;
- dir = opendir(dirpath);
+ assert(dirpath);
+ assert(suffix);
+
+ if (isempty(root))
+ dir = opendir(dirpath);
+ else {
+ const char *p;
+
+ p = strappenda3(root, "/", dirpath);
+ dir = opendir(p);
+ }
if (!dir) {
if (errno == ENOENT)
return 0;
@@ -108,7 +118,7 @@ static int conf_files_list_strv_internal(char ***strv, const char *suffix, const
return -ENOMEM;
STRV_FOREACH(p, dirs) {
- r = files_add(fh, *p, suffix);
+ r = files_add(fh, *p, suffix, root);
if (r == -ENOMEM) {
hashmap_free_free(fh);
return r;

View File

@ -0,0 +1,26 @@
From 12c375aecad2df91b32a799460585f1a97a106a8 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 17 Jun 2014 02:13:08 +0200
Subject: [PATCH] networkd: don't pull in systemd-networkd-wait-online service
from systemd-networkd when enabling
networkd-wait-online should never exist in the default transaction,
unless explicitly enable or pulled in via things like NFS. However, just
enabling networkd shouldn't enable networkd-wait-online, since it's
common to use the former without the latter.
(cherry picked from commit 324d7a53b9c53b33520b97f2562219ac4143f581)
---
units/systemd-networkd.service.in | 1 -
1 file changed, 1 deletion(-)
diff --git a/units/systemd-networkd.service.in b/units/systemd-networkd.service.in
index 48f4d63a..f3bf95d3 100644
--- a/units/systemd-networkd.service.in
+++ b/units/systemd-networkd.service.in
@@ -25,5 +25,4 @@ ProtectHome=yes
WatchdogSec=1min
[Install]
-Also=systemd-networkd-wait-online.service
WantedBy=multi-user.target

View File

@ -0,0 +1,35 @@
From 985c32b7716eea3f04f0b423ef3d136708b6ad51 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Mon, 16 Jun 2014 18:49:12 +0200
Subject: [PATCH] bootchart: set white background
In programs like eog and gimp the transparant background did not
look very good.
Similar fix from the one done in systemd-analyze (418e3750)
(cherry picked from commit a7997073ac07add6cb30dcd9491c0179b2d6ad52)
---
src/bootchart/svg.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
index a53f98a9..81211995 100644
--- a/src/bootchart/svg.c
+++ b/src/bootchart/svg.c
@@ -123,6 +123,7 @@ static void svg_header(void) {
svg("<defs>\n <style type=\"text/css\">\n <![CDATA[\n");
svg(" rect { stroke-width: 1; }\n");
+ svg(" rect.bg { fill: rgb(255,255,255); }\n");
svg(" rect.cpu { fill: rgb(64,64,240); stroke-width: 0; fill-opacity: 0.7; }\n");
svg(" rect.wait { fill: rgb(240,240,0); stroke-width: 0; fill-opacity: 0.7; }\n");
svg(" rect.bi { fill: rgb(240,128,128); stroke-width: 0; fill-opacity: 0.7; }\n");
@@ -1270,6 +1271,7 @@ void svg_do(const char *build) {
/* after this, we can draw the header with proper sizing */
svg_header();
+ svg("<rect class=\"bg\" width=\"100%%\" height=\"100%%\" />\n\n");
svg("<g transform=\"translate(10,400)\">\n");
svg_io_bi_bar();

View File

@ -0,0 +1,23 @@
From 4b700b54f53769239daa9d62ba1a75804b1f6265 Mon Sep 17 00:00:00 2001
From: Ronny Chevalier <chevalier.ronny@gmail.com>
Date: Tue, 17 Jun 2014 19:26:14 +0200
Subject: [PATCH] build-sys: add missing backslash
(cherry picked from commit fe582db94bac3743b87d67d880497fe40b06dd2f)
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 959c1210..cb9b1fa8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3453,7 +3453,7 @@ libsystemd_journal_internal_la_SOURCES = \
src/journal/mmap-cache.h
# using _CFLAGS = in the conditional below would suppress AM_CFLAGS
-libsystemd_journal_internal_la_CFLAGS =
+libsystemd_journal_internal_la_CFLAGS = \
$(AM_CFLAGS)
libsystemd_journal_internal_la_LIBADD =

View File

@ -0,0 +1,34 @@
From 415796b7022e7f7756effbaf795bf46bbb6cba5f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 17 Jun 2014 23:51:21 +0200
Subject: [PATCH] namespace: properly label device nodes we create
https://bugzilla.redhat.com/show_bug.cgi?id=1081429
(cherry picked from commit dd078a1ef844d2ab66b8fb1e58dd73522262fad6)
---
src/core/namespace.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 3b5402b7..d1513ce2 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -42,6 +42,7 @@
#include "mkdir.h"
#include "dev-setup.h"
#include "def.h"
+#include "label.h"
typedef enum MountMode {
/* This is ordered by priority! */
@@ -223,7 +224,10 @@ static int mount_dev(BindMount *m) {
goto fail;
}
+ label_context_set(d, st.st_mode);
r = mknod(dn, st.st_mode, st.st_rdev);
+ label_context_clear();
+
if (r < 0) {
r = -errno;
goto fail;

View File

@ -0,0 +1,32 @@
From 22549162275fdd36e978a209469772997397f9d7 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 18 Jun 2014 00:02:08 +0200
Subject: [PATCH] tmpfiles: create directories already with the right label,
instead of creating them first, and relabeling them afterwards
(cherry picked from commit 6f04529399a7a59cfe549913349176409a4dc2e3)
---
src/tmpfiles/tmpfiles.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 3e817cca..7950354d 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -693,12 +693,12 @@ static int create_item(Item *i) {
RUN_WITH_UMASK(0000) {
mkdir_parents_label(i->path, 0755);
- r = mkdir(i->path, i->mode);
+ r = mkdir_label(i->path, i->mode);
}
- if (r < 0 && errno != EEXIST) {
- log_error("Failed to create directory %s: %m", i->path);
- return -errno;
+ if (r < 0 && r != -EEXIST) {
+ log_error("Failed to create directory %s: %s", i->path, strerror(-r));
+ return r;
}
if (stat(i->path, &st) < 0) {

View File

@ -0,0 +1,101 @@
From ed5678903964de92ba74baf2e5597914a3d44583 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 18 Jun 2014 00:07:56 +0200
Subject: [PATCH] cryptsetup: introduce new cryptsetup-pre.traget unit so that
services can make sure they are started before and stopped after any LUKS
setup
https://bugzilla.redhat.com/show_bug.cgi?id=1097938
(cherry picked from commit 9542239eaf481decca6c254dffb3f2b4e716545e)
---
Makefile.am | 3 ++-
man/systemd.special.xml | 22 ++++++++++++++++++++++
src/cryptsetup/cryptsetup-generator.c | 2 +-
units/cryptsetup-pre.target | 11 +++++++++++
4 files changed, 36 insertions(+), 2 deletions(-)
create mode 100644 units/cryptsetup-pre.target
diff --git a/Makefile.am b/Makefile.am
index cb9b1fa8..75d62f06 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3846,7 +3846,8 @@ systemgenerator_PROGRAMS += \
systemd-cryptsetup-generator
dist_systemunit_DATA += \
- units/cryptsetup.target
+ units/cryptsetup.target \
+ units/cryptsetup-pre.target
systemd_cryptsetup_SOURCES = \
src/cryptsetup/cryptsetup.c
diff --git a/man/systemd.special.xml b/man/systemd.special.xml
index cda6edd4..f29cc23c 100644
--- a/man/systemd.special.xml
+++ b/man/systemd.special.xml
@@ -52,6 +52,7 @@
<filename>bluetooth.target</filename>,
<filename>ctrl-alt-del.target</filename>,
<filename>cryptsetup.target</filename>,
+ <filename>cryptsetup-pre.target</filename>,
<filename>dbus.service</filename>,
<filename>dbus.socket</filename>,
<filename>default.target</filename>,
@@ -841,6 +842,27 @@
<variablelist>
<varlistentry>
+ <term><filename>cryptsetup-pre.target</filename></term>
+ <listitem>
+ <para>This passive target unit
+ may be pulled in by services
+ that want to run before any
+ encrypted block device is set
+ up. All encrypted block
+ devices are set up after this
+ target has been reached. Since
+ the shutdown order is
+ implicitly the reverse
+ start-up order between units
+ this target is particularly
+ useful to ensure that a
+ service is shut down only
+ after all encrypted block
+ devices are fully
+ stopped.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><filename>local-fs-pre.target</filename></term>
<listitem>
<para>This target unit is
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index f4eeb2ad..dfdca1e4 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -127,7 +127,7 @@ static int create_disk(
"Conflicts=umount.target\n"
"BindsTo=dev-mapper-%i.device\n"
"IgnoreOnIsolate=true\n"
- "After=systemd-readahead-collect.service systemd-readahead-replay.service\n",
+ "After=systemd-readahead-collect.service systemd-readahead-replay.service cryptsetup-pre.target\n",
f);
if (!nofail)
diff --git a/units/cryptsetup-pre.target b/units/cryptsetup-pre.target
new file mode 100644
index 00000000..65353419
--- /dev/null
+++ b/units/cryptsetup-pre.target
@@ -0,0 +1,11 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Encrypted Volumes (Pre)
+Documentation=man:systemd.special(7)
+RefuseManualStart=yes

View File

@ -0,0 +1,23 @@
From 54687582ebc848ae90112341c5a726a8861c0029 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Wed, 18 Jun 2014 03:37:32 +0200
Subject: [PATCH] rules: add loop-control and btrfs-control to "disk" group
(cherry picked from commit 27e7c26268bd4c16edb92f2b8a8626b00c6f2dad)
---
rules/50-udev-default.rules | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rules/50-udev-default.rules b/rules/50-udev-default.rules
index 1ecd47a2..2bf9c1ec 100644
--- a/rules/50-udev-default.rules
+++ b/rules/50-udev-default.rules
@@ -59,6 +59,8 @@ KERNEL=="pktcdvd", GROUP="cdrom"
SUBSYSTEM=="scsi_generic|scsi_tape", SUBSYSTEMS=="scsi", ATTRS{type}=="1|8", GROUP="tape"
SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="0", GROUP="disk"
KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk"
+KERNEL=="loop-control", GROUP="disk", OPTIONS+="static_node=loop-control"
+KERNEL=="btrfs-control", GROUP="disk"
KERNEL=="rawctl", GROUP="disk"
SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", GROUP="disk"
SUBSYSTEM=="aoe", GROUP="disk", MODE="0220"

View File

@ -0,0 +1,80 @@
From 60ab4dd0d578ced48a59745e5728685ca949c4ee Mon Sep 17 00:00:00 2001
From: Marcel Holtmann <marcel@holtmann.org>
Date: Wed, 18 Jun 2014 13:55:32 +0200
Subject: [PATCH] hwdb: Update database of Bluetooth company identifiers
(cherry picked from commit 7cfa80f07e94c3e48703d145ef03a73dd6e7b983)
---
hwdb/20-bluetooth-vendor-product.hwdb | 42 ++++++++++++++++++++++++++++++++---
1 file changed, 39 insertions(+), 3 deletions(-)
diff --git a/hwdb/20-bluetooth-vendor-product.hwdb b/hwdb/20-bluetooth-vendor-product.hwdb
index a65c7db3..377748a5 100644
--- a/hwdb/20-bluetooth-vendor-product.hwdb
+++ b/hwdb/20-bluetooth-vendor-product.hwdb
@@ -115,7 +115,7 @@ bluetooth:v0024*
ID_VENDOR_FROM_DATABASE=Alcatel
bluetooth:v0025*
- ID_VENDOR_FROM_DATABASE=Philips Semiconductors
+ ID_VENDOR_FROM_DATABASE=NXP Semiconductors (formerly Philips Semiconductors)
bluetooth:v0026*
ID_VENDOR_FROM_DATABASE=C Technologies
@@ -427,7 +427,7 @@ bluetooth:v008B*
ID_VENDOR_FROM_DATABASE=Topcorn Positioning Systems, LLC
bluetooth:v008C*
- ID_VENDOR_FROM_DATABASE=Qualcomm Retail Solutions, Inc. (formerly Qualcomm Labs, Inc.)
+ ID_VENDOR_FROM_DATABASE=Gimbal Inc. (formerly Qualcomm Labs, Inc. and Qualcomm Retail Solutions, Inc.)
bluetooth:v008D*
ID_VENDOR_FROM_DATABASE=Zscan Software
@@ -1006,10 +1006,46 @@ bluetooth:v014C*
ID_VENDOR_FROM_DATABASE=Mesh-Net Ltd
bluetooth:v014D*
- ID_VENDOR_FROM_DATABASE=HUIZHOU DESAY SV AUTOMOTIVE CO., LTD.
+ ID_VENDOR_FROM_DATABASE=Huizhou Desay SV Automotive CO., LTD.
bluetooth:v014E*
ID_VENDOR_FROM_DATABASE=Tangerine, Inc.
bluetooth:v014F*
ID_VENDOR_FROM_DATABASE=B&W Group Ltd.
+
+bluetooth:v0150*
+ ID_VENDOR_FROM_DATABASE=Pioneer Corporation
+
+bluetooth:v0151*
+ ID_VENDOR_FROM_DATABASE=OnBeep
+
+bluetooth:v0152*
+ ID_VENDOR_FROM_DATABASE=Vernier Software & Technology
+
+bluetooth:v0153*
+ ID_VENDOR_FROM_DATABASE=ROL Ergo
+
+bluetooth:v0154*
+ ID_VENDOR_FROM_DATABASE=Pebble Technology
+
+bluetooth:v0155*
+ ID_VENDOR_FROM_DATABASE=NETATMO
+
+bluetooth:v0156*
+ ID_VENDOR_FROM_DATABASE=Accumulate AB
+
+bluetooth:v0157*
+ ID_VENDOR_FROM_DATABASE=Anhui Huami Information Technology Co., Ltd.
+
+bluetooth:v0158*
+ ID_VENDOR_FROM_DATABASE=Inmite s.r.o.
+
+bluetooth:v0159*
+ ID_VENDOR_FROM_DATABASE=ChefSteps, Inc.
+
+bluetooth:v015A*
+ ID_VENDOR_FROM_DATABASE=micus AG
+
+bluetooth:v015B*
+ ID_VENDOR_FROM_DATABASE=Biomedical Research Ltd.

View File

@ -0,0 +1,23 @@
From 29d5bac956e12719ef61e7e6da71333eac735ae1 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Wed, 18 Jun 2014 20:34:52 +0200
Subject: [PATCH] socket: check return from exec_spawn
(cherry picked from commit cee288adf88844acd880e4c0da5ed550c85cdd1a)
---
src/core/socket.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/core/socket.c b/src/core/socket.c
index 94eb2e7a..c58a7f03 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1343,6 +1343,8 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) {
NULL,
s->exec_runtime,
&pid);
+ if (r < 0)
+ goto fail;
r = unit_watch_pid(UNIT(s), pid);
if (r < 0)

23
0034-man-fix-typo.patch Normal file
View File

@ -0,0 +1,23 @@
From 5f1d6b4795638e25695fd5ae46dd6055990a871d Mon Sep 17 00:00:00 2001
From: Ronny Chevalier <chevalier.ronny@gmail.com>
Date: Thu, 19 Jun 2014 10:43:03 +0200
Subject: [PATCH] man: fix typo
(cherry picked from commit 08d555f347f154d08520a117b9769975cf302e38)
---
man/systemd.special.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/systemd.special.xml b/man/systemd.special.xml
index f29cc23c..2ff64c9c 100644
--- a/man/systemd.special.xml
+++ b/man/systemd.special.xml
@@ -1137,7 +1137,7 @@
<varlistentry>
<term><filename>machine.slice</filename></term>
<listitem>
- <para>By defalt, all virtual
+ <para>By default, all virtual
machines and containers
registered with
<command>systemd-machined</command>

View File

@ -0,0 +1,23 @@
From 70a3698b99b401e5fa26889aac73e72f6c45523b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 19 Jun 2014 19:53:16 +0200
Subject: [PATCH] units: add missing caps so that GetAddresses() can work
(cherry picked from commit a55954297dade7b432fd3a4f328f23261621ff79)
---
units/systemd-machined.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/units/systemd-machined.service.in b/units/systemd-machined.service.in
index 3ae0847b..5a890b5b 100644
--- a/units/systemd-machined.service.in
+++ b/units/systemd-machined.service.in
@@ -15,7 +15,7 @@ After=machine.slice
[Service]
ExecStart=@rootlibexecdir@/systemd-machined
BusName=org.freedesktop.machine1
-CapabilityBoundingSet=CAP_KILL
+CapabilityBoundingSet=CAP_KILL CAP_SYS_PTRACE CAP_SYS_ADMIN CAP_SETGID
WatchdogSec=1min
PrivateTmp=yes
PrivateDevices=yes

View File

@ -0,0 +1,30 @@
From 4564424c0a42f52ca02ef2e50ce4e19da36a7ad4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org>
Date: Sat, 23 Mar 2013 03:54:16 +0100
Subject: [PATCH] units/systemd-sysctl.service.in: run after load-modules
Modules might or will register new sysctl options.
[zj: This mechanism of adding modules just to reliably set sysctl
attributes is not ideal. Nevertheless, sysctl for dynamically created
attributes is simply broken, and this is the easiest workaround.]
https://bugzilla.redhat.com/show_bug.cgi?id=1022977
https://bugzilla.novell.com/show_bug.cgi?id=725412
(cherry picked from commit 0b73eab7a2185ae0377650e3fdb8208347a8a575)
---
units/systemd-sysctl.service.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/units/systemd-sysctl.service.in b/units/systemd-sysctl.service.in
index 5baf22c1..b8e81758 100644
--- a/units/systemd-sysctl.service.in
+++ b/units/systemd-sysctl.service.in
@@ -11,6 +11,7 @@ Documentation=man:systemd-sysctl.service(8) man:sysctl.d(5)
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
+After=systemd-modules-load.service
Before=sysinit.target shutdown.target
ConditionPathIsReadWrite=/proc/sys/
ConditionDirectoryNotEmpty=|/lib/sysctl.d

View File

@ -0,0 +1,128 @@
From 59fccb9cb4eba406dbee93864638cc52f6ee7d4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 19 Jun 2014 20:43:56 -0400
Subject: [PATCH] man: document statically loading modules for sysctl settings
https://bugzilla.redhat.com/show_bug.cgi?id=1022977
https://bugzilla.novell.com/show_bug.cgi?id=725412
(cherry picked from commit 7284335adbb8cb2bc9c11f9e102906da1bf71145)
---
man/sysctl.d.xml | 79 +++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 56 insertions(+), 23 deletions(-)
diff --git a/man/sysctl.d.xml b/man/sysctl.d.xml
index db53b495..78c4e80b 100644
--- a/man/sysctl.d.xml
+++ b/man/sysctl.d.xml
@@ -71,24 +71,6 @@
is <literal>#</literal> or <literal>;</literal> are
ignored.</para>
- <para>Note that either <literal>/</literal> or
- <literal>.</literal> may be used as separators within
- sysctl variable names. If the first separator is a
- slash, remaining slashes and dots are left intact. If
- the first separator is a dot, dots and slashes are
- interchanged. <literal>kernel.domainname=foo</literal>
- and <literal>kernel/domainname=foo</literal> are
- equivalent and will cause <literal>foo</literal> to
- be written to
- <filename>/proc/sys/kernel/domainname</filename>.
- Either
- <literal>net.ipv4.conf.enp3s0/200.forwarding</literal>
- or
- <literal>net/ipv4/conf/enp3s0.200/forwarding</literal>
- may be used to refer to
- <filename>/proc/sys/net/ipv4/conf/enp3s0.200/forwarding</filename>.
- </para>
-
<para>Each configuration file shall be named in the
style of <filename><replaceable>program</replaceable>.conf</filename>.
Files in <filename>/etc/</filename> override files
@@ -110,6 +92,24 @@
number and a dash, to simplify the ordering of the
files.</para>
+ <para>Note that either <literal>/</literal> or
+ <literal>.</literal> may be used as separators within
+ sysctl variable names. If the first separator is a
+ slash, remaining slashes and dots are left intact. If
+ the first separator is a dot, dots and slashes are
+ interchanged. <literal>kernel.domainname=foo</literal>
+ and <literal>kernel/domainname=foo</literal> are
+ equivalent and will cause <literal>foo</literal> to
+ be written to
+ <filename>/proc/sys/kernel/domainname</filename>.
+ Either
+ <literal>net.ipv4.conf.enp3s0/200.forwarding</literal>
+ or
+ <literal>net/ipv4/conf/enp3s0.200/forwarding</literal>
+ may be used to refer to
+ <filename>/proc/sys/net/ipv4/conf/enp3s0.200/forwarding</filename>.
+ </para>
+
<para>If the administrator wants to disable a
configuration file supplied by the vendor, the
recommended way is to place a symlink to
@@ -125,16 +125,48 @@
specifically,
<filename>net.ipv4.conf.*</filename>,
<filename>net.ipv6.conf.*</filename>,
- <filename>net.ipv4.neigh.*</filename> and <filename>net.ipv6.neigh.*</filename>)</para>
+ <filename>net.ipv4.neigh.*</filename> and <filename>net.ipv6.neigh.*</filename>).</para>
+
+ <para>Many sysctl parameters only become available
+ when certain kernel modules are loaded. Modules are
+ usually loaded on demand, e.g. when certain hardware
+ is plugged in or network brought up. This means that
+ <citerefentry><refentrytitle>systemd-sysctl.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> which runs
+ during early boot will not configure such parameters
+ if they become available after it has run. To
+ set such parameters, it is recommended to add
+ an <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry> rule to set those parameters when they become
+ available. Alternatively, a slightly simpler and
+ less efficient option is to add the module to
+ <citerefentry><refentrytitle>modules-load.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>, causing it to be loaded statically
+ before sysctl settings are applied (see
+ example below).</para>
</refsect1>
<refsect1>
- <title>Example</title>
+ <title>Examples</title>
+ <example>
+ <title>Set kernel YP domain name</title>
+ <para><filename>/etc/sysctl.d/domain-name.conf</filename>:
+ </para>
+
+ <programlisting>kernel.domainname=example.com</programlisting>
+ </example>
+
<example>
- <title>/etc/sysctl.d/domain-name.conf example:</title>
+ <title>Disable packet filter on the bridge</title>
+ <para><filename>/etc/modules-load.d/bridge.conf</filename>:
+ </para>
+
+ <programlisting>bridge</programlisting>
+
+ <para><filename>/etc/sysctl.d/bridge.conf</filename>:
+ </para>
- <programlisting># Set kernel YP domain name
-kernel.domainname=example.com</programlisting>
+ <programlisting>net.bridge.bridge-nf-call-ip6tables = 0
+net.bridge.bridge-nf-call-iptables = 0
+net.bridge.bridge-nf-call-arptables = 0
+</programlisting>
</example>
</refsect1>
@@ -146,6 +178,7 @@ kernel.domainname=example.com</programlisting>
<citerefentry><refentrytitle>systemd-delta</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sysctl.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>modprobe</refentrytitle><manvolnum>8</manvolnum></citerefentry>
</para>
</refsect1>

View File

@ -0,0 +1,40 @@
From c79a00436c90b86833799d83b5de64a1f42d1975 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 19 Jun 2014 21:13:56 -0400
Subject: [PATCH] man: also describe an udev rule for bridge sysctl
(cherry picked from commit 71418295125c542d3edd1e7251bb0701ef1af89b)
---
man/sysctl.d.xml | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/man/sysctl.d.xml b/man/sysctl.d.xml
index 78c4e80b..ed9e997f 100644
--- a/man/sysctl.d.xml
+++ b/man/sysctl.d.xml
@@ -154,7 +154,24 @@
</example>
<example>
- <title>Disable packet filter on the bridge</title>
+ <title>Disable packet filter on the bridge (method one)</title>
+ <para><filename>/etc/udev/rules.d/99-bridge.conf</filename>:
+ </para>
+
+ <programlisting>ACTION=="add", SUBSYSTEM=="module", KERNEL=="bridge", RUN+="/usr/lib/systemd/systemd-sysctl --prefix=/proc/sys/net/bridge"
+</programlisting>
+
+ <para><filename>/etc/sysctl.d/bridge.conf</filename>:
+ </para>
+
+ <programlisting>net.bridge.bridge-nf-call-ip6tables = 0
+net.bridge.bridge-nf-call-iptables = 0
+net.bridge.bridge-nf-call-arptables = 0
+</programlisting>
+ </example>
+
+ <example>
+ <title>Disable packet filter on the bridge (method two)</title>
<para><filename>/etc/modules-load.d/bridge.conf</filename>:
</para>

View File

@ -0,0 +1,38 @@
From d7671242e5a5c43b4dd2ac7484816179a679c673 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 19 Jun 2014 22:02:55 -0400
Subject: [PATCH] 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>.
(cherry picked from commit a2ae516a25dafe41e0cd296ab7b5d022fa62b95f)
---
src/getty-generator/getty-generator.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c
index 6a4aa2c1..700e90a3 100644
--- a/src/getty-generator/getty-generator.c
+++ b/src/getty-generator/getty-generator.c
@@ -72,7 +72,7 @@ static int add_serial_getty(const char *tty) {
log_debug("Automatically adding serial getty for /dev/%s.", tty);
- n = unit_name_replace_instance("serial-getty@.service", tty);
+ n = unit_name_from_path_instance("serial-getty", tty, ".service");
if (!n)
return log_oom();
@@ -86,7 +86,7 @@ static int add_container_getty(const char *tty) {
log_debug("Automatically adding container getty for /dev/pts/%s.", tty);
- n = unit_name_replace_instance("container-getty@.service", tty);
+ n = unit_name_from_path_instance("container-getty", tty, ".service");
if (!n)
return log_oom();

View File

@ -0,0 +1,114 @@
From a1a4a0201bbc6a89af7b0ec28b2b563a9418d860 Mon Sep 17 00:00:00 2001
From: Michael Marineau <michael.marineau@coreos.com>
Date: Thu, 19 Jun 2014 19:07:02 -0700
Subject: [PATCH] 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.
(cherry picked from commit 7d8da2c9641c584ff977493eeb8148300dce8759)
---
src/shared/conf-files.c | 2 +-
src/shared/path-lookup.c | 6 +++---
src/shared/path-util.c | 6 +++---
src/shared/path-util.h | 4 ++--
src/shared/util.c | 2 +-
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c
index 59bc8cee..44e137e8 100644
--- a/src/shared/conf-files.c
+++ b/src/shared/conf-files.c
@@ -110,7 +110,7 @@ static int conf_files_list_strv_internal(char ***strv, const char *suffix, const
assert(suffix);
/* This alters the dirs string array */
- if (!path_strv_canonicalize_absolute_uniq(dirs, root))
+ if (!path_strv_resolve_uniq(dirs, root))
return -ENOMEM;
fh = hashmap_new(string_hash_func, string_compare_func);
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index e072fd60..e0aaf443 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -284,7 +284,7 @@ int lookup_paths_init(
}
}
- if (!path_strv_canonicalize_absolute_uniq(p->unit_path, root_dir))
+ if (!path_strv_resolve_uniq(p->unit_path, root_dir))
return -ENOMEM;
if (!strv_isempty(p->unit_path)) {
@@ -338,10 +338,10 @@ int lookup_paths_init(
return -ENOMEM;
}
- if (!path_strv_canonicalize_absolute_uniq(p->sysvinit_path, root_dir))
+ if (!path_strv_resolve_uniq(p->sysvinit_path, root_dir))
return -ENOMEM;
- if (!path_strv_canonicalize_absolute_uniq(p->sysvrcnd_path, root_dir))
+ if (!path_strv_resolve_uniq(p->sysvrcnd_path, root_dir))
return -ENOMEM;
if (!strv_isempty(p->sysvinit_path)) {
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index 5863429c..c32ca94f 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -238,7 +238,7 @@ char **path_strv_make_absolute_cwd(char **l) {
return l;
}
-char **path_strv_canonicalize_absolute(char **l, const char *prefix) {
+char **path_strv_resolve(char **l, const char *prefix) {
char **s;
unsigned k = 0;
bool enomem = false;
@@ -323,12 +323,12 @@ char **path_strv_canonicalize_absolute(char **l, const char *prefix) {
return l;
}
-char **path_strv_canonicalize_absolute_uniq(char **l, const char *prefix) {
+char **path_strv_resolve_uniq(char **l, const char *prefix) {
if (strv_isempty(l))
return l;
- if (!path_strv_canonicalize_absolute(l, prefix))
+ if (!path_strv_resolve(l, prefix))
return NULL;
return strv_uniq(l);
diff --git a/src/shared/path-util.h b/src/shared/path-util.h
index 6882d786..976d2b26 100644
--- a/src/shared/path-util.h
+++ b/src/shared/path-util.h
@@ -47,8 +47,8 @@ char* path_startswith(const char *path, const char *prefix) _pure_;
bool path_equal(const char *a, const char *b) _pure_;
char** path_strv_make_absolute_cwd(char **l);
-char** path_strv_canonicalize_absolute(char **l, const char *prefix);
-char** path_strv_canonicalize_absolute_uniq(char **l, const char *prefix);
+char** path_strv_resolve(char **l, const char *prefix);
+char** path_strv_resolve_uniq(char **l, const char *prefix);
int path_is_mount_point(const char *path, bool allow_symlink);
int path_is_read_only_fs(const char *path);
diff --git a/src/shared/util.c b/src/shared/util.c
index 9be80887..02cfd499 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5675,7 +5675,7 @@ static int search_and_fopen_internal(const char *path, const char *mode, const c
assert(mode);
assert(_f);
- if (!path_strv_canonicalize_absolute_uniq(search, root))
+ if (!path_strv_resolve_uniq(search, root))
return -ENOMEM;
STRV_FOREACH(i, search) {

View File

@ -0,0 +1,87 @@
From 3db5dbae9f8315684f2e18b3eddcbf2004f3ad03 Mon Sep 17 00:00:00 2001
From: Michael Marineau <michael.marineau@coreos.com>
Date: Thu, 19 Jun 2014 19:07:04 -0700
Subject: [PATCH] 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.
(cherry picked from commit cba2ef02722114da2b730d57f1e3bb43013d8921)
Conflicts:
src/shared/install.c
---
src/shared/conf-files.c | 16 ++++++----------
src/shared/install.c | 6 +++---
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c
index 44e137e8..64ce8a0e 100644
--- a/src/shared/conf-files.c
+++ b/src/shared/conf-files.c
@@ -37,20 +37,16 @@
#include "hashmap.h"
#include "conf-files.h"
-static int files_add(Hashmap *h, const char *dirpath, const char *suffix, const char *root) {
+static int files_add(Hashmap *h, const char *root, const char *path, const char *suffix) {
_cleanup_closedir_ DIR *dir = NULL;
+ char *dirpath;
- assert(dirpath);
+ assert(path);
assert(suffix);
- if (isempty(root))
- dir = opendir(dirpath);
- else {
- const char *p;
+ dirpath = strappenda(root ? root : "", path);
- p = strappenda3(root, "/", dirpath);
- dir = opendir(p);
- }
+ dir = opendir(dirpath);
if (!dir) {
if (errno == ENOENT)
return 0;
@@ -118,7 +114,7 @@ static int conf_files_list_strv_internal(char ***strv, const char *suffix, const
return -ENOMEM;
STRV_FOREACH(p, dirs) {
- r = files_add(fh, *p, suffix, root);
+ r = files_add(fh, root, *p, suffix);
if (r == -ENOMEM) {
hashmap_free_free(fh);
return r;
diff --git a/src/shared/install.c b/src/shared/install.c
index 8322970a..c6d13eca 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1753,7 +1753,7 @@ UnitFileState unit_file_get_state(
int unit_file_query_preset(UnitFileScope scope, const char *name) {
_cleanup_strv_free_ char **files = NULL;
- char **i;
+ char **p;
int r;
assert(scope >= 0);
@@ -1781,10 +1781,10 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) {
if (r < 0)
return r;
- STRV_FOREACH(i, files) {
+ STRV_FOREACH(p, files) {
_cleanup_fclose_ FILE *f;
- f = fopen(*i, "re");
+ f = fopen(*p, "re");
if (!f) {
if (errno == ENOENT)
continue;

View File

@ -0,0 +1,29 @@
From 695c8554ca6a64f749de265ba29566d3c95fe77c Mon Sep 17 00:00:00 2001
From: Michael Marineau <michael.marineau@coreos.com>
Date: Thu, 19 Jun 2014 19:07:06 -0700
Subject: [PATCH] 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.
(cherry picked from commit 375eadd911a9f83f89f1e7de5e05f44cc81e3642)
---
src/shared/util.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/shared/util.c b/src/shared/util.c
index 02cfd499..6165d72d 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5682,7 +5682,10 @@ static int search_and_fopen_internal(const char *path, const char *mode, const c
_cleanup_free_ char *p = NULL;
FILE *f;
- p = strjoin(*i, "/", path, NULL);
+ if (root)
+ p = strjoin(root, *i, "/", path, NULL);
+ else
+ p = strjoin(*i, "/", path, NULL);
if (!p)
return -ENOMEM;

View File

@ -0,0 +1,24 @@
From 82d568e88c858b5094b92440515eba3744fe07d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 20 Jun 2014 18:44:39 -0400
Subject: [PATCH] util: do not strip /dev prefix twice
(cherry picked from commit 0d460faf732ff3c9483dbfa5db6905d53c2e2522)
---
src/shared/util.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/shared/util.c b/src/shared/util.c
index 6165d72d..8b0e29dd 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -3619,9 +3619,6 @@ char *fstab_node_to_udev_node(const char *p) {
bool tty_is_vc(const char *tty) {
assert(tty);
- if (startswith(tty, "/dev/"))
- tty += 5;
-
return vtnr_from_tty(tty) >= 0;
}

View File

@ -0,0 +1,251 @@
From 2e7e0201564db608dffc1d9ac24c0691ea14fd2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 20 Jun 2014 19:45:45 -0400
Subject: [PATCH] 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
(cherry picked from commit 81577dc22887debaf9b19bf1034a2887fb9069c7)
Conflicts:
src/network/networkd-vxlan.c
---
configure.ac | 29 +++++++--
src/network/networkd-tunnel.c | 1 +
src/shared/missing.h | 145 ++++++++++++++++++++++++++++++------------
3 files changed, 130 insertions(+), 45 deletions(-)
diff --git a/configure.ac b/configure.ac
index faf7f722..b755f489 100644
--- a/configure.ac
+++ b/configure.ac
@@ -266,12 +266,33 @@ LIBS="$save_LIBS"
AC_CHECK_FUNCS([fanotify_init fanotify_mark])
AC_CHECK_FUNCS([__secure_getenv secure_getenv])
-AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, setns, LO_FLAGS_PARTSCAN], [], [], [[#include <sys/types.h>
+AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, setns, LO_FLAGS_PARTSCAN],
+ [], [], [[
+#include <sys/types.h>
#include <unistd.h>
#include <sys/mount.h>
#include <fcntl.h>
#include <sched.h>
-#include <linux/loop.h>]])
+#include <linux/loop.h>
+]])
+
+AC_CHECK_DECLS([IFLA_PHYS_PORT_ID,
+ IFLA_BOND_AD_INFO,
+ IFLA_VLAN_PROTOCOL,
+ IFLA_VXLAN_LOCAL6,
+ IFLA_IPTUN_6RD_RELAY_PREFIXLEN,
+ IFLA_BRIDGE_VLAN_INFO],
+[], [], [[
+#include <inttypes.h>
+#include <netinet/in.h>
+#include <netinet/ether.h>
+#include <linux/rtnetlink.h>
+#include <net/if.h>
+#include <linux/ip.h>
+#include <linux/if_tunnel.h>
+#include <linux/if_link.h>
+#include <linux/if_bridge.h>
+]])
# This makes sure pkg.m4 is available.
m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
@@ -870,10 +891,10 @@ AC_SUBST(DNS_SERVERS)
# ------------------------------------------------------------------------------
have_networkd=no
AC_ARG_ENABLE(networkd, AS_HELP_STRING([--disable-networkd], [disable networkd]))
-if test "x$enable_networkd" != "xno"; then
+AS_IF([test "x$enable_networkd" != "xno"], [
AC_DEFINE(ENABLE_NETWORKD, 1, [Define if networkd support is to be enabled])
have_networkd=yes
-fi
+])
AM_CONDITIONAL(ENABLE_NETWORKD, [test "x$have_networkd" = "xyes"])
# ------------------------------------------------------------------------------
diff --git a/src/network/networkd-tunnel.c b/src/network/networkd-tunnel.c
index 60b16ba8..604d9240 100644
--- a/src/network/networkd-tunnel.c
+++ b/src/network/networkd-tunnel.c
@@ -29,6 +29,7 @@
#include "networkd.h"
#include "network-internal.h"
#include "util.h"
+#include "missing.h"
static int netdev_fill_ipip_rtnl_message(Link *link, sd_rtnl_message *m) {
diff --git a/src/shared/missing.h b/src/shared/missing.h
index 716d3b8f..f129f0b2 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -92,19 +92,6 @@
#define IP_TRANSPARENT 19
#endif
-#ifndef IFLA_CARRIER
- #define IFLA_CARRIER 33
- #ifndef IFLA_NUM_RX_QUEUES
- #define IFLA_NUM_RX_QUEUES 32
- #ifndef IFLA_NUM_TX_QUEUES
- #define IFLA_NUM_TX_QUEUES 31
- #ifndef IFLA_PROMISCUITY
- #define IFLA_PROMISCUITY 30
- #endif
- #endif
- #endif
-#endif
-
#ifndef SOL_NETLINK
#define SOL_NETLINK 270
#endif
@@ -384,34 +371,110 @@ static inline int setns(int fd, int nstype) {
#define LOOP_CTL_GET_FREE 0x4C82
#endif
-#ifndef IFLA_BOND_MAX
-enum {
- IFLA_BOND_UNSPEC,
- IFLA_BOND_MODE,
- IFLA_BOND_ACTIVE_SLAVE,
- IFLA_BOND_MIIMON,
- IFLA_BOND_UPDELAY,
- IFLA_BOND_DOWNDELAY,
- IFLA_BOND_USE_CARRIER,
- IFLA_BOND_ARP_INTERVAL,
- IFLA_BOND_ARP_IP_TARGET,
- IFLA_BOND_ARP_VALIDATE,
- IFLA_BOND_ARP_ALL_TARGETS,
- IFLA_BOND_PRIMARY,
- IFLA_BOND_PRIMARY_RESELECT,
- IFLA_BOND_FAIL_OVER_MAC,
- IFLA_BOND_XMIT_HASH_POLICY,
- IFLA_BOND_RESEND_IGMP,
- IFLA_BOND_NUM_PEER_NOTIF,
- IFLA_BOND_ALL_SLAVES_ACTIVE,
- IFLA_BOND_MIN_LINKS,
- IFLA_BOND_LP_INTERVAL,
- IFLA_BOND_PACKETS_PER_SLAVE,
- IFLA_BOND_AD_LACP_RATE,
- IFLA_BOND_AD_SELECT,
- IFLA_BOND_AD_INFO,
- __IFLA_BOND_MAX,
-};
+#if !HAVE_DECL_IFLA_PHYS_PORT_ID
+#undef IFLA_PROMISCUITY
+#define IFLA_PROMISCUITY 30
+#define IFLA_NUM_TX_QUEUES 31
+#define IFLA_NUM_RX_QUEUES 32
+#define IFLA_CARRIER 33
+#define IFLA_PHYS_PORT_ID 34
+#define __IFLA_MAX 35
+
+#define IFLA_MAX (__IFLA_MAX - 1)
+#endif
+
+#if !HAVE_DECL_IFLA_BOND_AD_INFO
+#define IFLA_BOND_UNSPEC 0
+#define IFLA_BOND_MODE 1
+#define IFLA_BOND_ACTIVE_SLAVE 2
+#define IFLA_BOND_MIIMON 3
+#define IFLA_BOND_UPDELAY 4
+#define IFLA_BOND_DOWNDELAY 5
+#define IFLA_BOND_USE_CARRIER 6
+#define IFLA_BOND_ARP_INTERVAL 7
+#define IFLA_BOND_ARP_IP_TARGET 8
+#define IFLA_BOND_ARP_VALIDATE 9
+#define IFLA_BOND_ARP_ALL_TARGETS 10
+#define IFLA_BOND_PRIMARY 11
+#define IFLA_BOND_PRIMARY_RESELECT 12
+#define IFLA_BOND_FAIL_OVER_MAC 13
+#define IFLA_BOND_XMIT_HASH_POLICY 14
+#define IFLA_BOND_RESEND_IGMP 15
+#define IFLA_BOND_NUM_PEER_NOTIF 16
+#define IFLA_BOND_ALL_SLAVES_ACTIVE 17
+#define IFLA_BOND_MIN_LINKS 18
+#define IFLA_BOND_LP_INTERVAL 19
+#define IFLA_BOND_PACKETS_PER_SLAVE 20
+#define IFLA_BOND_AD_LACP_RATE 21
+#define IFLA_BOND_AD_SELECT 22
+#define IFLA_BOND_AD_INFO 23
+#define __IFLA_BOND_MAX 24
#define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1)
#endif
+
+#if !HAVE_DECL_IFLA_VLAN_PROTOCOL
+#define IFLA_VLAN_UNSPEC 0
+#define IFLA_VLAN_ID 1
+#define IFLA_VLAN_FLAGS 2
+#define IFLA_VLAN_EGRESS_QOS 3
+#define IFLA_VLAN_INGRESS_QOS 4
+#define IFLA_VLAN_PROTOCOL 5
+#define __IFLA_VLAN_MAX 6
+
+#define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1)
+#endif
+
+#if !HAVE_DECL_IFLA_VXLAN_LOCAL6
+#define IFLA_VXLAN_UNSPEC 0
+#define IFLA_VXLAN_ID 1
+#define IFLA_VXLAN_GROUP 2
+#define IFLA_VXLAN_LINK 3
+#define IFLA_VXLAN_LOCAL 4
+#define IFLA_VXLAN_TTL 5
+#define IFLA_VXLAN_TOS 6
+#define IFLA_VXLAN_LEARNING 7
+#define IFLA_VXLAN_AGEING 8
+#define IFLA_VXLAN_LIMIT 9
+#define IFLA_VXLAN_PORT_RANGE 10
+#define IFLA_VXLAN_PROXY 11
+#define IFLA_VXLAN_RSC 12
+#define IFLA_VXLAN_L2MISS 13
+#define IFLA_VXLAN_L3MISS 14
+#define IFLA_VXLAN_PORT 15
+#define IFLA_VXLAN_GROUP6 16
+#define IFLA_VXLAN_LOCAL6 17
+#define __IFLA_VXLAN_MAX 18
+
+#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
+#endif
+
+#if !HAVE_DECL_IFLA_IPTUN_6RD_RELAY_PREFIXLEN
+#define IFLA_IPTUN_UNSPEC 0
+#define IFLA_IPTUN_LINK 1
+#define IFLA_IPTUN_LOCAL 2
+#define IFLA_IPTUN_REMOTE 3
+#define IFLA_IPTUN_TTL 4
+#define IFLA_IPTUN_TOS 5
+#define IFLA_IPTUN_ENCAP_LIMIT 6
+#define IFLA_IPTUN_FLOWINFO 7
+#define IFLA_IPTUN_FLAGS 8
+#define IFLA_IPTUN_PROTO 9
+#define IFLA_IPTUN_PMTUDISC 10
+#define IFLA_IPTUN_6RD_PREFIX 11
+#define IFLA_IPTUN_6RD_RELAY_PREFIX 12
+#define IFLA_IPTUN_6RD_PREFIXLEN 13
+#define IFLA_IPTUN_6RD_RELAY_PREFIXLEN 14
+#define __IFLA_IPTUN_MAX 15
+
+#define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1)
+#endif
+
+#if !HAVE_DECL_IFLA_BRIDGE_VLAN_INFO
+#define IFLA_BRIDGE_FLAGS 0
+#define IFLA_BRIDGE_MODE 1
+#define IFLA_BRIDGE_VLAN_INFO 2
+#define __IFLA_BRIDGE_MAX 3
+
+#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
+#endif

View File

@ -0,0 +1,23 @@
From 7da3a022eb72c80d2ec85b01fec188f80581ba27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 20 Jun 2014 22:43:49 -0400
Subject: [PATCH] util: treat fuse.sshfs as a network filesystem
https://bugs.freedesktop.org/show_bug.cgi?id=73727
(cherry picked from commit da92ca5eb506d513033e0c7a85daf25a7e1c9d0e)
---
src/shared/util.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/shared/util.c b/src/shared/util.c
index 8b0e29dd..5b9d1d11 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -1514,6 +1514,7 @@ bool fstype_is_network(const char *fstype) {
static const char table[] =
"cifs\0"
"smbfs\0"
+ "sshfs\0"
"ncpfs\0"
"ncp\0"
"nfs\0"

View File

@ -0,0 +1,27 @@
From d8d15d1a6ea80362de970c6a73ee9dbc7e26176c Mon Sep 17 00:00:00 2001
From: Ronny Chevalier <chevalier.ronny@gmail.com>
Date: Sat, 21 Jun 2014 22:07:09 +0200
Subject: [PATCH] build-sys: add -pthread flag for libsystemd-shared
src/shared/async.c uses pthread so it will fail at link time if we link
only to libsystemd-shared and use async
(cherry picked from commit 8e75477abdd838d3beddc5fd1c6a7707b22748b6)
---
Makefile.am | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 75d62f06..71fc9113 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -823,7 +823,8 @@ nodist_libsystemd_shared_la_SOURCES = \
libsystemd_shared_la_CFLAGS = \
$(AM_CFLAGS) \
- $(SECCOMP_CFLAGS)
+ $(SECCOMP_CFLAGS) \
+ -pthread
# ------------------------------------------------------------------------------
noinst_LTLIBRARIES += \

View File

@ -16,7 +16,7 @@
Name: systemd Name: systemd
Url: http://www.freedesktop.org/wiki/Software/systemd Url: http://www.freedesktop.org/wiki/Software/systemd
Version: 214 Version: 214
Release: 1%{?gitcommit:.git%{gitcommit}}%{?dist} Release: 2%{?gitcommit:.git%{gitcommit}}%{?dist}
# For a breakdown of the licensing, see README # For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+ License: LGPLv2+ and MIT and GPLv2+
Summary: A System and Service Manager Summary: A System and Service Manager
@ -36,9 +36,56 @@ Source4: listen.conf
# Prevent accidental removal of the systemd package # Prevent accidental removal of the systemd package
Source6: yum-protect-systemd.conf Source6: yum-protect-systemd.conf
# Patch series is available from http://cgit.freedesktop.org/systemd/systemd-stable/log/?h=v211-stable # Patch series is available from http://cgit.freedesktop.org/systemd/systemd-stable/log/?h=v214-stable
# GIT_DIR=~/src/systemd/.git git format-patch-ab -M -N --no-signature v211..v211-stable # GIT_DIR=~/src/systemd/.git git format-patch-ab -M -N --no-signature v214..v214-stable
# i=1; for p in 0*patch;do printf "Patch%03d: %s\n" $i $p; ((i++));done # i=1; for p in 0*patch;do printf "Patch%03d: %s\n" $i $p; ((i++));done
Patch001: 0001-NEWS-add-missing-comment-about-the-floppy-group.patch
Patch002: 0002-NEWS-fix-directory-name.patch
Patch003: 0003-udev-assign-group-input-to-all-input-devices.patch
Patch004: 0004-cryptsetup-check-that-password-is-not-null.patch
Patch005: 0005-core-fix-invalid-free-in-killall.patch
Patch006: 0006-udev-fix-invalid-free-in-enable_name_policy.patch
Patch007: 0007-install-fix-invalid-free-in-unit_file_mask.patch
Patch008: 0008-rpm-don-t-hardcode-the-binary-paths-in-the-macros-re.patch
Patch009: 0009-Fix-spelling-mistake-scirpt-script.patch
Patch010: 0010-tmpfiles-set-up-selinux-label-proeprly-when-creating.patch
Patch011: 0011-Reset-signal-mask-on-re-exec-to-init.patch
Patch012: 0012-core-clean-up-signal-reset-logic-when-reexec.patch
Patch013: 0013-journal-remote-fix-memleak.patch
Patch014: 0014-unit-name-fix-detection-of-unit-templates-instances.patch
Patch015: 0015-install-various-modernizations.patch
Patch016: 0016-install-simplify-and-clarify-disabling-logic-for-ins.patch
Patch017: 0017-install-various-modernizations.patch
Patch018: 0018-install-use-symlink_atomic-instead-of-unlink-symlink.patch
Patch019: 0019-install-when-looking-for-a-unit-file-for-enabling-se.patch
Patch020: 0020-install-make-sure-systemctl-disable-foobar-.service-.patch
Patch021: 0021-install-make-sure-that-root-mode-doesn-t-make-us-con.patch
Patch022: 0022-log-don-t-downgrade-log-level-in-non-PID-1-if-quiet-.patch
Patch023: 0023-install-simplify-symlink-root-logic.patch
Patch024: 0024-conf-files-fix-when-for-root-logic.patch
Patch025: 0025-networkd-don-t-pull-in-systemd-networkd-wait-online-.patch
Patch026: 0026-bootchart-set-white-background.patch
Patch027: 0027-build-sys-add-missing-backslash.patch
Patch028: 0028-namespace-properly-label-device-nodes-we-create.patch
Patch029: 0029-tmpfiles-create-directories-already-with-the-right-l.patch
Patch030: 0030-cryptsetup-introduce-new-cryptsetup-pre.traget-unit-.patch
Patch031: 0031-rules-add-loop-control-and-btrfs-control-to-disk-gro.patch
Patch032: 0032-hwdb-Update-database-of-Bluetooth-company-identifier.patch
Patch033: 0033-socket-check-return-from-exec_spawn.patch
Patch034: 0034-man-fix-typo.patch
Patch035: 0035-units-add-missing-caps-so-that-GetAddresses-can-work.patch
Patch036: 0036-units-systemd-sysctl.service.in-run-after-load-modul.patch
Patch037: 0037-man-document-statically-loading-modules-for-sysctl-s.patch
Patch038: 0038-man-also-describe-an-udev-rule-for-bridge-sysctl.patch
Patch039: 0039-getty-generator-properly-escape-instance-names.patch
Patch040: 0040-shared-rename-path_strv_canonicalize_absolute-functi.patch
Patch041: 0041-conf-files-include-root-in-returned-file-paths.patch
Patch042: 0042-shared-fix-search_and_fopen-with-alternate-roots.patch
Patch043: 0043-util-do-not-strip-dev-prefix-twice.patch
Patch044: 0044-missing.h-add-various-network-enums.patch
Patch045: 0045-util-treat-fuse.sshfs-as-a-network-filesystem.patch
Patch046: 0046-build-sys-add-pthread-flag-for-libsystemd-shared.patch
# kernel-install patch for grubby, drop if grubby is obsolete # kernel-install patch for grubby, drop if grubby is obsolete
Patch1000: kernel-install-grubby.patch Patch1000: kernel-install-grubby.patch
@ -729,6 +776,7 @@ getent passwd systemd-journal-gateway >/dev/null 2>&1 || useradd -r -l -u 191 -g
%changelog %changelog
* Sun Jun 22 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 214-2 * Sun Jun 22 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 214-2
- Do not restart systemd-logind on upgrades (#1110697) - Do not restart systemd-logind on upgrades (#1110697)
- Add some patches (#1081429, #1054549, #1108568, #928962)
* Wed Jun 11 2014 Lennart Poettering <lpoetter@redhat.com> - 214-1 * Wed Jun 11 2014 Lennart Poettering <lpoetter@redhat.com> - 214-1
- New upstream release - New upstream release