View | Details | Raw Unified
Collapse All | Expand All

(-) net.Linux/iproute2.sh (-1 / +11 lines)
 Lines 43-48    Link Here 
	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/wireless
	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/wireless
}
}
_set_flag() {
	local flag=$1 opt="on"
	if [ "${flag#-}" != "${flag}" ]; then
		flag=${flag#-}
		opt="off"
	fi
	ip link set "${IFACE}" "${flag}" "${opt}"
}
_get_mac_address() {
_get_mac_address() {
	local mac=$(LC_ALL=C ip link show "${IFACE}" | sed -n \
	local mac=$(LC_ALL=C ip link show "${IFACE}" | sed -n \
		-e 'y/abcdef/ABCDEF/' \
		-e 'y/abcdef/ABCDEF/' \
 Lines 181-187    Link Here 
}
}
iproute2_post_start() {
iproute2_post_start() {
	ip route flush table cache dev "${IFACE}"
	# Kernel may not have tcp built in
	[ -e /proc/net/route ] && ip route flush table cache dev "${IFACE}"
}
}
iproute2_post_stop() {
iproute2_post_stop() {
(-) net.Linux/ifconfig.sh (+4 lines)
 Lines 42-47    Link Here 
	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/wireless
	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/wireless
}
}
_set_flag() {
	ifconfig "${IFACE}" "$1"
}
_get_mac_address() {
_get_mac_address() {
	local mac=$(LC_ALL=C ifconfig "${IFACE}" | \
	local mac=$(LC_ALL=C ifconfig "${IFACE}" | \
	sed -n -e 's/.* HWaddr \(..:..:..:..:..:..\).*/\1/p')
	sed -n -e 's/.* HWaddr \(..:..:..:..:..:..\).*/\1/p')
(-) net.Linux/bridge.sh (-11 / +15 lines)
 Lines 33-39    Link Here 
	if ! _is_bridge; then
	if ! _is_bridge; then
		ebegin "Creating bridge ${IFACE}"
		ebegin "Creating bridge ${IFACE}"
		if ! brctl addbr "${IFACE}" ; then
		if ! brctl addbr "${IFACE}"; then
			eend 1
			eend 1
			return 1
			return 1
		fi
		fi
 Lines 50-64    Link Here 
	done
	done
	unset IFS
	unset IFS
	if [ -n "${ports}" ] ; then
	if [ -n "${ports}" ]; then
		einfo "Adding ports to ${IFACE}"
		einfo "Adding ports to ${IFACE}"
		eindent
		eindent
		for x in ${ports}; do
		for x in ${ports}; do
			ebegin "${x}"
			ebegin "${x}"
			ifconfig "${x}" promisc up
			local OIFACE="${IFACE}"
			if ! brctl addif "${IFACE}" "${x}" ; then
			local IFACE="${x}"
				ifconfig "${x}" -promisc 2>/dev/null
			_set_flag promisc
			_up
			if ! brctl addif "${OIFACE}" "${x}"; then
				_set_flag -promisc
				eend 1
				eend 1
				return 1
				return 1
			fi
			fi
 Lines 78-84    Link Here 
	if _is_bridge ; then
	if _is_bridge ; then
		ebegin "Destroying bridge ${IFACE}"
		ebegin "Destroying bridge ${IFACE}"
		_down
		_down
		ports="$( brctl show 2>/dev/null | \
		ports="$(brctl show 2>/dev/null | \
			sed -n -e '/^'"${IFACE}"'[[:space:]]/,/^\S/ { /^\('"${IFACE}"'[[:space:]]\|\t\)/s/^.*\t//p }')"
			sed -n -e '/^'"${IFACE}"'[[:space:]]/,/^\S/ { /^\('"${IFACE}"'[[:space:]]\|\t\)/s/^.*\t//p }')"
		delete=true
		delete=true
		iface=${IFACE}
		iface=${IFACE}
 Lines 87-95    Link Here 
		# Work out if we're added to a bridge for removal or not
		# Work out if we're added to a bridge for removal or not
		eval set -- $(brctl show 2>/dev/null | sed -e "s/'/'\\\\''/g" -e "s/$/'/g" -e "s/^/'/g")
		eval set -- $(brctl show 2>/dev/null | sed -e "s/'/'\\\\''/g" -e "s/$/'/g" -e "s/^/'/g")
		local line=
		local line=
		for line in "$@" ; do
		for line in "$@"; do
			set -- ${line}
			set -- ${line}
			if [ "$3" = "${IFACE}" ] ; then
			if [ "$3" = "${IFACE}" ]; then
				iface=$1
				iface=$1
				break
				break
			fi
			fi
 Lines 98-111    Link Here 
		extra=" from ${iface}"
		extra=" from ${iface}"
	fi
	fi
	for port in ${ports} ; do
	for port in ${ports}; do
		ebegin "Removing port ${port}${extra}"
		ebegin "Removing port ${port}${extra}"
		ifconfig "${port}" -promisc
		local IFACE="${port}"
		_set_flag -promisc
		brctl delif "${iface}" "${port}"
		brctl delif "${iface}" "${port}"
		eend $?
		eend $?
	done
	done
	if ${delete} ; then
	if ${delete}; then
		eoutdent
		eoutdent
		brctl delbr "${iface}"
		brctl delbr "${iface}"
		eend $?
		eend $?
(-) sh/net.sh (-3 / +5 lines)
 Lines 349-355    Link Here 
	local fallback="$(_get_array fallback_${IFVAR})"
	local fallback="$(_get_array fallback_${IFVAR})"
	if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] ; then
	if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] ; then
		config="127.0.0.1/8
		[ "${config}" != "null" ] && config="127.0.0.1/8
${config}"
${config}"
	else
	else
		if [ -z "${config}" ] ; then
		if [ -z "${config}" ] ; then
 Lines 495-503    Link Here 
	local hidefirstroute=false first=true
	local hidefirstroute=false first=true
	local routes="$(_get_array "routes_${IFVAR}")"
	local routes="$(_get_array "routes_${IFVAR}")"
	if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] ; then
	if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] ; then
		routes="127.0.0.0/8 via 127.0.0.1
		if [ "${config_0}" != "null" ]; then
			routes="127.0.0.0/8 via 127.0.0.1
${routes}"
${routes}"
		hidefirstroute=true
			hidefirstroute=true
		fi
	fi
	fi
	local IFS="$__IFS"
	local IFS="$__IFS"
	for cmd in ${routes}; do
	for cmd in ${routes}; do