mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Add interface additional latency settings
This commit is contained in:
		
							parent
							
								
									7a7bf1a7f4
								
							
						
					
					
						commit
						4d15174b5d
					
				
					 2 changed files with 20 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -23,8 +23,24 @@ omr_intf_set() {
 | 
			
		|||
	config_get ifname "$1" ifname
 | 
			
		||||
	config_get device "$1" device
 | 
			
		||||
	config_get proto "$1" proto
 | 
			
		||||
	config_get addlatency "$1" 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
 | 
			
		||||
			tc qdisc del dev ${ifname} root netem
 | 
			
		||||
		fi
 | 
			
		||||
		if [ "$addlatency" != "0" ]; then
 | 
			
		||||
			if [ "$(tc qdisc show $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
 | 
			
		||||
				tc qdisc replace dev ${ifname} root netem delay ${addlatency}ms
 | 
			
		||||
			fi
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if [ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -575,6 +575,10 @@ return view.extend({
 | 
			
		|||
				o.value('backup',_('Backup'));
 | 
			
		||||
				o.default = 'off';
 | 
			
		||||
 | 
			
		||||
				o = s.taboption('advanced', form.Value, 'addlatency', _('Additional latency'));
 | 
			
		||||
				o.datatype = 'uinteger';
 | 
			
		||||
				o.default = '0';
 | 
			
		||||
 | 
			
		||||
				if (L.hasSystemFeature('dnsmasq') || L.hasSystemFeature('odhcpd')) {
 | 
			
		||||
					o = s.taboption('dhcp', form.SectionValue, '_dhcp', form.TypedSection, 'dhcp');
 | 
			
		||||
					o.depends('proto', 'static');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue