forked from pool/systemd
a4023d0c37
- Fix patch tty-ask-password-agent-on-console.patch not to crash away but enable it to ask on all devices of /dev/console - Avoid "file not found /etc/udev/rules.d/70-persistent-net.rules" waring occurring in %post - Add patch let-vconsole-setup-get-properties-only-once-to-copy-them.patch to avoid broken virtual console mapping due stressed ioctl API for the virtual consoles (boo#904214) - Fix last change that is use the new name for udev packages in %pretrans. - restore usage of LUA in %pretrans. - Try to generate the systemd users and groups always in same order to avoid republish other packages (boo#944660) - cleanup specfile by removing commands that were dealing with systemd pre-generated files: we're now using systemd tarball generated directly from the git repo which doesn't contain any of these files. - there's no point in using LUA in %pretrans - Drop 0009-make-xsltproc-use-correct-ROFF-links.patch This patch was initialy added to workaround bsc#842844. But it appears that man(1) was fixed (included since 13.2 at least) to handle manual pages that consist only of a .so directive such as '.so <page>'. - Change use-rndaddentropy-ioctl-to-load-random-seed.patch to make it work on big endian OBS-URL: https://build.opensuse.org/request/show/333777 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=223
78 lines
2.8 KiB
Diff
78 lines
2.8 KiB
Diff
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.
|
|
|
|
---
|
|
src/udev/udev-event.c | 41 +++++++++++++++++++++++++++++++++++++----
|
|
1 file changed, 37 insertions(+), 4 deletions(-)
|
|
|
|
|
|
Index: systemd-221/src/udev/udev-event.c
|
|
===================================================================
|
|
--- systemd-221.orig/src/udev/udev-event.c
|
|
+++ systemd-221/src/udev/udev-event.c
|
|
@@ -796,20 +796,53 @@ out:
|
|
static int rename_netif(struct udev_event *event) {
|
|
struct udev_device *dev = event->dev;
|
|
char name[IFNAMSIZ];
|
|
+ char interim[IFNAMSIZ], *ptr = &interim[0];
|
|
const char *oldname;
|
|
- int r;
|
|
+ int r, loop;
|
|
|
|
oldname = udev_device_get_sysname(dev);
|
|
|
|
strscpy(name, IFNAMSIZ, event->name);
|
|
|
|
r = rtnl_set_link_name(&event->rtnl, udev_device_get_ifindex(dev), name);
|
|
- if (r < 0)
|
|
+ if (r == 0) {
|
|
+ log_info("renamed network interface %s to %s\n", oldname, name);
|
|
+ return r;
|
|
+ } else if (r != -EEXIST) {
|
|
return log_error_errno(r, "Error changing net interface name '%s' to '%s': %m", oldname, name);
|
|
+ }
|
|
|
|
- log_debug("renamed network interface '%s' to '%s'", oldname, name);
|
|
+ /* free our own name, another process may wait for us */
|
|
+ strpcpyf(&ptr, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev));
|
|
|
|
- return 0;
|
|
+ r = rtnl_set_link_name(&event->rtnl, udev_device_get_ifindex(dev), interim);
|
|
+ if (r < 0) {
|
|
+ log_error("error changing net interface name %s to %s: %s",
|
|
+ oldname, interim, strerror(-r));
|
|
+ return r;
|
|
+ }
|
|
+
|
|
+ /* log temporary name */
|
|
+ log_info("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(&event->rtnl, udev_device_get_ifindex(dev), name);
|
|
+ if (r == 0) {
|
|
+ log_info("renamed network interface %s to %s\n", interim, name);
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ if (r != -EEXIST) {
|
|
+ log_error("error changing net interface name %s to %s: %s",
|
|
+ interim, name, strerror(-r));
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ return r;
|
|
}
|
|
|
|
void udev_event_execute_rules(struct udev_event *event,
|