Description of problem: ifdown-eth contains some code to deal with case when HWADDR is changed in ifcfg-ethX to rename device on startup. If HWADDR change is detected, "ifdown ethY" is executed to shut down corresponding device. But if we have 2 ethernet devices eth0 and eth1 and swap HWADDRs in corresponding ifcfg-eth files, then endless loop occurs: - "ifdown eth0" calls "ifdown-eth eth0" - ifdown-eth execs "ifdown eth1" - "ifdown eth1" calls "ifdown-eth eth1" - ifdown-eth execs "ifdown eth0" - ... No diagnostics is printed during this, so to end-user it looks like freeze. Ctl-Alt-Del doesn't help. Version-Release number of selected component (if applicable): Latest version of initscripts from CVS as of 18 Nov 2007 still has this code. How reproducible: Reliably. Steps to Reproduce: 1. Use computer with 2 ethernet cards, both up. 2. Swap HWADDR values between ifcfg-eth0 and ifcfg-eth1 3. shutdown -r now 4. Look at console - OS freezes on network shutdown. Actual results: Freeze on shutdown. Expected results: Clean shutdown, syncing disks, halt or reboot depending on "shutdown" switch. Additional info: Patch attached.
Created attachment 263461 [details] proposed patch to avoid endless loop
Steps to Reproduce on Fedora Core 8 Live CD: 1. Use computer with 2 ethernet cards, both up 2. Swap HWADDR values between ifcfg-eth0 and ifcfg-eth1 3. Run "/etc/init.d/network stop" 4. See how it never ends
Created attachment 266091 [details] simpler patch Here's what I'm proposing - I'm trying to think of a case where you'd want to continue when the device names don't match, and I can't think of one.
This patch works. And I agree, it's much better to bail out in case of inconsistency instead of trying to guess which interface user was willing to shut down. Thank you.
Added in CVS, will be in rawhide. May make a F8 update.
BTW, that backquote in the patch seems to break things. It's typo, I guess. I didn't notice that before because I was applying your patch using cut-n-paste. I don't even test it now when I see it because patch adds odd number of backquotes.
Whoops, thanks.
Now it hangs when MAC address is wrong (and NEWCONFIG is empty because of that, and grep takes 1 argument and waits for input on stdin).
It can be fixed merely by adding [ -n "${NEWCONFIG}" ] && right before eval $(LANG=C fgrep "DEVICE=" $NEWCONFIG)
Something similar added in git.
*** Bug 669728 has been marked as a duplicate of this bug. ***