Bug 18416 - wrong old name overrides the intended one and a wrong iface is configured
Summary: wrong old name overrides the intended one and a wrong iface is configured
Status: CLOSED WONTFIX
Alias: None
Product: Branch 4.1
Classification: Distributions
Component: etcnet (show other bugs)
Version: unspecified
Hardware: all Linux
: P2 normal
Assignee: Nobody's working on this, feel free to take it
QA Contact: qa-4.1@altlinux.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-31 21:51 MSK by Ivan Zakharyaschev
Modified: 2014-11-05 20:42 MSK (History)
2 users (show)

See Also:


Attachments
example-wrong-name-is-used-and-overrides-good.tar (30.00 KB, application/x-tar)
2008-12-31 21:51 MSK, Ivan Zakharyaschev
no flags Details
remove-wrong-name.patch (1.26 KB, patch)
2008-12-31 22:05 MSK, Ivan Zakharyaschev
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Zakharyaschev 2008-12-31 21:51:16 MSK
Created attachment 3177 [details]
example-wrong-name-is-used-and-overrides-good.tar

etcnet-0.9.7-alt0.M41.1

I have two profiles (default and "Yauza"). iftab is profiled, and gives to the Ethernet device two different names in the two profiles ("lan" and "yauza"). I want that each profile configures the iface with the corresponding name.
(The config files are attached.)

But unfortunately, if I'm switching from the default profile to "Yauza", the device has already the name "lan" and hence the wrong iface is configured and it "overrides" the intended correct configuration. This happens because ifup doesn't check if the name is invalid for the reason that the device should have another name, it only tries to rename any device to the wrong old name according to iftab, and if there is no such rule, everything is OK (but it is not!).

Example run:

[root@localhost net]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:13:a9:91:2a:52 brd ff:ff:ff:ff:ff:ff
3: wmaster0: <BROADCAST,MULTICAST> mtu 1500 qdisc ieee80211 qlen 1000
    link/ieee802.11 00:19:d2:8b:85:51 brd ff:ff:ff:ff:ff:ff
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether 00:19:d2:8b:85:51 brd ff:ff:ff:ff:ff:ff
[root@localhost net]# service network startwith Yauza
Computing interface groups: ... 3 interfaces found
Starting group 0/virtual (1 interfaces)
	Starting lo: .....OK
Starting group 1/realphys (2 interfaces)
	Starting lan: ..OK
	Starting yauza: .Error: cannot change name of lan to yauza: Device or resource busy
.Cannot find device "yauza"
xargs: /sbin/ip: exited with status 255; aborting
Cannot find device "yauza"
...OK
Processing /etc/net/vlantab: empty.
[root@localhost net]# ifconfig 
lan       Link encap:Ethernet  HWaddr 00:13:A9:91:2A:52  
          inet addr:10.1.1.11  Bcast:10.1.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:225767 errors:0 dropped:0 overruns:0 frame:0
          TX packets:130361 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:334350433 (318.8 MiB)  TX bytes:7744961 (7.3 MiB)
          Interrupt:17 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

[root@localhost net]# 

Expected: "yauza" is brought up, not "lan".
Comment 1 Ivan Zakharyaschev 2008-12-31 22:05:59 MSK
Created attachment 3178 [details]
remove-wrong-name.patch

The solution.

It works -- tested both for bringing up yauza after lan, and lan after yauza:

[root@localhost net]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:13:a9:91:2a:52 brd ff:ff:ff:ff:ff:ff
3: wmaster0: <BROADCAST,MULTICAST> mtu 1500 qdisc ieee80211 qlen 1000
    link/ieee802.11 00:19:d2:8b:85:51 brd ff:ff:ff:ff:ff:ff
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether 00:19:d2:8b:85:51 brd ff:ff:ff:ff:ff:ff
[root@localhost net]# service network stop
Computing interface groups: ... 3 interfaces found
Processing /etc/net/vlantab: empty.
Stopping group 1/realphys (2 interfaces)
	Stopping lan: ....OK
	Stopping yauza: OK
Stopping group 0/virtual (1 interfaces)
	Stopping lo: .OK
[root@localhost net]# git merge program-wrong-name-removed 
Merge made by recursive.
 scripts/ifup |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
[root@localhost net]# service network startwith Yauza
Computing interface groups: ... 3 interfaces found
Starting group 0/virtual (1 interfaces)
	Starting lo: ......OK
Starting group 1/realphys (2 interfaces)
	Starting lan: .yauza
%.OK
	Starting yauza: .yauza
%........OK
Processing /etc/net/vlantab: empty.
[root@localhost net]# ifconfig 
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

yauza     Link encap:Ethernet  HWaddr 00:00:39:35:C1:3B  
          inet addr:172.19.36.109  Bcast:172.19.37.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:225969 errors:0 dropped:0 overruns:0 frame:0
          TX packets:130585 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:334468754 (318.9 MiB)  TX bytes:7822657 (7.4 MiB)
          Interrupt:17 

[root@localhost net]# service network stop
Computing interface groups: ... 3 interfaces found
Processing /etc/net/vlantab: empty.
Stopping group 1/realphys (2 interfaces)
	Stopping lan: OK
	Stopping yauza: ...OK
Stopping group 0/virtual (1 interfaces)
	Stopping lo: .OK
[root@localhost net]# service network start
Computing interface groups: ... 3 interfaces found
Starting group 0/virtual (1 interfaces)
	Starting lo: ......OK
Starting group 1/realphys (2 interfaces)
	Starting lan: ...OK
	Starting yauza: ...Cannot find device "yauza"
xargs: /sbin/ip: exited with status 255; aborting
Cannot find device "yauza"
...OK
Processing /etc/net/vlantab: empty.
[root@localhost net]# ifconfig 
lan       Link encap:Ethernet  HWaddr 00:00:39:35:C1:3B  
          inet addr:10.1.1.30  Bcast:10.1.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:225975 errors:0 dropped:0 overruns:0 frame:0
          TX packets:130600 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:334469599 (318.9 MiB)  TX bytes:7824537 (7.4 MiB)
          Interrupt:17 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:285 (285.0 b)  TX bytes:285 (285.0 b)

[root@localhost net]#
Comment 2 Ivan Zakharyaschev 2008-12-31 22:18:54 MSK
(In reply to comment #1)
> Created an attachment (id=3178) [details]
> remove-wrong-name.patch
> 
> The solution.

One thing that was not quite clear to me: it shouldn't be an error if a name was successfully removed because it doesn't yet mean that everything went wrong: on the next step, another device might still get the requested name.
Comment 3 Denis Ovsienko 2009-02-26 13:54:54 MSK
I will be able to review around mid-March.
Comment 4 Michael Shigorin 2014-11-05 20:42:01 MSK
В 4.1/branch исправления не будут вноситься уже технически (заглушена очередь на сборку), поэтому прошу ошибки, актуальные для sisyphus/p7/t7, перевесить на текущие ветки или сизиф.