forked from pool/systemd
Accepting request 162067 from home:rmilasan:branches:Base:System
- udev: ensure that the network interfaces are renamed even if they exist (bnc#809843). add: 1027-udev-always-rename-network.patch - udev: re-add persistent network rules (bnc#809843). add: 1026-re-add-persistent-net.patch - rebase all patches, ensure that they apply properly. - udev: ensure that the network interfaces are renamed even if they exist (bnc#809843). add: 1027-udev-always-rename-network.patch OBS-URL: https://build.opensuse.org/request/show/162067 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=359
This commit is contained in:
parent
c0d22af24a
commit
3135dd09a9
67
1027-udev-always-rename-network.patch
Normal file
67
1027-udev-always-rename-network.patch
Normal file
@ -0,0 +1,67 @@
|
||||
Index: systemd-195/src/udev/udev-event.c
|
||||
===================================================================
|
||||
--- systemd-195.orig/src/udev/udev-event.c
|
||||
+++ systemd-195/src/udev/udev-event.c
|
||||
@@ -750,6 +750,7 @@ static int rename_netif(struct udev_even
|
||||
struct udev_device *dev = event->dev;
|
||||
int sk;
|
||||
struct ifreq ifr;
|
||||
+ int loop;
|
||||
int err;
|
||||
|
||||
log_debug("changing net interface name from '%s' to '%s'\n",
|
||||
@@ -766,12 +767,51 @@ static int rename_netif(struct udev_even
|
||||
util_strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev));
|
||||
util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name);
|
||||
err = ioctl(sk, SIOCSIFNAME, &ifr);
|
||||
- if (err >= 0) {
|
||||
+ if (err == 0) {
|
||||
print_kmsg("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
|
||||
- } else {
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ /* keep trying if the destination interface name already exists */
|
||||
+ err = -errno;
|
||||
+ if (err != -EEXIST) {
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ /* free our own name, another process may wait for us */
|
||||
+ snprintf(ifr.ifr_newname, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev));
|
||||
+ err = ioctl(sk, SIOCSIFNAME, &ifr);
|
||||
+ if (err < 0) {
|
||||
err = -errno;
|
||||
- log_error("error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname);
|
||||
+ goto out;
|
||||
}
|
||||
+
|
||||
+ /* log temporary name */
|
||||
+ print_kmsg("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
|
||||
+
|
||||
+ /* wait a maximum of 90 seconds for our target to become available */
|
||||
+ util_strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname);
|
||||
+ util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name);
|
||||
+ loop = 90 * 20;
|
||||
+ while (loop--) {
|
||||
+ const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 };
|
||||
+
|
||||
+ log_debug("wait for netif '%s' to become free, loop=%i\n", event->name, (90 * 20) - loop);
|
||||
+ nanosleep(&duration, NULL);
|
||||
+
|
||||
+ err = ioctl(sk, SIOCSIFNAME, &ifr);
|
||||
+ if (err == 0) {
|
||||
+ print_kmsg("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
|
||||
+ break;
|
||||
+ }
|
||||
+ err = -errno;
|
||||
+ if (err != -EEXIST)
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ if (err < 0)
|
||||
+ log_error("error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname);
|
||||
close(sk);
|
||||
return err;
|
||||
}
|
@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Mar 28 09:24:43 UTC 2013 - rmilasan@suse.com
|
||||
|
||||
- udev: ensure that the network interfaces are renamed even if they
|
||||
exist (bnc#809843).
|
||||
add: 1027-udev-always-rename-network.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 20 10:14:59 UTC 2013 - rmilasan@suse.com
|
||||
|
||||
- udev: re-add persistent network rules (bnc#809843).
|
||||
add: 1026-re-add-persistent-net.patch
|
||||
- rebase all patches, ensure that they apply properly.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 21 14:45:12 UTC 2013 - fcrozat@suse.com
|
||||
|
||||
|
@ -334,6 +334,10 @@ Patch1023: 1023-cdrom_id-add-data-track-count-for-bad-virtual-drive.patch
|
||||
Patch1024: 1024-udev-usb_id-parse-only-size-bytes-of-the-descriptors.patch
|
||||
# PATCH-FIX-UPSTREAM 1025-udev-expose-new-ISO9660-properties-from-libblkid.patch
|
||||
Patch1025: 1025-udev-expose-new-ISO9660-properties-from-libblkid.patch
|
||||
# PATCH-FIX-OPENSUSE 1026-re-add-persistent-net.patch
|
||||
Patch1026: 1026-re-add-persistent-net.patch
|
||||
# PATCH-FIX-OPENSUSE 1027-udev-always-rename-network.patch
|
||||
Patch1027: 1027-udev-always-rename-network.patch
|
||||
|
||||
%description
|
||||
Systemd is a system and service manager, compatible with SysV and LSB
|
||||
@ -519,6 +523,8 @@ cp %{SOURCE7} m4/
|
||||
%patch1023 -p1
|
||||
%patch1024 -p1
|
||||
%patch1025 -p1
|
||||
%patch1026 -p1
|
||||
%patch1027 -p1
|
||||
|
||||
#systemd
|
||||
%patch1 -p1
|
||||
@ -1127,6 +1133,8 @@ fi
|
||||
%{_prefix}/lib/udev/scsi_id
|
||||
%{_prefix}/lib/udev/v4l_id
|
||||
%{_prefix}/lib/udev/write_dev_root_rule
|
||||
%{_prefix}/lib/udev/write_net_rules
|
||||
%{_prefix}/lib/udev/rule_generator.functions
|
||||
%dir %{_prefix}/lib/udev/keymaps
|
||||
%{_prefix}/lib/udev/keymaps/*
|
||||
%{_prefix}/lib/udev/keyboard-force-release.sh
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Mar 28 09:24:43 UTC 2013 - rmilasan@suse.com
|
||||
|
||||
- udev: ensure that the network interfaces are renamed even if they
|
||||
exist (bnc#809843).
|
||||
add: 1027-udev-always-rename-network.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 20 10:14:59 UTC 2013 - rmilasan@suse.com
|
||||
|
||||
|
@ -331,6 +331,8 @@ Patch1024: 1024-udev-usb_id-parse-only-size-bytes-of-the-descriptors.patch
|
||||
Patch1025: 1025-udev-expose-new-ISO9660-properties-from-libblkid.patch
|
||||
# PATCH-FIX-OPENSUSE 1026-re-add-persistent-net.patch
|
||||
Patch1026: 1026-re-add-persistent-net.patch
|
||||
# PATCH-FIX-OPENSUSE 1027-udev-always-rename-network.patch
|
||||
Patch1027: 1027-udev-always-rename-network.patch
|
||||
|
||||
%description
|
||||
Systemd is a system and service manager, compatible with SysV and LSB
|
||||
@ -517,6 +519,7 @@ cp %{SOURCE7} m4/
|
||||
%patch1024 -p1
|
||||
%patch1025 -p1
|
||||
%patch1026 -p1
|
||||
%patch1027 -p1
|
||||
|
||||
#systemd
|
||||
%patch1 -p1
|
||||
|
Loading…
Reference in New Issue
Block a user