mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	selftests: pmtu: Factor out MTU parsing helper
...so that it can be used for any iproute command output. Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									822d2f86c4
								
							
						
					
					
						commit
						f2c929feec
					
				
					 1 changed files with 11 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -97,6 +97,16 @@ mtu() {
 | 
			
		|||
	${ns_cmd} ip link set dev ${dev} mtu ${mtu}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
mtu_parse() {
 | 
			
		||||
	input="${1}"
 | 
			
		||||
 | 
			
		||||
	next=0
 | 
			
		||||
	for i in ${input}; do
 | 
			
		||||
		[ ${next} -eq 1 ] && echo "${i}" && return
 | 
			
		||||
		[ "${i}" = "mtu" ] && next=1
 | 
			
		||||
	done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
route_get_dst_exception() {
 | 
			
		||||
	ns_cmd="${1}"
 | 
			
		||||
	dst="${2}"
 | 
			
		||||
| 
						 | 
				
			
			@ -108,12 +118,7 @@ route_get_dst_pmtu_from_exception() {
 | 
			
		|||
	ns_cmd="${1}"
 | 
			
		||||
	dst="${2}"
 | 
			
		||||
 | 
			
		||||
	exception="$(route_get_dst_exception "${ns_cmd}" ${dst})"
 | 
			
		||||
	next=0
 | 
			
		||||
	for i in ${exception}; do
 | 
			
		||||
		[ ${next} -eq 1 ] && echo "${i}" && return
 | 
			
		||||
		[ "${i}" = "mtu" ] && next=1
 | 
			
		||||
	done
 | 
			
		||||
	mtu_parse "$(route_get_dst_exception "${ns_cmd}" ${dst})"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
test_pmtu_vti6_exception() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue