move two functions from broadcom.sh to /sbin/wifi
SVN-Revision: 5496
This commit is contained in:
		@@ -3,6 +3,38 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
. /etc/functions.sh
 | 
					. /etc/functions.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					find_net_config() {(
 | 
				
			||||||
 | 
						local vif="$1"
 | 
				
			||||||
 | 
						local cfg
 | 
				
			||||||
 | 
						local ifname
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						config_get cfg "$vif" network
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						[ -z "$cfg" ] && {
 | 
				
			||||||
 | 
							include /lib/network
 | 
				
			||||||
 | 
							scan_interfaces
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							config_get ifname "$vif" ifnamea
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							cfg="$(find_config "$ifname")"
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						[ -z "$cfg" ] && return 0
 | 
				
			||||||
 | 
						echo "$cfg"
 | 
				
			||||||
 | 
					)}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bridge_interface() {(
 | 
				
			||||||
 | 
						local cfg="$1"
 | 
				
			||||||
 | 
						[ -z "$cfg" ] && return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						include /lib/network
 | 
				
			||||||
 | 
						scan_interfaces
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						config_get iftype "$cfg" type
 | 
				
			||||||
 | 
						[ "$iftype" = bridge ] && config_get "$iftype" ifname
 | 
				
			||||||
 | 
					)}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wifi_up() {
 | 
					wifi_up() {
 | 
				
			||||||
	for device in ${2:-$DEVICES}; do (
 | 
						for device in ${2:-$DEVICES}; do (
 | 
				
			||||||
		config_get iftype "$device" type
 | 
							config_get iftype "$device" type
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,35 +1,5 @@
 | 
				
			|||||||
append DRIVERS "broadcom"
 | 
					append DRIVERS "broadcom"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
find_vif_config() {(
 | 
					 | 
				
			||||||
	local vif="$1"
 | 
					 | 
				
			||||||
	local cfg
 | 
					 | 
				
			||||||
	local ifname
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	config_get cfg "$vif" network
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	[ -z "$cfg" ] && {
 | 
					 | 
				
			||||||
		include /lib/network
 | 
					 | 
				
			||||||
		scan_interfaces
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		config_get ifname "$vif" ifnamea
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		cfg="$(find_config "$ifname")"
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	[ -z "$cfg" ] && return 0
 | 
					 | 
				
			||||||
	echo "$cfg"
 | 
					 | 
				
			||||||
)}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bridge_interface() {(
 | 
					 | 
				
			||||||
	local cfg="$1"
 | 
					 | 
				
			||||||
	[ -z "$cfg" ] && return 0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	include /lib/network
 | 
					 | 
				
			||||||
	scan_interfaces
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	config_get iftype "$cfg" type
 | 
					 | 
				
			||||||
	[ "$iftype" = bridge ] && config_get "$iftype" ifname
 | 
					 | 
				
			||||||
)}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
scan_broadcom() {
 | 
					scan_broadcom() {
 | 
				
			||||||
	local device="$1"
 | 
						local device="$1"
 | 
				
			||||||
	local wds=
 | 
						local wds=
 | 
				
			||||||
@@ -180,7 +150,7 @@ enable_broadcom() {
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		config_get ifname "$vif" ifname
 | 
							config_get ifname "$vif" ifname
 | 
				
			||||||
		append if_up "ifconfig $ifname up" ";$N"
 | 
							append if_up "ifconfig $ifname up" ";$N"
 | 
				
			||||||
		net_cfg="$(find_vif_config "$vif")"
 | 
							net_cfg="$(find_net_config "$vif")"
 | 
				
			||||||
		[ -z "$net_cfg" ] || {
 | 
							[ -z "$net_cfg" ] || {
 | 
				
			||||||
			bridge="$(bridge_interface "$net_cfg")"
 | 
								bridge="$(bridge_interface "$net_cfg")"
 | 
				
			||||||
			append if_up "start_net '$ifname' '$net_cfg'" ";$N"
 | 
								append if_up "start_net '$ifname' '$net_cfg'" ";$N"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user