2
# Copyright (c) 2005 XenSource Ltd.
4
# This library is free software; you can redistribute it and/or
5
# modify it under the terms of version 2.1 of the GNU Lesser General Public
6
# License as published by the Free Software Foundation.
8
# This library is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
# Lesser General Public License for more details.
13
# You should have received a copy of the GNU Lesser General Public
14
# License along with this library; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
# Gentoo doesn't have ifup/ifdown, so we define appropriate alternatives.
21
# Other platforms just use ifup / ifdown directly.
26
# @param $1 The current name for the physical device, which is also the name
27
# that the virtual device will take once the physical device has
30
if ! which ifup >/dev/null 2>/dev/null
66
find_dhcpd_conf_file()
68
first_file -f /etc/dhcp3/dhcpd.conf /etc/dhcpd.conf
72
find_dhcpd_init_file()
74
first_file -x /etc/init.d/{dhcp3-server,dhcp,dhcpd}
79
first_file -f /etc/sysconfig/dhcpd /etc/defaults/dhcp /etc/default/dhcp3-server
82
# configure interfaces which act as pure bridge ports:
86
# take interface down ...
87
ip link set ${dev} down
89
# ... and configure it
93
# Usage: create_bridge bridge
97
# Don't create the bridge if it already exists.
98
if [ ! -e "/sys/class/net/${bridge}/bridge" ]; then
100
brctl stp ${bridge} off
101
brctl setfd ${bridge} 0
105
# Usage: add_to_bridge bridge dev
110
# Don't add $dev to $bridge if it's already on a bridge.
111
if [ -e "/sys/class/net/${bridge}/brif/${dev}" ]; then
112
ip link set ${dev} up || true
115
brctl addif ${bridge} ${dev}
116
ip link set ${dev} up