summaryrefslogtreecommitdiffstats
path: root/src/lib/connections/bond
blob: 64b028560d8239a6a4d8474f8ac6205bb830cd3d (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
# Contributed by: andy123 <ajs@online.de>

. "$SUBR_DIR/ip"

# Make sure BindsToInterfaces is set
BindsToInterfaces=("${BindsToInterfaces[@]}")

bond_up() {
    if is_interface "$Interface"; then
        report_error "Interface '$Interface' already exists"
        return 1
    fi

    interface_add bond "$Interface" "" ${Mode:+mode "$Mode"}
    bring_interface_up "$Interface"
    for slave in "${BindsToInterfaces[@]}"; do
        ip link set dev "$slave" master "$Interface"
    done

    ip_set
}

bond_down() {
    for slave in "${BindsToInterfaces[@]}"; do
        ip link set dev "$slave" nomaster
    done

    ip_unset
    interface_delete "$Interface"
}


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