aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2006-11-28 23:19:58 +0000
committerBill Nottingham <notting@redhat.com>2006-11-28 23:19:58 +0000
commitdbc60a0fcf2263388fadd88f584aa1fbaa9aa328 (patch)
treee46f811102843780f27aa1d55d90aa9a8248e9bb
parent4440a8790ae8f34da395779ad6e7e1d200ff9260 (diff)
downloadinitscripts-dbc60a0fcf2263388fadd88f584aa1fbaa9aa328.tar
initscripts-dbc60a0fcf2263388fadd88f584aa1fbaa9aa328.tar.gz
initscripts-dbc60a0fcf2263388fadd88f584aa1fbaa9aa328.tar.bz2
initscripts-dbc60a0fcf2263388fadd88f584aa1fbaa9aa328.tar.xz
initscripts-dbc60a0fcf2263388fadd88f584aa1fbaa9aa328.zip
- add a step to rename any temporarily renamed devices (#208740,#204803, #214817)
-rw-r--r--initscripts.spec6
-rw-r--r--src/rename_device.c31
2 files changed, 33 insertions, 4 deletions
diff --git a/initscripts.spec b/initscripts.spec
index 8de59b71..c40ac202 100644
--- a/initscripts.spec
+++ b/initscripts.spec
@@ -1,6 +1,6 @@
Summary: The inittab file and the /etc/init.d scripts.
Name: initscripts
-Version: 8.45.9.EL
+Version: 8.45.10.EL
License: GPL
Group: System Environment/Base
Release: 1
@@ -193,8 +193,10 @@ rm -rf $RPM_BUILD_ROOT
%ghost %attr(0664,root,utmp) /var/run/utmp
%changelog
+* Tue Nov 28 2006 Bill Nottingham <notting@redhat.com> 8.45.10.EL-1
+- add a step to rename any temporarily renamed devices (#208740, #204803, #214817)
- rc.sysinit: fix reversed dmraid test (#216490)
-- translation updates: pa
+- translation updates (#216097)
- don't automatically reload modules on module reomvals (#211474)
* Fri Nov 3 2006 Bill Nottingham <notting@redhat.com> 8.45.9.EL-1
diff --git a/src/rename_device.c b/src/rename_device.c
index cb960fc5..0ec08b46 100644
--- a/src/rename_device.c
+++ b/src/rename_device.c
@@ -29,6 +29,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
+#include <sys/time.h>
#include <sys/types.h>
#include <linux/sockios.h>
@@ -50,8 +51,15 @@ struct netdev {
struct netdev *next;
};
+struct tmp {
+ char *src;
+ char *target;
+ struct tmp *next;
+};
+
struct netdev *configs = NULL;
struct netdev *devs = NULL;
+struct tmp *tmplist = NULL;
#if defined(__s390__) || defined(__s390x__)
static int is_cdev(const struct dirent *dent) {
@@ -294,6 +302,7 @@ void rename_device(char *src, char *target, struct netdev *current) {
char *curdev;
char *dev = NULL;
struct netdev *i, *tmpdev;
+ char *fallback = NULL;
hw = get_hwaddr(target);
if (!hw) {
@@ -309,14 +318,25 @@ void rename_device(char *src, char *target, struct netdev *current) {
if (nconfig) {
dev = nconfig;
for (i = current; i; i = i->next) {
- if (!strcmp(i->dev,dev))
+ if (!strcmp(i->dev,dev)) {
+ fallback = dev;
dev = NULL;
+ }
}
}
if (!dev)
asprintf(&dev,"__tmp%d",rand());
if (!dev)
return;
+ if (fallback) {
+ struct tmp *ntmp = calloc(1, sizeof(struct tmp));
+
+ ntmp->src = strdup(dev);
+ ntmp->target = strdup(fallback);
+ if (tmplist)
+ ntmp->next = tmplist;
+ tmplist = ntmp;
+ }
tmpdev = calloc(1,sizeof(struct netdev));
tmpdev->dev = curdev;
if (current)
@@ -364,7 +384,11 @@ void take_lock() {
int main(int argc, char **argv) {
char *src, *target, *hw;
-
+ struct tmp *tmpdev;
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ srand(tv.tv_usec);
take_lock();
signal(SIGSEGV,sighandler);
@@ -388,6 +412,9 @@ int main(int argc, char **argv) {
goto out_unlock;
rename_device(src, target, NULL);
+ for (tmpdev = tmplist; tmpdev ; tmpdev = tmpdev->next) {
+ rename_device(tmpdev->src, tmpdev->target, NULL);
+ }
printf("INTERFACE=%s\n",target);
printf("DEVPATH=/class/net/%s\n", target);
out_unlock: