aboutsummaryrefslogtreecommitdiff
path: root/bridge/init/bridge
blob: 9cae7e40778e84458c6de68f45a9d785c7e500a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/sbin/openrc-run
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

start() {
	# Add bridge interface
	if ! ip link list bridge 2>/dev/null >&2; then
		ip link add name bridge type bridge
	fi
	# Set bridge up
	ip link set bridge up
	# Set ip address
	if [ -z "$(ip addr show dev bridge to 192.168.30.1)" ]; then
		ip addr add 192.168.30.1/24 dev vbr0
	fi
}

stop() {
	if ip link list bridge 2>/dev/null >&2; then
		ip link del dev bridge
	fi
}