Ignore:
Timestamp:
2011-09-24T22:34:17+02:00 (5 years ago)
Author:
nbd
Message:

base-files: apply network interface settings such as macaddr, mtu and txqueuelen in prepare_interface instead of setup_interface. setting the mtu after the interface is up is unreliable on some drivers such as gianfar

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/base-files/files/lib/network/config.sh

    r28291 r28297  
    153153        local iface="$1" 
    154154        local config="$2" 
    155         local vifmac="$3" 
     155        local macaddr="$3" 
    156156 
    157157        # if we're called for the bridge interface itself, don't bother trying 
     
    167167                # (deconfigured only if the interface is not set to proto=none) 
    168168                unbridge "$iface" 
     169 
     170                local mtu macaddr txqueuelen 
     171                config_get mtu "$config" mtu 
     172                [ -n "$macaddr" ] || config_get macaddr "$config" macaddr 
     173                config_get txqueuelen "$config" txqueuelen 
     174                [ -n "$macaddr" ] && $DEBUG ifconfig "$iface" down 
     175                $DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} ${txqueuelen:+txqueuelen $txqueuelen} up 
     176 
    169177                [ "$proto" = none ] || ifconfig "$iface" 0.0.0.0 
    170  
    171                 # Change interface MAC address if requested 
    172                 [ -n "$vifmac" ] && { 
    173                         ifconfig "$iface" down 
    174                         ifconfig "$iface" hw ether "$vifmac" up 
    175                 } 
    176178 
    177179                # Apply sysctl settings 
     
    351353 
    352354        # Interface settings 
    353         grep -qE "^ *$iface:" /proc/net/dev && { 
    354                 local mtu macaddr txqueuelen 
    355                 config_get mtu "$config" mtu 
    356                 config_get macaddr "$config" macaddr 
    357                 config_get txqueuelen "$config" txqueuelen 
    358                 [ -n "$macaddr" ] && $DEBUG ifconfig "$iface" down 
    359                 $DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} ${txqueuelen:+txqueuelen $txqueuelen} up 
    360         } 
    361355        set_interface_ifname "$config" "$iface" 
    362356 
Note: See TracChangeset for help on using the changeset viewer.