]>
git.ipfire.org Git - people/arne_f/network.git/blob - functions.bonding
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2010 Michael Tremer & Christian Schmidt #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 function bonding_create
() {
26 [ -z "${mac}" ] && mac
=$
(mac_generate
)
28 log INFO
"Creating bonding device '${device}' (${mac})."
30 echo "+${device}" > /sys
/class
/net
/bonding_masters
31 device_set_address
${mac}
32 device_set_up
${device}
35 function bonding_remove
() {
36 local device
=$
(devicify
${1})
38 log INFO
"Remove bonding device '${device}'."
40 device_set_down
${device}
41 echo "-${device}" > /sys
/class
/net
/bonding_masters
44 function bonding_set_mode
() {
48 log INFO
"Setting bonding mode on '${device}' '${mode}'."
50 echo "${mode}" > /sys
/class
/net
/${device}/bonding
/mode
53 function bonding_enslave_device
() {
54 local device
=$
(devicify
${1})
55 local slave
=$
(devicify
${2})
58 log INFO
"Enslaving slave '${slave}' to '${device}'."
60 device_set_down
${slave}
61 echo "+${slave}" > /sys
/class
/net
/${device}/bonding
/slaves