Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#29136 - [netcfg]shutdown net-profiles in reverse order so dependent interfaces are deconstructed gracefully
Attached to Project:
Arch Linux
Opened by Walter Sullivan (wajasu) - Tuesday, 27 March 2012, 19:50 GMT
Last edited by Jouke Witteveen (jouke) - Friday, 11 May 2012, 19:45 GMT
Opened by Walter Sullivan (wajasu) - Tuesday, 27 March 2012, 19:50 GMT
Last edited by Jouke Witteveen (jouke) - Friday, 11 May 2012, 19:45 GMT
|
DetailsDescription:
bridge composed using multiple interfaces emits errors with /etc/rc.d/net-profiles stop Additional info: * package version(s) - found in 2.6.8-1, and patch aplied to 2.7.1 master which is in testing Steps to reproduce: NETWORKS=(tuntap bridge1) in /etc/rc.conf ===eth1 - constructed just fine /etc/network.d/ethernet-iproute-eth1: CONNECTION='ethernet' DESCRIPTION='A more versatile static ethernet connection using iproute' INTERFACE='eth1' IP='static' ===tap0 - constructed just fine /etc/network.d/tuntap: INTERFACE='tap0' CONNECTION='tuntap' MODE='tap' USER='me' GROUP='me' ===bridge1 - constructed just fine INTERFACE="br1" CONNECTION="bridge" DESCRIPTION="Bridge connection for wired and wireless AP" BRIDGE_INTERFACES="eth1 tap0" # Note: using tuntap profile , for tap0 creation ADDR='192.168.3.1' IP="static" ## sets forward delay time FWD_DELAY=0 ## sets max age of hello message MAX_AGE=10 ===========================================================BUG Behavior: ----With NETCFG_DEBUG=1 and Running: /etc/rc.d/net-profiles start DEBUG: Loading profile tuntap DEBUG: Configuring interface tap0 :: tuntap up [BUSY] DEBUG: status reported to profile_up as: DEBUG: Loading profile tuntap DEBUG: Configuring interface tap0 DEBUG: Loading profile tuntap DEBUG: Configuring interface tap0 DEBUG: ethernet_iproute_up ifup > No connection [DONE] DEBUG: Loading profile bridge1 DEBUG: Configuring interface br1 :: bridge1 up [BUSY] DEBUG: status reported to profile_up as: DEBUG: Loading profile bridge1 DEBUG: Configuring interface br1 DEBUG: Loading profile bridge1 DEBUG: Configuring interface br1 DEBUG: ethernet_iproute_up ifup > No connection [DONE] ----With NETCFG_DEBUG=1 and Running: /etc/rc.d/net-profiles stop DEBUG: Loading profile tuntap DEBUG: Configuring interface tap0 DEBUG: status reported to profile_down as: tuntap :: tuntap down [BUSY] DEBUG: Loading profile tuntap DEBUG: Configuring interface tap0 DEBUG: Loading profile tuntap DEBUG: Configuring interface tap0 DEBUG: ethernet_down if_down [DONE] DEBUG: Loading profile bridge1 DEBUG: Configuring interface br1 DEBUG: status reported to profile_down as: bridge1 :: bridge1 down [BUSY] DEBUG: Loading profile bridge1 DEBUG: Configuring interface br1 Cannot find device "tap0" <=== Error: This got destroy because tuntap shutdown first interface tap0 does not exist! <=== Error: This got destroy because tuntap shutdown first DEBUG: Loading profile bridge1 DEBUG: Configuring interface br1 DEBUG: ethernet_down if_down [DONE] To fix this so we have nice system shutdowns, and to support a common scenario where a profile(i.e. bridge) WILL refer to other multiple pre-existing interfaces. I suggest we shutdown our profiles in reverse order, just like its done when shutting down DAEMONS. This will help out many other use cases when interface dependencies across profiles are configured. (Since you store that order in the /run/network/net-profiles, we just leverage that.) Here is a diff -u: --- /tmp/net-profiles.orig 2012-03-27 13:33:47.157187167 -0500 +++ /tmp/net-profiles.fix 2012-03-27 13:38:24.387178529 -0500 @@ -70,9 +70,13 @@ # shutdown any profiles started by netcfg (or from NET_PROFILES in rc.conf) # JP: only attempt to disconnect the profiles _this daemon_ was told to control - while read profile; do - /usr/bin/netcfg2 down "$profile" - done < "$STATE_DIR/net-profiles" + # and do so in reverse order so that interfaces composing bridges can be desconstructed gracefully + running_profiles=(`cat "$STATE_DIR/net-profiles"`) + #echo "RUNNING PROFILES: ${running_profiles[*]}" + for (( i=${#running_profiles[@]}-1; i>=0; i-- )); do + running_profile=${running_profiles[i]#@} + /usr/bin/netcfg2 down "$running_profile" + done rm -f "$STATE_DIR/net-profiles" rm_daemon net-profiles ;; Note: This will help out other types of efforts, such as profiles that apply firewall scripts in the future. Since, you can't run iptables scripts or other firewall scripts until certain interfaces exist. Note: Yes, one must configure the NETWORKS=() list in the desired order, and since we do so in rc.conf DAEMONS, it makes it more intuitive for users to do the same. Note: Having bridges to support virtual machines and various advanced network configurations is increasingly common. ===========================================================NEW Behavior: /etc/rc.d/net-profiles start DEBUG: Loading profile tuntap DEBUG: Configuring interface tap0 :: tuntap up [BUSY] DEBUG: status reported to profile_up as: DEBUG: Loading profile tuntap DEBUG: Configuring interface tap0 DEBUG: Loading profile tuntap DEBUG: Configuring interface tap0 DEBUG: ethernet_iproute_up ifup > No connection [DONE] DEBUG: Loading profile bridge1 DEBUG: Configuring interface br1 :: bridge1 up [BUSY] DEBUG: status reported to profile_up as: DEBUG: Loading profile bridge1 DEBUG: Configuring interface br1 DEBUG: Loading profile bridge1 DEBUG: Configuring interface br1 DEBUG: ethernet_iproute_up ifup > No connection [DONE] [root@terra rc.d]# /etc/rc.d/net-profiles stop DEBUG: Loading profile bridge1 DEBUG: Configuring interface br1 DEBUG: status reported to profile_down as: bridge1 :: bridge1 down [BUSY] DEBUG: Loading profile bridge1 DEBUG: Configuring interface br1 DEBUG: Loading profile bridge1 DEBUG: Configuring interface br1 DEBUG: ethernet_down if_down [DONE] DEBUG: Loading profile tuntap DEBUG: Configuring interface tap0 DEBUG: status reported to profile_down as: tuntap :: tuntap down [BUSY] DEBUG: Loading profile tuntap DEBUG: Configuring interface tap0 DEBUG: Loading profile tuntap DEBUG: Configuring interface tap0 DEBUG: ethernet_down if_down [DONE] Fix: Clean deconstruction of bridge and its component interfaces. !!! |
This task depends upon
Closed by Jouke Witteveen (jouke)
Friday, 11 May 2012, 19:45 GMT
Reason for closing: Fixed
Additional comments about closing: I believe this was already fixed in the new net-profiles/netcfg-daemon logic.
Friday, 11 May 2012, 19:45 GMT
Reason for closing: Fixed
Additional comments about closing: I believe this was already fixed in the new net-profiles/netcfg-daemon logic.
0001-shutdown-netcfg-net-prof...
# shutdown any profiles started by netcfg (or from NET_PROFILES in rc.conf)
# JP: only attempt to disconnect the profiles _this daemon_ was told to control
- while read profile; do
+ # and do so in reverse order so that interfaces composing bridges can be desconstructed gracefully
+ tac "$STATE_DIR/net-profiles" | while read profile; do
/usr/bin/netcfg2 down "$profile"
- done < "$STATE_DIR/net-profiles"
+ done
or something like that.
Also seems to work faster, the bash array approach doesn't seem to finish running in any reasonable time on large files in my testing (woe to the person who runs 20K+ network profiles at once, though ;)