aboutsummaryrefslogtreecommitdiffstats
path: root/setup-interfaces.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-06-21 13:23:25 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-06-21 13:23:25 +0000
commitcda38306b4d0b5ea34ad529455bd8a423ef502e6 (patch)
treefcae44ec973cd01f44974c4c80a7839bf74ab9ae /setup-interfaces.in
parentda1c649e0d2d9c2308274d8056d5f88b154427a9 (diff)
downloadalpine-conf-cda38306b4d0b5ea34ad529455bd8a423ef502e6.tar.bz2
alpine-conf-cda38306b4d0b5ea34ad529455bd8a423ef502e6.tar.xz
setup-interfaces: allow setting up vlans on top of bonding
Handle case when user enters vlan on top of bond (i.e bond0.8) In this case we first set up the bond interface with default address to "none" and then afterwards we set up the vlan interface.
Diffstat (limited to 'setup-interfaces.in')
-rwxr-xr-xsetup-interfaces.in13
1 files changed, 11 insertions, 2 deletions
diff --git a/setup-interfaces.in b/setup-interfaces.in
index 083cf03..c4ffa47 100755
--- a/setup-interfaces.in
+++ b/setup-interfaces.in
@@ -116,6 +116,7 @@ is_bridge() {
config_iface() {
local iface=$1
local prefix=$2
+ local default_address=$3
local address= netmask= gateway= bridge_ports=
local bridge
local conf=$prefix$iface.conf
@@ -152,7 +153,7 @@ config_iface() {
# we are no interested in the result, only error code, so
# we send result to /dev/null
while ! ipcalc -s -m $address >/dev/null 2>&1; do
- address=`get_default_addr $iface`
+ address=${default_address:-$(get_default_addr $iface)}
[ -z "$address" ] && address="dhcp"
ask "Ip address for $iface? (or 'dhcp', 'none', '?')" $address
address=$resp
@@ -323,7 +324,9 @@ config_vlan() {
return 0
;;
esac
- unconfigured_isin $raw_device && return 0
+ if unconfigured_isin $raw_device || is_bond_master $raw_device; then
+ return 0
+ fi
echo "$raw_device is not a valid raw device for $iface"
return 1
}
@@ -380,6 +383,12 @@ prompt_for_interfaces() {
'?') iface_help; continue;;
br[0-9]*|bridge[0-9]*|virbr[0-9]*)
config_bridge $iface || continue;;
+ bond[0-9]*.[0-9]*)
+ config_bond ${iface%.*} || continue
+ config_iface ${iface%.*} $(printf "%.3d~" $index) none
+ index=$(( $index + 1 ))
+ config_vlan $iface || continue
+ ;;
bond[0-9]*)
config_bond $iface || continue;;
*.[0-9]*|vlan[0-9]*)