Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 588810 | Differences between
and this patch

Collapse All | Expand All

(-)a/net/bridge.sh (-3 / +31 lines)
Lines 4-10 Link Here
4
bridge_depend()
4
bridge_depend()
5
{
5
{
6
	before interface macnet
6
	before interface macnet
7
	program brctl
7
	program brctl ip
8
}
8
}
9
9
10
_config_vars="$_config_vars bridge bridge_add brctl"
10
_config_vars="$_config_vars bridge bridge_add brctl"
Lines 29-34 _bridge_ports() Link Here
29
	done
29
	done
30
}
30
}
31
31
32
_do_ip()
33
{
34
	! type brctl >/dev/null 2>&1
35
}
36
32
bridge_pre_start()
37
bridge_pre_start()
33
{
38
{
34
	local brif= oiface="${IFACE}" e= x=
39
	local brif= oiface="${IFACE}" e= x=
Lines 70-76 bridge_pre_start() Link Here
70
75
71
	if ! _is_bridge ; then
76
	if ! _is_bridge ; then
72
		ebegin "Creating bridge ${IFACE}"
77
		ebegin "Creating bridge ${IFACE}"
73
		if ! brctl addbr "${IFACE}"; then
78
		# "ip" is alternative way to manage bridges
79
		# and even single way to set MTU for it (for now).
80
		local mtu=
81
		eval mtu=\$mtu_${IFVAR}
82
		if [ -n "$mtu" ] || _do_ip; then
83
			if ! ip link add name "${IFACE}" ${mtu:+mtu "$mtu"} type bridge; then
84
				eend 1
85
				return 1
86
			fi
87
		elif ! brctl addbr "${IFACE}"; then
74
			eend 1
88
			eend 1
75
			return 1
89
			return 1
76
		fi
90
		fi
Lines 120-126 bridge_pre_start() Link Here
120
			fi
134
			fi
121
			# The interface is known to exist now
135
			# The interface is known to exist now
122
			_up
136
			_up
123
			if ! brctl addif "${BR_IFACE}" "${x}"; then
137
			if _do_ip; then
138
				ip link set eth0 up
139
				if ! ip link set "${x}" master "${BR_IFACE}"; then
140
					eend 1
141
					return 1
142
				fi
143
			elif ! brctl addif "${BR_IFACE}" "${x}"; then
124
				eend 1
144
				eend 1
125
				return 1
145
				return 1
126
			fi
146
			fi
Lines 176-187 bridge_post_stop() Link Here
176
		ebegin "Removing port ${port}${extra}"
196
		ebegin "Removing port ${port}${extra}"
177
		local IFACE="${port}"
197
		local IFACE="${port}"
178
		_set_flag -promisc
198
		_set_flag -promisc
199
		if _do_ip; then
200
			ip link set "${port}" nomaster
201
			eend $?
202
		fi
179
		brctl delif "${iface}" "${port}"
203
		brctl delif "${iface}" "${port}"
180
		eend $?
204
		eend $?
181
	done
205
	done
182
206
183
	if ${delete}; then
207
	if ${delete}; then
184
		eoutdent
208
		eoutdent
209
		if _do_ip; then
210
			ip link delete "${iface}" type bridge
211
			eend $?
212
		fi
185
		brctl delbr "${iface}"
213
		brctl delbr "${iface}"
186
		eend $?
214
		eend $?
187
	fi
215
	fi

Return to bug 588810