mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	selftests: mptcp: add a test for mptcp_diag_dump_one
This patch introduces a new 'chk_diag' test in diag.sh. It retrieves the token for a specified MPTCP socket (msk) using the 'ss' command and then accesses the 'mptcp_diag_dump_one' in kernel via ./mptcp_diag to verify if the correct token is returned. Link: https://github.com/multipath-tcp/mptcp_net-next/issues/524 Signed-off-by: Gang Yan <yangang@kylinos.cn> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20250228-net-next-mptcp-coverage-small-opti-v1-2-f933c4275676@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
		
							parent
							
								
									00f5e338cf
								
							
						
					
					
						commit
						ba24001665
					
				
					 1 changed files with 27 additions and 0 deletions
				
			
		| 
						 | 
					@ -200,6 +200,32 @@ chk_msk_cestab()
 | 
				
			||||||
		 "${expected}" "${msg}" ""
 | 
							 "${expected}" "${msg}" ""
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					chk_dump_one()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						local ss_token
 | 
				
			||||||
 | 
						local token
 | 
				
			||||||
 | 
						local msg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ss_token="$(ss -inmHMN $ns | grep 'token:' |\
 | 
				
			||||||
 | 
							    head -n 1 |\
 | 
				
			||||||
 | 
							    sed 's/.*token:\([0-9a-f]*\).*/\1/')"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						token="$(ip netns exec $ns ./mptcp_diag -t $ss_token |\
 | 
				
			||||||
 | 
							 awk -F':[ \t]+' '/^token/ {print $2}')"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						msg="....chk dump_one"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						mptcp_lib_print_title "$msg"
 | 
				
			||||||
 | 
						if [ -n "$ss_token" ] && [ "$ss_token" = "$token" ]; then
 | 
				
			||||||
 | 
							mptcp_lib_pr_ok
 | 
				
			||||||
 | 
							mptcp_lib_result_pass "${msg}"
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							mptcp_lib_pr_fail "expected $ss_token found $token"
 | 
				
			||||||
 | 
							mptcp_lib_result_fail "${msg}"
 | 
				
			||||||
 | 
							ret=${KSFT_FAIL}
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msk_info_get_value()
 | 
					msk_info_get_value()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	local port="${1}"
 | 
						local port="${1}"
 | 
				
			||||||
| 
						 | 
					@ -290,6 +316,7 @@ chk_msk_remote_key_nr 2 "....chk remote_key"
 | 
				
			||||||
chk_msk_fallback_nr 0 "....chk no fallback"
 | 
					chk_msk_fallback_nr 0 "....chk no fallback"
 | 
				
			||||||
chk_msk_inuse 2
 | 
					chk_msk_inuse 2
 | 
				
			||||||
chk_msk_cestab 2
 | 
					chk_msk_cestab 2
 | 
				
			||||||
 | 
					chk_dump_one
 | 
				
			||||||
flush_pids
 | 
					flush_pids
 | 
				
			||||||
 | 
					
 | 
				
			||||||
chk_msk_inuse 0 "2->0"
 | 
					chk_msk_inuse 0 "2->0"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue