Bug 85762 - [RFE] call nameif in need_hostname() if /etc/mactab exists
[RFE] call nameif in need_hostname() if /etc/mactab exists
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
8.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-03-07 01:09 EST by Matt Domsch
Modified: 2014-03-16 22:35 EDT (History)
6 users (show)

See Also:
Fixed In Version: 7.26-1
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-07-02 22:56:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Matt Domsch 2003-03-07 01:09:56 EST
Description of problem:
It would be nice to be able to use named ethernet interfaces during the bootup
process.  Currently, nameif isn't called to name interfaces after their modules
are loaded.

This patch calls nameif after loading each network module.

--- network-functions.~2~       2003-03-06 10:45:59.000000000 -0600
+++ network-functions   2003-03-06 10:48:08.000000000 -0600
@@ -93,7 +93,8 @@
         return 2
     fi
     modprobe $1 > /dev/null 2>&1 || return 1
+    [ -f /etc/mactab ] && /sbin/nameif
     LC_ALL= LANG= ip -o link | grep -q $1
     return $?
 }

Version-Release number of selected component (if applicable):
initscripts-7.10-1 or earlier
Comment 1 Bill Nottingham 2003-03-07 15:24:50 EST
Hm, if we do this, will have to look into how to avoid the 'wireless' problem.
Comment 2 James Pattie 2003-05-06 13:11:17 EDT
We have an alternative to the above patch wherein we call nameif on an
individual basis instead of N times for N interfaces.  The interfaces that do
not exist yet will blow errors when done with the above method.

We had the same problem and I made a quick page discussing it at
www.pcxperience.org/nameif/

This patch is against RH 9.0 but can be easily changed for other versions.

/etc/sysconfig/network-scripts/network-functions

--- network-functions.orig      2003-02-10 20:34:18.000000000 -0600
+++ network-functions   2003-05-06 11:20:26.000000000 -0500
@@ -93,6 +93,9 @@
         return 2
     fi
     modprobe $1 > /dev/null 2>&1 || return 1
+    if [ -n "${HWADDR}" ]; then
+      /sbin/nameif "$1" "${HWADDR}"
+    fi
     LC_ALL= LANG= ip -o link | grep -q $1
     return $?
 }



to make sure that HWADDR is available we also patched /etc/init.d/network

--- network.orig        2003-02-03 20:19:20.000000000 -0600
+++ network     2003-05-06 11:18:03.000000000 -0500
@@ -107,6 +107,7 @@
                        continue
                fi
                if LANG=C egrep -L "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i >
/dev/null ; then
+                       eval $(fgrep "HWADDR" ifcfg-$i)
                        # this loads the module, to preserve ordering
                        is_available $i
                        continue



OPTIONALLY you can take out the other spot where this was trying to be done in
/sbin/ifup

--- ifup.orig   2003-03-12 19:16:46.000000000 -0600
+++ ifup        2003-05-06 11:18:48.000000000 -0500
@@ -152,16 +152,6 @@
          exit 0
       fi
 }
-if [ -n "${HWADDR}" ]; then
-    FOUNDMACADDR=`LC_ALL= LANG= ip -o link show ${REALDEVICE} | \
-       sed 's/.*link\/ether \([[:alnum:]:]*\).*/\1/'`
-    if [ "${FOUNDMACADDR}" != "${HWADDR}" ]; then
-        /sbin/nameif "${REALDEVICE}" "${HWADDR}" || {
-          echo $"Device ${DEVICE} has different MAC address than expected,
ignoring."
-          exit 1
-       }
-    fi
-fi

 # is the device wireless? If so, configure wireless device specifics
 is_wireless_device ${DEVICE} && . ./ifup-wireless
Comment 3 acount closed by user 2003-05-23 08:38:35 EDT
which is the bug state?
initscripts-7.22-1 doesn't has any change
Comment 4 Bill Nottingham 2003-05-23 09:59:08 EDT
There are various other places that don't really handle arbitrary device names
correctly that need fixed first.
Comment 5 Bill Nottingham 2003-07-02 22:56:30 EDT
Various things added in 7.26-1. Let's see what breaks.
Comment 6 Aleksey Nogin 2003-07-23 14:47:13 EDT
I filed bug 100622 for interfaces that are brought up by hotplug.

Note You need to log in before you can comment on or make changes to this bug.