mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Merge branch 'develop' into master
This commit is contained in:
		
						commit
						acb5ec1ff1
					
				
					 2 changed files with 9 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -23,25 +23,27 @@ omr_intf_set() {
 | 
			
		|||
	config_get ifname "$1" ifname
 | 
			
		||||
	config_get device "$1" device
 | 
			
		||||
	config_get proto "$1" proto
 | 
			
		||||
	config_get addlatency "$1" addlatency "0"
 | 
			
		||||
	config_get type "$1" type
 | 
			
		||||
	config_get addlatency "$1" addlatency
 | 
			
		||||
	[ -z "$addlatency" ] && addlatency=0
 | 
			
		||||
	devicename=$(echo "$device" | cut -d'/' -f3)
 | 
			
		||||
 | 
			
		||||
	[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
 | 
			
		||||
 | 
			
		||||
	if [ -n "$ifname" ]; then
 | 
			
		||||
		if [ "$addlatency" = "0" ] && [ "$(tc qdisc show $ifname | grep delay)" != "" ]; then
 | 
			
		||||
		if [ "$addlatency" = "0" ] && [ "$(tc qdisc show dev $ifname | grep delay)" != "" ]; then
 | 
			
		||||
			tc qdisc del dev ${ifname} root netem
 | 
			
		||||
		fi
 | 
			
		||||
		if [ "$addlatency" != "0" ]; then
 | 
			
		||||
			if [ "$(tc qdisc show $ifname | grep delay)" != "" ]; then
 | 
			
		||||
			if [ "$(tc qdisc show dev $ifname | grep delay)" != "" ]; then
 | 
			
		||||
				tc qdisc add dev ${ifname} root netem delay ${addlatency}ms
 | 
			
		||||
			elif [ "$(tc qdisc show $ifname | awk '/delay/ { print $10 }' | sed 's/ms//')" != "$addlatency" ]; then
 | 
			
		||||
			elif [ "$(tc qdisc show dev $ifname | awk '/delay/ { print $10 }' | sed 's/ms//')" != "$addlatency" ]; then
 | 
			
		||||
				tc qdisc replace dev ${ifname} root netem delay ${addlatency}ms
 | 
			
		||||
			fi
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if [ -n "$ifname" ] && [ -f /sys/class/net/${ifname}/device/uevent ]; then
 | 
			
		||||
	if [ "$type" != "macvlan" ] && [ -n "$ifname" ] && [ -f /sys/class/net/${ifname}/device/uevent ]; then
 | 
			
		||||
		devicepath=$(readlink -f /sys/class/net/${ifname})
 | 
			
		||||
		if [ -n "$devicepath" ] && [ "$(echo ${devicepath} | grep virtual)" = "" ]; then
 | 
			
		||||
			uci -q set network.$1.modalias="$(cat /sys/class/net/${ifname}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')"
 | 
			
		||||
| 
						 | 
				
			
			@ -50,7 +52,7 @@ omr_intf_set() {
 | 
			
		|||
			uci -q delete network.$1.device
 | 
			
		||||
			uci -q delete network.$1.modalias
 | 
			
		||||
		fi
 | 
			
		||||
	elif [ -n "$device" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ]; then
 | 
			
		||||
	elif [ "$type" != "macvlan" ] &&  [ -n "$device" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ]; then
 | 
			
		||||
		uci -q set network.$1.modalias="$(cat /sys/bus/usb-serial/devices/${devicename}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')"
 | 
			
		||||
		uci -q set network.$1.product="$(cat /sys/bus/usb-serial/devices/${devicename}/device/uevent | grep PRODUCT | cut -d '=' -f2 | tr -d '\n')"
 | 
			
		||||
	fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,6 +67,7 @@ _setup_interface() {
 | 
			
		|||
		[ -z "$(uci -q get network.$1.masterintf)" ] && uci -q set network.$1.masterintf=$(uci -q get network.$1_dev.ifname)
 | 
			
		||||
		[ -n "$(uci -q get network.$1.masterintf)" ] && uci -q set network.$1_dev.ifname=$(uci -q get network.$1.masterintf)
 | 
			
		||||
		[ -z "$(uci -q get network.$1.macaddr)" ] && uci -q set network.$1_dev.macaddr=$(uci -q get network.$1.macaddr)
 | 
			
		||||
		uci set network.$1.ifname=$1
 | 
			
		||||
		uci -q commit network
 | 
			
		||||
		return 0
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue