summaryrefslogtreecommitdiffstats
path: root/src/lib/connections/bond
blob: 099e44c07a46d7f756c852c8eeb194e8ce2c9636 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Contributed by: Byron Williams <byron@112percent.com>

. "$SUBR_DIR/ip"

: ${IFENSLAVE:=ifenslave}
: ${BindsToInterfaces=}

bond_up() {
    if is_interface "$Interface"; then
        report_error "Interface '$Interface' already exists"
        return 1
    else
        ip link add dev "$Interface" type bond
    fi
    bring_interface_up "$Interface"

    for slave in "${BindsToInterfaces[@]}"; do
        bring_interface_up "$slave"
        $IFENSLAVE "$Interface" "$slave"
    done

    ip_set
}

bond_down() {
    for slave in "${BindsToInterfaces[@]}"; do
        $IFENSLAVE "$Interface" -d "$slave"
    done

    ip_unset
    bring_interface_down "$Interface"
    ip link delete "$Interface"
}


# vim: ft=sh ts=4 et sw=4: