.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=576
This commit is contained in:
parent
e23319dfac
commit
700eb548c2
@ -9,27 +9,43 @@ 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(-)
|
||||
udev-event.c | 43 +++++++++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 39 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
|
||||
--- src/udev/udev-event.c
|
||||
+++ src/udev/udev-event.c 2014-03-27 13:19:06.727748307 +0000
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/signalfd.h>
|
||||
+#include <sys/inotify.h>
|
||||
|
||||
#include "udev.h"
|
||||
#include "rtnl-util.h"
|
||||
@@ -750,8 +751,9 @@ static int rename_netif(struct udev_even
|
||||
struct udev_device *dev = event->dev;
|
||||
_cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
|
||||
char name[IFNAMSIZ];
|
||||
+ char interim[IFNAMSIZ], *ptr = &interim[0];
|
||||
const char *oldname;
|
||||
- int r;
|
||||
+ int r, loop;
|
||||
|
||||
oldname = udev_device_get_sysname(dev);
|
||||
|
||||
@@ -765,12 +767,45 @@ 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));
|
||||
+ if (r == 0) {
|
||||
+ print_kmsg("renamed network interface %s to %s\n", oldname, name);
|
||||
+ return r;
|
||||
+ } else if (r != -EEXIST) {
|
||||
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));
|
||||
- print_kmsg("renamed network interface %s to %s", oldname, name);
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
@ -39,25 +55,30 @@ Port the patch of Robert to systemd v210 and test it out.
|
||||
+ 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));
|
||||
+ oldname, interim, strerror(-r));
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
|
||||
+ /* log temporary name */
|
||||
+ print_kmsg("renamed network interface %s to %s", oldname, interim);
|
||||
+ do {
|
||||
+ print_kmsg("renamed network interface %s to %s\n", oldname, interim);
|
||||
+
|
||||
+ loop = 90 * 20;
|
||||
+ while (loop--) {
|
||||
+ const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 };
|
||||
+ nanosleep(&duration, NULL);
|
||||
+
|
||||
+ 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;
|
||||
+ print_kmsg("renamed network interface %s to %s\n", interim, name);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (r != -EEXIST) {
|
||||
+ log_error("error changing net interface name %s to %s: %s",
|
||||
+ oldname, name, strerror(-r));
|
||||
+ return r;
|
||||
+ interim, name, strerror(-r));
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ } while (loop-- > 0);
|
||||
+ } else
|
||||
print_kmsg("renamed network interface %s to %s", oldname, name);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 28 08:10:13 UTC 2014 - werner@suse.de
|
||||
|
||||
- Use Robert's revised 1006-udev-always-rename-network.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 25 17:28:18 UTC 2014 - werner@suse.de
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user