Dr. Werner Fink 2014-03-04 10:38:55 +00:00 committed by Git OBS Bridge
parent 93cb26f723
commit 8f5bd2c76d
4 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,63 @@
From: Robert Milasan <rmilasan@suse.com>
Cc: Werner Fink <werner@suse.de>
Subject: udev always rename network
Date: Thu, 28 Mar 2013 09:24:43 +0000
udev: ensure that the network interfaces are renamed even if they exist (bnc#809843).
Date: Tue, 4 Mar 2014 10:29:21 +0000
Port the patch of Robert to systemd v210 and test it out.
---
udev-event.c | 40 ++++++++++++++++++++++++++++++++++++----
1 file changed, 36 insertions(+), 4 deletions(-)
--- systemd-210/src/udev/udev-event.c
+++ systemd-210/src/udev/udev-event.c 2014-03-04 11:19:50.583710411 +0100
@@ -765,10 +765,42 @@ static int rename_netif(struct udev_even
return r;
r = rtnl_set_link_name(rtnl, udev_device_get_ifindex(dev), name);
- if (r < 0)
- log_error("error changing net interface name %s to %s: %s",
- oldname, name, strerror(-r));
- else
+ if (r < 0) {
+ char interim[IFNAMSIZ], *ptr = &interim[0];
+ int loop = 90;
+
+ /* keep trying if the destination interface name already exists */
+ if (r != -EEXIST) {
+ log_error("error changing net interface name %s to %s: %s",
+ oldname, name, strerror(-r));
+ return r;
+ }
+
+ /* free our own name, another process may wait for us */
+ strpcpyf(&ptr, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev));
+
+ r = rtnl_set_link_name(rtnl, udev_device_get_ifindex(dev), interim);
+ if (r < 0) {
+ log_error("error changing net interface name %s to %s: %s",
+ oldname, name, strerror(-r));
+ return r;
+ }
+
+ /* log temporary name */
+ print_kmsg("renamed network interface %s to %s", oldname, interim);
+ do {
+ r = rtnl_set_link_name(rtnl, udev_device_get_ifindex(dev), name);
+ if (r == 0) {
+ print_kmsg("renamed network interface %s to %s", oldname, name);
+ return r;
+ }
+ if (r != -EEXIST) {
+ log_error("error changing net interface name %s to %s: %s",
+ oldname, name, strerror(-r));
+ return r;
+ }
+ } while (loop-- > 0);
+ } else
print_kmsg("renamed network interface %s to %s", oldname, name);
return r;

View File

@ -0,0 +1,10 @@
diff -Naur systemd-208/units/systemd-tmpfiles-clean.service.in systemd-208-mod/units/systemd-tmpfiles-clean.service.in
--- systemd-208/units/systemd-tmpfiles-clean.service.in 2013-08-13 20:02:52.826756410 +0000
+++ systemd-208-mod/units/systemd-tmpfiles-clean.service.in 2014-02-21 13:34:56.456511025 +0000
@@ -19,5 +19,6 @@
[Service]
Type=oneshot
+ExecStart=-@rootbindir@/systemd-tmpfiles-keep
ExecStart=@rootbindir@/systemd-tmpfiles --clean
IOSchedulingClass=idle

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Tue Mar 4 10:37:02 UTC 2014 - werner@suse.de
- Make patch 1006-udev-always-rename-network.patch work again
and add it again.
-------------------------------------------------------------------
Mon Mar 3 15:23:57 UTC 2014 - thomas.blume@suse.com
- address missing owner functionality in systemd-tmpfiles (fate#314974)
1022-systemd-tmpfiles-ownerkeep.patch
-------------------------------------------------------------------
Mon Mar 3 14:49:48 UTC 2014 - werner@suse.de

View File

@ -261,6 +261,8 @@ Patch1019: 1019-make-completion-smart-to-be-able-to-redirect.patch
Patch1020: 0001-add-network-device-after-NFS-mount-units.patch
# PATCH-FIX-SUSE systemd-dbus-system-bus-address.patch
Patch1021: systemd-dbus-system-bus-address.patch
# PATCH-FIX-SUSE 1022-systemd-tmpfiles-ownerkeep.patch
Patch1022: 1022-systemd-tmpfiles-ownerkeep.patch
# PATCH-FIX-SUSE systemd-install-compat_pkgconfig-always.patch
Patch1999: systemd-install-compat_pkgconfig-always.patch
@ -557,6 +559,7 @@ cp %{SOURCE7} m4/
%patch1019 -p1
%patch1020 -p1
%patch1021 -p1
%patch1022 -p1
%patch1999 -p1
# udev patches