udev: Update to 125.
[people/pmueller/ipfire-2.x.git] / src / patches / udev-125-netif_rename.patch
1 diff -Nur udev-125.vanilla/udev_device.c udev-125/udev_device.c
2 --- udev-125.vanilla/udev_device.c 2008-07-18 16:26:55.000000000 +0200
3 +++ udev-125/udev_device.c 2010-07-25 18:15:12.289242450 +0200
4 @@ -123,42 +123,7 @@
5 if (retval == 0)
6 kernel_log(ifr);
7 else {
8 - int loop;
9 -
10 - /* see if the destination interface name already exists */
11 - if (errno != EEXIST) {
12 - err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno));
13 - goto exit;
14 - }
15 -
16 - /* free our own name, another process may wait for us */
17 - strlcpy(ifr.ifr_newname, udev->dev->kernel, IFNAMSIZ);
18 - strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ);
19 - retval = ioctl(sk, SIOCSIFNAME, &ifr);
20 - if (retval != 0) {
21 - err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno));
22 - goto exit;
23 - }
24 -
25 - /* wait 30 seconds for our target to become available */
26 - strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ);
27 - strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ);
28 - loop = 30 * 20;
29 - while (loop--) {
30 - retval = ioctl(sk, SIOCSIFNAME, &ifr);
31 - if (retval == 0) {
32 - kernel_log(ifr);
33 - break;
34 - }
35 -
36 - if (errno != EEXIST) {
37 - err("error changing net interface name %s to %s: %s\n",
38 - ifr.ifr_name, ifr.ifr_newname, strerror(errno));
39 - break;
40 - }
41 - dbg("wait for netif '%s' to become free, loop=%i\n", udev->name, (30 * 20) - loop);
42 - usleep(1000 * 1000 / 20);
43 - }
44 + err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno));
45 }
46
47 exit: