diff options
author | Juuso Alasuutari | 2006-06-25 16:40:08 +0300 |
---|---|---|
committer | Juuso Alasuutari | 2006-06-25 16:40:08 +0300 |
commit | 5c44922247ec3e591535415f00fca8e72a66cd01 (patch) | |
tree | 36151aa8d602f4be240a6ee1f70b42f7c631408d | |
parent | 4e23da0daa2d40e877f4541e73eea187b8ee3fd2 (diff) |
Added patch to allow network interface renaming with existing names.
Commented out parts about static targets, only udevstart.static is
installed, and udevstart is deprecated.
-rwxr-xr-x | disk/udev/BUILD | 16 | ||||
-rwxr-xr-x | disk/udev/CONFIGURE | 22 | ||||
-rw-r--r-- | disk/udev/HISTORY | 10 | ||||
-rwxr-xr-x | disk/udev/INSTALL | 18 | ||||
-rw-r--r-- | disk/udev/Makefile.patch | 8 | ||||
-rwxr-xr-x | disk/udev/PRE_BUILD | 20 | ||||
-rw-r--r-- | disk/udev/ifrename_wait_retry.patch | 58 |
7 files changed, 114 insertions, 38 deletions
diff --git a/disk/udev/BUILD b/disk/udev/BUILD index a94395a421..90cbc234b2 100755 --- a/disk/udev/BUILD +++ b/disk/udev/BUILD @@ -8,12 +8,12 @@ if [[ "$UDEV_EXTRAS" == 'y' ]]; then make EXTRAS="extras/ata_id extras/dasd_id extras/edd_id extras/floppy extras/scsi_id extras/usb_id extras/volume_id" \ prefix=${INSTALL_ROOT}/ exec_prefix=${INSTALL_ROOT}/ ${OPTS} \ ${UDEV_DEBUG} DEST_DIR="./" V=true -fi && - -if [[ "$UDEV_STATIC" == 'y' ]]; then - pushd __static__ && - # we are not going to use `make install' so no need to set its parameters - message "${MESSAGE_COLOR}Building static utilities: $UDEV_STATIC_TARGET${DEFAULT_COLOR}" && - make USE_STATIC=true V=true $OPTS $UDEV_STATIC_TARGET && - popd fi + +#if [[ "$UDEV_STATIC" == 'y' ]]; then +# pushd __static__ && +# # we are not going to use `make install' so no need to set its parameters +# message "${MESSAGE_COLOR}Building static utilities: $UDEV_STATIC_TARGET${DEFAULT_COLOR}" && +# make USE_STATIC=true V=true $OPTS $UDEV_STATIC_TARGET && +# popd +#fi diff --git a/disk/udev/CONFIGURE b/disk/udev/CONFIGURE index 065d4eddae..e387202d50 100755 --- a/disk/udev/CONFIGURE +++ b/disk/udev/CONFIGURE @@ -1,17 +1,21 @@ config_query UDEV_PERSIST 'Install persistent storage rules?' n && + if [ "$RECENT_KERNEL" == "y" ]; then config_query UDEV_PERSIST_INPUT 'Install persistent input rules?' n fi && -config_query UDEV_STATIC 'Create static binaries in addition to dynamically linked ones?' n && + config_query_option UDEV_DEBUG 'Compile extra debugging messages?' n 'DEBUG=true' 'DEBUG=false' && -if [[ "$UDEV_STATIC" == 'y' ]]; then - if [[ -z "$UDEV_STATIC_TARGET" ]]; then - # add more UDEV utilities here as necessary, space-separated - local UDEV_STATIC_TARGET="udevstart" - fi && - persistent_add UDEV_STATIC_TARGET && - message "${MESSAGE_COLOR}Static utilities (with suffix .static): $UDEV_STATIC_TARGET${DEFAULT_COLOR}" -fi && + +#config_query UDEV_STATIC 'Create static binaries in addition to dynamically linked ones?' n && +#if [[ "$UDEV_STATIC" == 'y' ]]; then +# if [[ -z "$UDEV_STATIC_TARGET" ]]; then +# # add more UDEV utilities here as necessary, space-separated +# local UDEV_STATIC_TARGET="udevstart" +# fi && +# persistent_add UDEV_STATIC_TARGET && +# message "${MESSAGE_COLOR}Static utilities (with suffix .static): $UDEV_STATIC_TARGET${DEFAULT_COLOR}" +#fi && + if [[ "$UDEV_PERSIST" == "y" ]]; then UDEV_EXTRAS=y && persistent_add UDEV_EXTRAS diff --git a/disk/udev/HISTORY b/disk/udev/HISTORY index 97dee70278..db612b100c 100644 --- a/disk/udev/HISTORY +++ b/disk/udev/HISTORY @@ -1,3 +1,13 @@ +2006-06-25 Juuso Alasuutari <iuso@sourcemage.org> + * PRE_BUILD: Added patch to allow network interface renaming + with existing names. Added comments about patches, tidied + code. + * CONFIGURE, PRE_BUILD, BUILD, INSTALL: Commented out static + target parts, it only installs udevstart which is deprecated + now. + * ifrename_wait_retry.patch: Added. + * Makefile.patch: Updated. + 2006-06-24 Juuso Alasuutari <iuso@sourcemage.org> * helpers/mac2name: Edited to read DEVICE_MAC instead of MAC in /etc/sysconfig/network/*.dev. Fixed a bug where supplying no diff --git a/disk/udev/INSTALL b/disk/udev/INSTALL index f4fe9b5ff7..648c03b705 100755 --- a/disk/udev/INSTALL +++ b/disk/udev/INSTALL @@ -64,13 +64,13 @@ if [[ "$UDEV_EXTRAS" == 'y' ]]; then install_config_file etc/udev/60-persistent-input.rules ${UDEV_CFG}/rules.d/60-persistent-input.rules fi fi -fi && - -if [[ "$UDEV_STATIC" == 'y' ]]; then - pushd __static__ && - # we are not supposed to use `make install' - for FILE in $UDEV_STATIC_TARGET; do - install -D $FILE $INSTALL_ROOT/usr/sbin/$FILE.static - done && - popd fi + +#if [[ "$UDEV_STATIC" == 'y' ]]; then +# pushd __static__ && +# # we are not supposed to use `make install' +# for FILE in $UDEV_STATIC_TARGET; do +# install -D $FILE $INSTALL_ROOT/usr/sbin/$FILE.static +# done && +# popd +#fi diff --git a/disk/udev/Makefile.patch b/disk/udev/Makefile.patch index 6807c627d1..77c1c5be3c 100644 --- a/disk/udev/Makefile.patch +++ b/disk/udev/Makefile.patch @@ -1,7 +1,7 @@ ---- Makefile 2005-12-03 19:11:40.000000000 +0100 -+++ Makefile.new 2005-12-03 19:12:18.000000000 +0100 -@@ -340,11 +340,6 @@ - echo $$target; \ +--- Makefile 2006-06-25 15:48:49.000000000 +0300 ++++ Makefile.new 2006-06-25 15:49:39.000000000 +0300 +@@ -294,11 +294,6 @@ + @extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) -C $$target $@ || exit 1; \ done; -ifndef DESTDIR diff --git a/disk/udev/PRE_BUILD b/disk/udev/PRE_BUILD index a74738dce9..c0c1f0e475 100755 --- a/disk/udev/PRE_BUILD +++ b/disk/udev/PRE_BUILD @@ -1,9 +1,13 @@ -default_pre_build && -cd $SOURCE_DIRECTORY && -patch -p0 < $SCRIPT_DIRECTORY/Makefile.patch && +default_pre_build && +cd $SOURCE_DIRECTORY && -if [[ "$UDEV_STATIC" == 'y' ]]; then - message "${MESSAGE_COLOR}Setting up static build directory...${DEFAULT_COLOR}" && - mkdir __static__ && - cp -aRv Makefile *.{c,h} ./__static__/ -fi +# Prevent udev restart on 'make install', +# allow network interface renaming with existing name. +patch -p0 < $SCRIPT_DIRECTORY/Makefile.patch && +patch -p0 < $SCRIPT_DIRECTORY/ifrename_wait_retry.patch + +#if [[ "$UDEV_STATIC" == 'y' ]]; then +# message "${MESSAGE_COLOR}Setting up static build directory...${DEFAULT_COLOR}" && +# mkdir __static__ && +# cp -aRv Makefile *.{c,h} ./__static__/ +#fi diff --git a/disk/udev/ifrename_wait_retry.patch b/disk/udev/ifrename_wait_retry.patch new file mode 100644 index 0000000000..ecc57e8363 --- /dev/null +++ b/disk/udev/ifrename_wait_retry.patch @@ -0,0 +1,58 @@ +--- udev_device.c 2006-06-25 15:56:38.000000000 +0300 ++++ udev_device.c.new 2006-06-25 15:52:20.000000000 +0300 +@@ -86,6 +86,7 @@ + int sk; + struct ifreq ifr; + int retval; ++ int timeout = (1000000 / 50000) * 30; /* 30 seconds */ + + info("changing net interface name from '%s' to '%s'", udev->dev->kernel_name, udev->name); + if (udev->test_run) +@@ -102,10 +103,44 @@ + strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); + + retval = ioctl(sk, SIOCSIFNAME, &ifr); +- if (retval != 0) +- err("error changing net interface name: %s", strerror(errno)); +- close(sk); ++ if (retval != 0) { ++ if (errno != EEXIST) { ++ err("error changing net interface name %s to %s: %s", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); ++ goto error; ++ } ++ ++ /* Destination interface already exits. ++ * First rename our interface to something temporary in case ++ * we're trying to swap with that one. */ ++ strlcpy(ifr.ifr_newname, udev->dev->kernel_name, IFNAMSIZ); ++ strlcat(ifr.ifr_newname, "_temp", IFNAMSIZ); ++ ++ retval = ioctl(sk, SIOCSIFNAME, &ifr); ++ if (retval != 0) { ++ err("error changing net interface name %s to %s: %s", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); ++ goto error; ++ } ++ ++ /* Now we loop until our target interface goes away. */ ++ strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); ++ strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); ++ while ((retval = ioctl(sk, SIOCSIFNAME, &ifr)) != 0) { ++ if (errno != EEXIST) { ++ err("error changing net interface name %s to %s: %s", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); ++ break; ++ } ++ ++ if (timeout-- <= 0) { ++ err("error changing net interface name %s to %s: timeout", ifr.ifr_name, ifr.ifr_newname); ++ break; ++ } + ++ usleep(50000); ++ } ++ } ++ ++error: ++ close(sk); + return retval; + } + |