Bug 100622 - Hotplug (/etc/hotplug/net.agent?) should call nameif if /etc/mactab exists.
Hotplug (/etc/hotplug/net.agent?) should call nameif if /etc/mactab exists.
Product: Red Hat Linux Beta
Classification: Retired
Component: initscripts (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
: FutureFeature
Depends On:
Blocks: 82507 CambridgeBlocker
  Show dependency treegraph
Reported: 2003-07-23 14:46 EDT by Aleksey Nogin
Modified: 2014-03-16 22:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-09-03 19:29:18 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
A patch to /etc/hotplug/net.agent (795 bytes, patch)
2003-07-23 14:58 EDT, Aleksey Nogin
no flags Details | Diff
patch to bring up the right config on insertion (650 bytes, text/plain)
2003-09-03 16:54 EDT, Bill Nottingham
no flags Details

  None (edit)
Description Aleksey Nogin 2003-07-23 14:46:27 EDT
Initscripts currently have some hooks that allow interfaces to get renamed based
on their HW addresses (see bug 85762). Unformtunately, this seems to only
support the on-boot interfaces where the ifup is called with the "deisred" name,
not the name the interface happened to get by default. Unfortunalely, in hotplug
case (PCMCIA cards, etc), the ifup script gets calls with whatever name the
interface got when in was added, so the name does not get changed.
Comment 1 Bill Nottingham 2003-07-23 14:49:46 EDT
Can you describe exactly how this fails for you? It works for me currently with
hotplug. What does your network configuration look like?
Comment 2 Aleksey Nogin 2003-07-23 14:58:27 EDT
Created attachment 93088 [details]
A patch to /etc/hotplug/net.agent

Here is an example patch that works for me.
Comment 3 Aleksey Nogin 2003-07-23 15:12:53 EDT
> Can you describe exactly how this fails for you? It works for me currently with
> hotplug. What does your network configuration look like?

I have 3 devices:
a) built-in 3c905C (preferred name - eth0)
b) built-in PCMCIA wireless card (preferred name - wvlan0)
c) another 3c905C in a docking statin (preferred name - eth1)

By default, I get "a" -> eth0, "b" -> eth1 when not docked and "a" -> eth0, "c"
-> eth1, "b" -> eth2 when docked (so I have a problem with two different cards
getting the eth1 name in different cases). Creating /etc/mactab does not help.
Adding HWADDR=... lines to /etc/sysconfig/network-scripts/ifcfg-{eth1,wvlan0}
does not help (note that in undocked case, "b" gets ifup'ed as eth1 when "c" is
simply not there!)
Comment 4 Bill Nottingham 2003-07-23 15:20:47 EDT
OK, this is more a bug with ifup, then. I'll try and reprocuce the setup with my
laptop. With HWADDR= in all the config files, this needs to work without hotplug
Comment 5 Aleksey Nogin 2003-07-23 15:25:44 EDT
Not sure how that would work - how would ifup even know to look at
/etc/sysconfig/network-scripts/ifcfg-wvlan0 ???
Comment 6 Bill Nottingham 2003-07-23 15:29:24 EDT
Reads the hwaddr for the device passed to it, looks for the config file with
that hwaddr.
Comment 7 Bill Nottingham 2003-08-15 00:52:52 EDT
Is this better for you with initscripts-7.29-x?
Comment 8 Aleksey Nogin 2003-09-03 05:20:39 EDT
Still only works if I apply the given patch and supply the /etc/macaddr.

With initscripts-7.30-1 and without my patch, inserting WaveLan card (that I
wish to be called wvlan0 while the default name is eth1) causes "/sbin/ifup
eth1" to be called. This prints out:

/sbin/ifup: line 146: local: can only be used in a function
interface 'eth1' not found

After that it proceeds to bring up the interface under the wrong name (eth1).

The problem is - the fix _has_ to go into hotplug and it _has_ to be _before_
/sbin/ifup is called! Here is the _proof_: without it by the time "/sbin/ifup
eth1" is called, the ifup script has no way of distinguishing between the two

1) ifup is called by the user - and thus "eth1" refers to the "desired" name of
the device -  e.g. we need to find the device with the HWADDR specified in
cfcfg-eth1, rename it _to_ eth1 and bring up.

2) ifup is called by hotplug - and thus "eth1" is the "accidental" current name
of whatever device that needs to be brough up - _after_ it is renamed _from_
eth1 to an appropriate xyz such that ifcfg-xyz has HWADDR specified to be what
eth1 currently has...


Let me give a concrete example. Suppose you have two devices - A and B. Suppose
that currently we have

currently eth0 has HWaddr B
currently eth1 has HWaddr A

cfcfg-eth0 has "HWADDR=A"
cfcfg-eth1 has "HWADDR=B"

and "/sbin/ifup eth0" is called. What interface do you bring up??? If ifup was
called by the user, obviously user thinks that eth0 is device A (since this is
what user wrote in configs). But if ifup was called by hotplug, that manes that
device B was just plugged in and it is device B that needs to be brough up!

The only was this can be resolved is if you can trust hotplug to resolve the
name before calling ifup, as my patch provides (or something similar - may be
grep cfcfg-* instead of mactab, as my patch does).
Comment 9 Bill Nottingham 2003-09-03 15:35:24 EDT
Ugh, you're right. Since we don't populate mactab, it will have to go grepping
the config files.
Comment 10 Bill Nottingham 2003-09-03 16:54:10 EDT
Created attachment 94181 [details]
patch to bring up the right config on insertion

Does this patch work ok for you without an /etc/mactab?
Comment 11 Bill Nottingham 2003-09-03 19:29:18 EDT
Added in hotplug-2002_04_02-20.

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