Bug 100622

Summary: Hotplug (/etc/hotplug/net.agent?) should call nameif if /etc/mactab exists.
Product: [Retired] Red Hat Linux Beta Reporter: Aleksey Nogin <aleksey>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: beta1CC: rvokal
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-09-03 23:29:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 82507, 100643    
Attachments:
Description Flags
A patch to /etc/hotplug/net.agent
none
patch to bring up the right config on insertion none

Description Aleksey Nogin 2003-07-23 18:46:27 UTC
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 18:49:46 UTC
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 18:58:27 UTC
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 19:12:53 UTC
> 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 19:20:47 UTC
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
modifications.

Comment 5 Aleksey Nogin 2003-07-23 19:25:44 UTC
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 19:29:24 UTC
Reads the hwaddr for the device passed to it, looks for the config file with
that hwaddr.

Comment 7 Bill Nottingham 2003-08-15 04:52:52 UTC
Is this better for you with initscripts-7.29-x?

Comment 8 Aleksey Nogin 2003-09-03 09:20:39 UTC
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
scenarious:

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 19:35:24 UTC
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 20:54:10 UTC
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 23:29:18 UTC
Added in hotplug-2002_04_02-20.