.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=829
This commit is contained in:
parent
f83bb8b6f8
commit
ed778876a8
@ -0,0 +1,32 @@
|
||||
Based on 812bd1e6ab4c463507557f2bdbb8875fedd92ade Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Fri, 21 Nov 2014 01:20:57 +0100
|
||||
Subject: [PATCH] units: make sure rfkill service is bount to the actual
|
||||
hardware
|
||||
|
||||
---
|
||||
rules/99-systemd.rules.in | 2 +-
|
||||
units/systemd-rfkill@.service.in | 1 +
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- rules/99-systemd.rules.in
|
||||
+++ rules/99-systemd.rules.in
|
||||
@@ -62,7 +62,7 @@ SUBSYSTEM=="leds", KERNEL=="*kbd_backlight", TAG+="systemd", IMPORT{builtin}="pa
|
||||
|
||||
# Pull in rfkill save/restore for all rfkill devices
|
||||
|
||||
-SUBSYSTEM=="rfkill", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_WANTS}+="systemd-rfkill@$name.service"
|
||||
+SUBSYSTEM=="rfkill", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_ALIAS}+="/sys/subsystem/rfkill/devices/%k", ENV{SYSTEMD_WANTS}+="systemd-rfkill@$name.service"
|
||||
|
||||
# Asynchronously mount file systems implemented by these modules as
|
||||
# soon as they are loaded.
|
||||
--- units/systemd-rfkill@.service.in
|
||||
+++ units/systemd-rfkill@.service.in 2014-12-05 11:52:59.433518948 +0000
|
||||
@@ -9,6 +9,7 @@
|
||||
Description=Load/Save RF Kill Switch Status of %I
|
||||
Documentation=man:systemd-rfkill@.service(8)
|
||||
DefaultDependencies=no
|
||||
+BindsTo=sys-subsystem-rfkill-devices-%i.device
|
||||
RequiresMountsFor=/var/lib/systemd/rfkill
|
||||
Conflicts=shutdown.target
|
||||
After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-remount-fs.service
|
116
0002-rfkill-rework-how-we-generate-file-names-from-rfkill.patch
Normal file
116
0002-rfkill-rework-how-we-generate-file-names-from-rfkill.patch
Normal file
@ -0,0 +1,116 @@
|
||||
Based on 4844262f25a3ff6bd23de05a0a6f84a8e2983d74 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Wed, 3 Dec 2014 02:02:11 +0100
|
||||
Subject: [PATCH] rfkill: rework how we generate file names from rfkill
|
||||
devices
|
||||
|
||||
Generate the file name from ID_PATH plus the rfkill type (wlan,
|
||||
bluetooth, ...) and ignore the rfkill device name, since it apparently
|
||||
is not a stable identifier.
|
||||
|
||||
Also, ensure that devices disappearing don't result in broken services,
|
||||
simply exit cleanly.
|
||||
---
|
||||
src/rfkill/rfkill.c | 47 ++++++++++++++++++++++++-----------------------
|
||||
1 file changed, 24 insertions(+), 23 deletions(-)
|
||||
|
||||
--- src/rfkill/rfkill.c
|
||||
+++ src/rfkill/rfkill.c 2014-12-05 12:05:59.053518122 +0000
|
||||
@@ -28,8 +28,8 @@
|
||||
int main(int argc, char *argv[]) {
|
||||
_cleanup_udev_unref_ struct udev *udev = NULL;
|
||||
_cleanup_udev_device_unref_ struct udev_device *device = NULL;
|
||||
- _cleanup_free_ char *saved = NULL, *escaped_name = NULL, *escaped_path_id = NULL;
|
||||
- const char *name, *path_id;
|
||||
+ _cleanup_free_ char *saved = NULL, *escaped_type = NULL, *escaped_path_id = NULL;
|
||||
+ const char *name, *type, *path_id;
|
||||
int r;
|
||||
|
||||
if (argc != 3) {
|
||||
@@ -55,25 +55,28 @@ int main(int argc, char *argv[]) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
- errno = 0;
|
||||
device = udev_device_new_from_subsystem_sysname(udev, "rfkill", argv[2]);
|
||||
if (!device) {
|
||||
- if (errno != 0)
|
||||
- log_error("Failed to get rfkill device '%s': %m", argv[2]);
|
||||
- else
|
||||
- log_oom();
|
||||
-
|
||||
- return EXIT_FAILURE;
|
||||
+ log_debug("Failed to get rfkill device '%s', ignoring: %m", argv[2]);
|
||||
+ return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
name = udev_device_get_sysattr_value(device, "name");
|
||||
if (!name) {
|
||||
- log_error("rfkill device has no name?");
|
||||
- return EXIT_FAILURE;
|
||||
+ log_error("rfkill device has no name? Ignoring device.");
|
||||
+ return EXIT_SUCCESS;
|
||||
+ }
|
||||
+
|
||||
+ log_debug("Operating on rfkill device '%s'.", name);
|
||||
+
|
||||
+ type = udev_device_get_sysattr_value(device, "type");
|
||||
+ if (!type) {
|
||||
+ log_error("rfkill device has no type? Ignoring device.");
|
||||
+ return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
- escaped_name = cescape(name);
|
||||
- if (!escaped_name) {
|
||||
+ escaped_type = cescape(type);
|
||||
+ if (!escaped_type) {
|
||||
log_oom();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -86,9 +89,9 @@ int main(int argc, char *argv[]) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
- saved = strjoin("/var/lib/systemd/rfkill/", escaped_path_id, ":", escaped_name, NULL);
|
||||
+ saved = strjoin("/var/lib/systemd/rfkill/", escaped_path_id, ":", escaped_type, NULL);
|
||||
} else
|
||||
- saved = strjoin("/var/lib/systemd/rfkill/", escaped_name, NULL);
|
||||
+ saved = strjoin("/var/lib/systemd/rfkill/", escaped_type, NULL);
|
||||
|
||||
if (!saved) {
|
||||
log_oom();
|
||||
@@ -102,19 +105,17 @@ int main(int argc, char *argv[]) {
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
r = read_one_line_file(saved, &value);
|
||||
+ if (r == -ENOENT)
|
||||
+ return EXIT_SUCCESS;
|
||||
if (r < 0) {
|
||||
-
|
||||
- if (r == -ENOENT)
|
||||
- return EXIT_SUCCESS;
|
||||
-
|
||||
log_error("Failed to read %s: %s", saved, strerror(-r));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
r = udev_device_set_sysattr_value(device, "soft", value);
|
||||
if (r < 0) {
|
||||
- log_error("Failed to write system attribute: %s", strerror(-r));
|
||||
- return EXIT_FAILURE;
|
||||
+ log_debug("Failed to write 'soft' attribute on rfkill device, ignoring: %s", strerror(-r));
|
||||
+ return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
} else if (streq(argv[1], "save")) {
|
||||
@@ -122,8 +123,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
value = udev_device_get_sysattr_value(device, "soft");
|
||||
if (!value) {
|
||||
- log_error("Failed to read system attribute: %s", strerror(-r));
|
||||
- return EXIT_FAILURE;
|
||||
+ log_debug("Failed to read system attribute, ignoring device: %s", strerror(-r));
|
||||
+ return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
r = write_string_file(saved, value);
|
189
1098-udev-link_setup-respect-kernel-name-assign-policy.patch
Normal file
189
1098-udev-link_setup-respect-kernel-name-assign-policy.patch
Normal file
@ -0,0 +1,189 @@
|
||||
Based on 04b67d49254d956d31bcfe80340fb9df7ed332d3 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Tue, 15 Jul 2014 17:57:43 +0200
|
||||
Subject: [PATCH] udev: link_setup - respect kernel name assign policy
|
||||
|
||||
Newer kernels export meta-information about the origin of an ifname. Respect this
|
||||
from the ifname rename logic. We do not rename any interfaces that was originally
|
||||
named by userspace, nor once which have already been renamed from userspace.
|
||||
|
||||
Moreover, we optionally do not (the default) rename interfaces which the kernel
|
||||
claims to have named in a predictable way.
|
||||
---
|
||||
man/udev.xml | 13 ++++++++++-
|
||||
network/99-default.link | 2 -
|
||||
src/shared/missing.h | 21 +++++++++++++++++
|
||||
src/udev/net/link-config.c | 53 +++++++++++++++++++++++++++++++++++++--------
|
||||
src/udev/net/link-config.h | 1
|
||||
5 files changed, 79 insertions(+), 11 deletions(-)
|
||||
|
||||
--- man/udev.xml
|
||||
+++ man/udev.xml 2014-12-05 11:43:18.670867575 +0000
|
||||
@@ -914,10 +914,21 @@
|
||||
successful one is used. The name is not set directly, but
|
||||
is exported to udev as the property <literal>ID_NET_NAME</literal>,
|
||||
which is, by default, used by a udev rule to set
|
||||
- <literal>NAME</literal>. The available policies are:
|
||||
+ <literal>NAME</literal>. If the name has already
|
||||
+ been set by userspace, no renaming is performed.
|
||||
+ The available policies are:
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
+ <term><literal>kernel</literal></term>
|
||||
+ <listitem>
|
||||
+ <para>If the kernel claims that the name it
|
||||
+ has set for a device is predictable, then
|
||||
+ no renaming is performed.
|
||||
+ </para>
|
||||
+ </listitem>
|
||||
+ </varlistentry>
|
||||
+ <varlistentry>
|
||||
<term><literal>database</literal></term>
|
||||
<listitem>
|
||||
<para>The name is set based on entries in the Hardware
|
||||
--- network/99-default.link
|
||||
+++ network/99-default.link 2014-12-05 00:00:00.000000000 +0000
|
||||
@@ -1,3 +1,3 @@
|
||||
[Link]
|
||||
-NamePolicy=database onboard slot path
|
||||
+NamePolicy=kernel database onboard slot path
|
||||
MACAddressPolicy=persistent
|
||||
--- src/shared/missing.h
|
||||
+++ src/shared/missing.h 2014-12-05 11:33:06.120057836 +0000
|
||||
@@ -362,3 +362,24 @@ static inline int setns(int fd, int nsty
|
||||
return syscall(__NR_setns, fd, nstype);
|
||||
}
|
||||
#endif
|
||||
+
|
||||
+#ifndef NET_ADDR_RANDOM
|
||||
+# define NET_ADDR_RANDOM 1
|
||||
+#endif
|
||||
+
|
||||
+#ifndef NET_NAME_ENUM
|
||||
+# define NET_NAME_ENUM 1
|
||||
+#endif
|
||||
+
|
||||
+#ifndef NET_NAME_PREDICTABLE
|
||||
+# define NET_NAME_PREDICTABLE 2
|
||||
+#endif
|
||||
+
|
||||
+#ifndef NET_NAME_USER
|
||||
+# define NET_NAME_USER 3
|
||||
+#endif
|
||||
+
|
||||
+#ifndef NET_NAME_RENAMED
|
||||
+# define NET_NAME_RENAMED 4
|
||||
+#endif
|
||||
+
|
||||
--- src/udev/net/link-config.c
|
||||
+++ src/udev/net/link-config.c 2014-12-05 11:36:51.658018542 +0000
|
||||
@@ -20,10 +20,11 @@
|
||||
***/
|
||||
|
||||
#include <netinet/ether.h>
|
||||
-#include <net/if.h>
|
||||
+#include <linux/netdevice.h>
|
||||
|
||||
#include "sd-id128.h"
|
||||
|
||||
+#include "missing.h"
|
||||
#include "link-config.h"
|
||||
#include "ethtool-util.h"
|
||||
|
||||
@@ -297,7 +298,33 @@ static bool mac_is_random(struct udev_de
|
||||
return false;
|
||||
|
||||
/* check for NET_ADDR_RANDOM */
|
||||
- return type == 1;
|
||||
+ return type == NET_ADDR_RANDOM;
|
||||
+}
|
||||
+
|
||||
+static bool should_rename(struct udev_device *device, bool respect_predictable) {
|
||||
+ const char *s;
|
||||
+ unsigned type;
|
||||
+ int r;
|
||||
+
|
||||
+ s = udev_device_get_sysattr_value(device, "name_assign_type");
|
||||
+ if (!s)
|
||||
+ return true; /* if we don't know, assume we should rename */
|
||||
+ r = safe_atou(s, &type);
|
||||
+ if (r < 0)
|
||||
+ return true;
|
||||
+
|
||||
+ switch (type) {
|
||||
+ case NET_NAME_USER:
|
||||
+ case NET_NAME_RENAMED:
|
||||
+ return false; /* these were already named by userspace, do not touch again */
|
||||
+ case NET_NAME_PREDICTABLE:
|
||||
+ if (respect_predictable)
|
||||
+ return false; /* the kernel claims to have given a predictable name */
|
||||
+ /* fall through */
|
||||
+ case NET_NAME_ENUM:
|
||||
+ default:
|
||||
+ return true; /* the name is known to be bad, or of an unknown type */
|
||||
+ }
|
||||
}
|
||||
|
||||
static bool mac_is_permanent(struct udev_device *device) {
|
||||
@@ -371,6 +398,7 @@ int link_config_apply(link_config_ctx *c
|
||||
const char *new_name = NULL;
|
||||
struct ether_addr generated_mac;
|
||||
struct ether_addr *mac = NULL;
|
||||
+ bool respect_predictable = false;
|
||||
int r, ifindex;
|
||||
|
||||
assert(ctx);
|
||||
@@ -406,8 +434,12 @@ int link_config_apply(link_config_ctx *c
|
||||
if (ctx->enable_name_policy && config->name_policy) {
|
||||
NamePolicy *policy;
|
||||
|
||||
- for (policy = config->name_policy; !new_name && *policy != _NAMEPOLICY_INVALID; policy++) {
|
||||
+ for (policy = config->name_policy; !respect_predictable && !new_name &&
|
||||
+ *policy != _NAMEPOLICY_INVALID; policy++) {
|
||||
switch (*policy) {
|
||||
+ case NAMEPOLICY_KERNEL:
|
||||
+ respect_predictable = true;
|
||||
+ break;
|
||||
case NAMEPOLICY_DATABASE:
|
||||
new_name = udev_device_get_property_value(device, "ID_NET_NAME_FROM_DATABASE");
|
||||
break;
|
||||
@@ -429,12 +461,14 @@ int link_config_apply(link_config_ctx *c
|
||||
}
|
||||
}
|
||||
|
||||
- if (new_name)
|
||||
- *name = new_name; /* a name was set by a policy */
|
||||
- else if (config->name)
|
||||
- *name = config->name; /* a name was set manually in the config */
|
||||
- else
|
||||
- *name = NULL;
|
||||
+ if (should_rename(device, respect_predictable)) {
|
||||
+ if (!new_name)
|
||||
+ /* if not set by policy, fall back manually set name */
|
||||
+ new_name = config->name;
|
||||
+ } else
|
||||
+ new_name = NULL;
|
||||
+
|
||||
+ *name = new_name;
|
||||
|
||||
switch (config->mac_policy) {
|
||||
case MACPOLICY_PERSISTENT:
|
||||
@@ -500,6 +534,7 @@ DEFINE_STRING_TABLE_LOOKUP(mac_policy, M
|
||||
DEFINE_CONFIG_PARSE_ENUM(config_parse_mac_policy, mac_policy, MACPolicy, "Failed to parse MAC address policy");
|
||||
|
||||
static const char* const name_policy_table[] = {
|
||||
+ [NAMEPOLICY_KERNEL] = "kernel",
|
||||
[NAMEPOLICY_DATABASE] = "database",
|
||||
[NAMEPOLICY_ONBOARD] = "onboard",
|
||||
[NAMEPOLICY_SLOT] = "slot",
|
||||
--- src/udev/net/link-config.h
|
||||
+++ src/udev/net/link-config.h 2014-12-05 00:00:00.000000000 +0000
|
||||
@@ -39,6 +39,7 @@ typedef enum MACPolicy {
|
||||
} MACPolicy;
|
||||
|
||||
typedef enum NamePolicy {
|
||||
+ NAMEPOLICY_KERNEL,
|
||||
NAMEPOLICY_DATABASE,
|
||||
NAMEPOLICY_ONBOARD,
|
||||
NAMEPOLICY_SLOT,
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 5 12:13:02 UTC 2014 - werner@suse.de
|
||||
|
||||
- Add upstream patches
|
||||
0001-units-make-sure-rfkill-service-is-bount-to-the-actua.patch
|
||||
0002-rfkill-rework-how-we-generate-file-names-from-rfkill.patch
|
||||
1097-udev-link_setup-respect-kernel-name-assign-policy.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 28 13:26:21 UTC 2014 - rmilasan@suse.com
|
||||
|
||||
|
@ -1044,6 +1044,10 @@ Patch507: 0002-systemctl-obey-state-in-list-unit-files.patch
|
||||
Patch509: 0002-core-watchdog-bus-properties-cannot-be-both-writable.patch
|
||||
# PATCH-FIX-UPSTREAM added at 2014/11/20
|
||||
Patch510: 0003-sd-bus-refuse-properties-that-claim-to-be-both-writa.patch
|
||||
# PATCH-FIX-UPSTREAM added at 2014/12/05
|
||||
Patch511: 0001-units-make-sure-rfkill-service-is-bount-to-the-actua.patch
|
||||
# PATCH-FIX-UPSTREAM added at 2014/12/05
|
||||
Patch512: 0002-rfkill-rework-how-we-generate-file-names-from-rfkill.patch
|
||||
|
||||
# UDEV PATCHES
|
||||
# ============
|
||||
@ -1245,6 +1249,8 @@ Patch1095: 1095-set-ssd-disk-to-use-deadline-scheduler.patch
|
||||
Patch1096: 1096-new-udev-root-symlink-generator.patch
|
||||
# PATCH-FIX-SUSE 1097-udevd-increase-maximum-number-of-children.patch
|
||||
Patch1097: 1097-udevd-increase-maximum-number-of-children.patch
|
||||
# PATCH-FIX-UPSTREAM 1098-udev-link_setup-respect-kernel-name-assign-policy.patch
|
||||
Patch1098: 1098-udev-link_setup-respect-kernel-name-assign-policy.patch
|
||||
|
||||
%description
|
||||
Systemd is a system and service manager, compatible with SysV and LSB
|
||||
@ -1914,6 +1920,8 @@ cp %{SOURCE7} m4/
|
||||
%patch507 -p0
|
||||
%patch509 -p0
|
||||
%patch510 -p0
|
||||
%patch511 -p0
|
||||
%patch512 -p0
|
||||
|
||||
# udev patches
|
||||
%patch1001 -p1
|
||||
@ -2046,6 +2054,7 @@ cp %{SOURCE7} m4/
|
||||
%patch1095 -p1
|
||||
%patch1096 -p1
|
||||
%patch1097 -p1
|
||||
%patch1098 -p0
|
||||
|
||||
# remove patch backups
|
||||
find -name '*.orig' -exec rm -f '{}' \+
|
||||
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 5 12:13:02 UTC 2014 - werner@suse.de
|
||||
|
||||
- Add upstream patches
|
||||
0001-units-make-sure-rfkill-service-is-bount-to-the-actua.patch
|
||||
0002-rfkill-rework-how-we-generate-file-names-from-rfkill.patch
|
||||
1097-udev-link_setup-respect-kernel-name-assign-policy.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 28 13:26:21 UTC 2014 - rmilasan@suse.com
|
||||
|
||||
|
@ -1039,6 +1039,10 @@ Patch507: 0002-systemctl-obey-state-in-list-unit-files.patch
|
||||
Patch509: 0002-core-watchdog-bus-properties-cannot-be-both-writable.patch
|
||||
# PATCH-FIX-UPSTREAM added at 2014/11/20
|
||||
Patch510: 0003-sd-bus-refuse-properties-that-claim-to-be-both-writa.patch
|
||||
# PATCH-FIX-UPSTREAM added at 2014/12/05
|
||||
Patch511: 0001-units-make-sure-rfkill-service-is-bount-to-the-actua.patch
|
||||
# PATCH-FIX-UPSTREAM added at 2014/12/05
|
||||
Patch512: 0002-rfkill-rework-how-we-generate-file-names-from-rfkill.patch
|
||||
|
||||
# UDEV PATCHES
|
||||
# ============
|
||||
@ -1240,6 +1244,8 @@ Patch1095: 1095-set-ssd-disk-to-use-deadline-scheduler.patch
|
||||
Patch1096: 1096-new-udev-root-symlink-generator.patch
|
||||
# PATCH-FIX-SUSE 1097-udevd-increase-maximum-number-of-children.patch
|
||||
Patch1097: 1097-udevd-increase-maximum-number-of-children.patch
|
||||
# PATCH-FIX-UPSTREAM 1098-udev-link_setup-respect-kernel-name-assign-policy.patch
|
||||
Patch1098: 1098-udev-link_setup-respect-kernel-name-assign-policy.patch
|
||||
|
||||
%description
|
||||
Systemd is a system and service manager, compatible with SysV and LSB
|
||||
@ -1909,6 +1915,8 @@ cp %{SOURCE7} m4/
|
||||
%patch507 -p0
|
||||
%patch509 -p0
|
||||
%patch510 -p0
|
||||
%patch511 -p0
|
||||
%patch512 -p0
|
||||
|
||||
# udev patches
|
||||
%patch1001 -p1
|
||||
@ -2041,6 +2049,7 @@ cp %{SOURCE7} m4/
|
||||
%patch1095 -p1
|
||||
%patch1096 -p1
|
||||
%patch1097 -p1
|
||||
%patch1098 -p0
|
||||
|
||||
# remove patch backups
|
||||
find -name '*.orig' -exec rm -f '{}' \+
|
||||
|
Loading…
Reference in New Issue
Block a user