]>
git.ipfire.org Git - people/stevee/network.git/blob - hooks/zones/bridge.ports/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 .
/lib
/network
/header-port
24 HOOK_SETTINGS
="HOOK DEVICE_MAC DEVICE_NAME MODE SLAVES"
26 DEVICE_NAME
="bond0" # XXX DEVICE_NAME must be unique
27 DEVICE_MAC
=$
(mac_generate
)
30 assert isset DEVICE_MAC
31 assert ismac DEVICE_MAC
32 assert isset DEVICE_NAME
43 while [ $# -gt 0 ]; do
46 DEVICE_MAC
=${1#--mac=}
53 SLAVES
="${SLAVES} $(macify ${slave})"
56 warning
"Unknown argument '${1}'"
62 # Remove any whitespace
63 SLAVES
=$
(echo ${SLAVES})
67 config_write $
(zone_dir
${zone})/port.${HOOK}.$(device_hash ${DEVICE_MAC}) ${HOOK_SETTINGS}
76 config_read $
(zone_dir
${zone})/${port}
78 if ! device_exists $
(devicify
${DEVICE_MAC}); then
79 device_virtual_create
${DEVICE} ${DEVICE_VID} ${DEVICE_MAC}
82 local device
=$
(devicify
${DEVICE_MAC})
84 # Set same MTU to device that the bridge has got
85 device_set_mtu
${device} $
(device_get_mtu
${zone})
87 bridge_attach_device
${zone} ${device}