diff options
Diffstat (limited to 'meta-phosphor/recipes-core/systemd/systemd')
5 files changed, 271 insertions, 0 deletions
diff --git a/meta-phosphor/recipes-core/systemd/systemd/0001-sd-bus-Don-t-automatically-add-ObjectManager.patch b/meta-phosphor/recipes-core/systemd/systemd/0001-sd-bus-Don-t-automatically-add-ObjectManager.patch new file mode 100644 index 0000000000..f8f5b08a96 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/systemd/0001-sd-bus-Don-t-automatically-add-ObjectManager.patch @@ -0,0 +1,56 @@ +From 44562e33655668033a8ee0a7a686671226da2110 Mon Sep 17 00:00:00 2001 +From: Brad Bishop <bradleyb@fuzziesquirrel.com> +Date: Tue, 13 Mar 2018 15:34:30 -0400 +Subject: [PATCH] sd-bus: Don't automatically add ObjectManager + +Even though sdbus helps manage org.freedesktop.DBus.ObjectManager +it must still be explicitly enabled by a library client. + +As such do not automatically add ObjectManager to GetManagedObjects +method call responses or InterfacesAdded/Removed signals. Bus +service client applications can potentially react to the appearance +of ObjectManager in these messages and follow up with a method call +on the interface, which isn't actually implemented on the objects +within the subtree, below the manager. +--- + src/libsystemd/sd-bus/bus-objects.c | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c +index 6e00255b2..59f698402 100644 +--- a/src/libsystemd/sd-bus/bus-objects.c ++++ b/src/libsystemd/sd-bus/bus-objects.c +@@ -1076,10 +1076,6 @@ static int object_manager_serialize_path( + if (r < 0) + return r; + +- r = sd_bus_message_append(reply, "{sa{sv}}", "org.freedesktop.DBus.ObjectManager", 0); +- if (r < 0) +- return r; +- + found_something = true; + } + +@@ -2302,9 +2298,6 @@ static int object_added_append_all(sd_bus *bus, sd_bus_message *m, const char *p + if (r < 0) + return r; + r = sd_bus_message_append(m, "{sa{sv}}", "org.freedesktop.DBus.Properties", 0); +- if (r < 0) +- return r; +- r = sd_bus_message_append(m, "{sa{sv}}", "org.freedesktop.DBus.ObjectManager", 0); + if (r < 0) + return r; + +@@ -2473,9 +2466,6 @@ static int object_removed_append_all(sd_bus *bus, sd_bus_message *m, const char + if (r < 0) + return r; + r = sd_bus_message_append(m, "s", "org.freedesktop.DBus.Properties"); +- if (r < 0) +- return r; +- r = sd_bus_message_append(m, "s", "org.freedesktop.DBus.ObjectManager"); + if (r < 0) + return r; + +-- +2.14.3 + diff --git a/meta-phosphor/recipes-core/systemd/systemd/0003-basic-Factor-out-string-checking-from-name_to_prefix.patch b/meta-phosphor/recipes-core/systemd/systemd/0003-basic-Factor-out-string-checking-from-name_to_prefix.patch new file mode 100644 index 0000000000..cd4dcad164 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/systemd/0003-basic-Factor-out-string-checking-from-name_to_prefix.patch @@ -0,0 +1,103 @@ +From 899173e241f781ad4dfb6b40e7c5f35104164435 Mon Sep 17 00:00:00 2001 +From: Brad Bishop <bradleyb@fuzziesquirrel.com> +Date: Thu, 12 Jan 2017 09:56:54 -0500 +Subject: [PATCH 1/2] basic: Factor out string checking from + name_to_prefix/instance + +Add two new functions: string_to_prefix/instance that enable +prefix/instance extraction from a name before the name is +mangled. + +Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> +--- + src/basic/unit-name.c | 48 +++++++++++++++++++++++++++++++----------------- + 1 file changed, 31 insertions(+), 17 deletions(-) + +diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c +index 0a6efa4..93c4838 100644 +--- a/src/basic/unit-name.c ++++ b/src/basic/unit-name.c +@@ -135,42 +135,46 @@ bool unit_suffix_is_valid(const char *s) { + return true; + } + +-int unit_name_to_prefix(const char *n, char **ret) { ++static int string_to_prefix(const char *s, char **ret) { + const char *p; +- char *s; ++ char *r; + +- assert(n); ++ assert(s); + assert(ret); + +- if (!unit_name_is_valid(n, UNIT_NAME_ANY)) +- return -EINVAL; +- +- p = strchr(n, '@'); ++ p = strchr(s, '@'); + if (!p) +- p = strrchr(n, '.'); ++ p = strrchr(s, '.'); + + assert_se(p); + +- s = strndup(n, p - n); +- if (!s) ++ r = strndup(s, p - s); ++ if (!r) + return -ENOMEM; + +- *ret = s; ++ *ret = r; + return 0; + } + +-int unit_name_to_instance(const char *n, char **instance) { +- const char *p, *d; +- char *i; +- ++int unit_name_to_prefix(const char *n, char **ret) { + assert(n); +- assert(instance); ++ assert(ret); + + if (!unit_name_is_valid(n, UNIT_NAME_ANY)) + return -EINVAL; + ++ return string_to_prefix(n, ret); ++} ++ ++static int string_to_instance(const char *s, char **instance) { ++ const char *p, *d; ++ char *i; ++ ++ assert(s); ++ assert(instance); ++ + /* Everything past the first @ and before the last . is the instance */ +- p = strchr(n, '@'); ++ p = strchr(s, '@'); + if (!p) { + *instance = NULL; + return 0; +@@ -190,6 +194,16 @@ int unit_name_to_instance(const char *n, char **instance) { + return 1; + } + ++int unit_name_to_instance(const char *n, char **instance) { ++ assert(n); ++ assert(instance); ++ ++ if (!unit_name_is_valid(n, UNIT_NAME_ANY)) ++ return -EINVAL; ++ ++ return string_to_instance(n, instance); ++} ++ + int unit_name_to_prefix_and_instance(const char *n, char **ret) { + const char *d; + char *s; +-- +1.8.3.1 + diff --git a/meta-phosphor/recipes-core/systemd/systemd/0004-basic-Use-path-escaping-when-mangling-path-instances.patch b/meta-phosphor/recipes-core/systemd/systemd/0004-basic-Use-path-escaping-when-mangling-path-instances.patch new file mode 100644 index 0000000000..fca28de59f --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/systemd/0004-basic-Use-path-escaping-when-mangling-path-instances.patch @@ -0,0 +1,69 @@ +From b7565b3f2d3b13c4ae5734407a2c3f27658c7b4b Mon Sep 17 00:00:00 2001 +From: Brad Bishop <bradleyb@fuzziesquirrel.com> +Date: Thu, 12 Jan 2017 08:52:42 -0500 +Subject: [PATCH 2/2] basic: Use path escaping when mangling path instances + +Allow path instances with dashes in them to be unescaped +properly. + +Fixes systemd/systemd#5072 + +Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> +--- + src/basic/unit-name.c | 18 ++++++++++++++++++ + src/test/test-unit-name.c | 3 +++ + 2 files changed, 21 insertions(+) + +diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c +index 93c4838..c91b0e7 100644 +--- a/src/basic/unit-name.c ++++ b/src/basic/unit-name.c +@@ -684,6 +684,8 @@ static char *do_escape_mangle(const char *f, UnitNameMangle allow_globs, char *t + * If @allow_globs, globs characters are preserved. Otherwise, they are escaped. + */ + int unit_name_mangle_with_suffix(const char *name, UnitNameMangle allow_globs, const char *suffix, char **ret) { ++ _cleanup_free_ char *instance = NULL; ++ _cleanup_free_ char *prefix = NULL; + char *s, *t; + int r; + +@@ -723,6 +725,22 @@ int unit_name_mangle_with_suffix(const char *name, UnitNameMangle allow_globs, c + return r; + } + ++ r = string_to_instance(name, &instance); ++ if(r < 0 && r != -EINVAL) ++ return r; ++ ++ if(instance && path_is_absolute(instance)) { ++ r = string_to_prefix(name, &prefix); ++ if(r < 0 && r != -EINVAL) ++ return r; ++ ++ r = unit_name_from_path_instance(prefix, instance, suffix, ret); ++ if (r >= 0) ++ return 1; ++ if (r != -EINVAL) ++ return r; ++ } ++ + s = new(char, strlen(name) * 4 + strlen(suffix) + 1); + if (!s) + return -ENOMEM; +diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c +index 2fd83f3..f2cb047 100644 +--- a/src/test/test-unit-name.c ++++ b/src/test/test-unit-name.c +@@ -192,6 +192,9 @@ static void test_unit_name_mangle(void) { + test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo", "foo.service", 1); + test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo*", "foo*", 0); + test_unit_name_mangle_one(UNIT_NAME_GLOB, "ΓΌ*", "\\xc3\\xbc*", 1); ++ test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo@/bar.service", "foo@bar.service", 1); ++ test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo@/bar/baz-boo.service", "foo@bar-baz\\x2dboo.service", 1); ++ test_unit_name_mangle_one(UNIT_NAME_GLOB, "foo@bar/baz-boo.service", "foo@bar-baz-boo.service", 1); + } + + static int test_unit_printf(void) { +-- +1.8.3.1 + diff --git a/meta-phosphor/recipes-core/systemd/systemd/0005-dont-return-error-if-unable-to-create-network-namespace.patch b/meta-phosphor/recipes-core/systemd/systemd/0005-dont-return-error-if-unable-to-create-network-namespace.patch new file mode 100644 index 0000000000..d83bf72ef4 --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/systemd/0005-dont-return-error-if-unable-to-create-network-namespace.patch @@ -0,0 +1,39 @@ +From 870b79559cd5841b3f680c914b4b2e770a9961cf Mon Sep 17 00:00:00 2001 +From: Ratan Gupta <ratagupt@in.ibm.com> +Date: Thu, 20 Jul 2017 11:59:14 +0530 +Subject: [PATCH] Don't return the error if unable to create the network + namespace + +On systems where kernel is not configured with namespace support +then don't return error during setting up network namespace. + +Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com> +--- + src/core/namespace.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/core/namespace.c b/src/core/namespace.c +index 1195e9a..f30dacf 100644 +--- a/src/core/namespace.c ++++ b/src/core/namespace.c +@@ -986,7 +986,7 @@ int setup_netns(int netns_storage_socket[2]) { + /* Nothing stored yet, so let's create a new namespace */ + + if (unshare(CLONE_NEWNET) < 0) { +- r = -errno; ++ r = 0; + goto fail; + } + +@@ -994,7 +994,7 @@ int setup_netns(int netns_storage_socket[2]) { + + netns = open("/proc/self/ns/net", O_RDONLY|O_CLOEXEC|O_NOCTTY); + if (netns < 0) { +- r = -errno; ++ r = 0; + goto fail; + } + +-- +1.9.1 + diff --git a/meta-phosphor/recipes-core/systemd/systemd/default.network b/meta-phosphor/recipes-core/systemd/systemd/default.network new file mode 100644 index 0000000000..c75c3d60de --- /dev/null +++ b/meta-phosphor/recipes-core/systemd/systemd/default.network @@ -0,0 +1,4 @@ +[Match] +Name=eth* +[Network] +DHCP=ipv4 |