Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) #!/bin/bash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) lib_dir=$(dirname $0)/forwarding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) ALL_TESTS="altnames_test"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) NUM_NETIFS=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) source $lib_dir/lib.sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) DUMMY_DEV=dummytest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) SHORT_NAME=shortname
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) LONG_NAME=someveryveryveryveryveryverylongname
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) altnames_test()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	RET=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	local output
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	local name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	ip link property add $DUMMY_DEV altname $SHORT_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	check_err $? "Failed to add short alternative name"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	output=$(ip -j -p link show $SHORT_NAME)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	check_err $? "Failed to do link show with short alternative name"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	name=$(echo $output | jq -e -r ".[0].altnames[0]")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	check_err $? "Failed to get short alternative name from link show JSON"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	[ "$name" == "$SHORT_NAME" ]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	check_err $? "Got unexpected short alternative name from link show JSON"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	ip -j -p link show $DUMMY_DEV &>/dev/null
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	check_err $? "Failed to do link show with original name"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	ip link property add $DUMMY_DEV altname $LONG_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	check_err $? "Failed to add long alternative name"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	output=$(ip -j -p link show $LONG_NAME)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	check_err $? "Failed to do link show with long alternative name"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	name=$(echo $output | jq -e -r ".[0].altnames[1]")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	check_err $? "Failed to get long alternative name from link show JSON"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	[ "$name" == "$LONG_NAME" ]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	check_err $? "Got unexpected long alternative name from link show JSON"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	ip link property del $DUMMY_DEV altname $SHORT_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	check_err $? "Failed to delete short alternative name"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	ip -j -p link show $SHORT_NAME &>/dev/null
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	check_fail $? "Unexpected success while trying to do link show with deleted short alternative name"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	# long name is left there on purpose to be removed alongside the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	log_test "altnames test"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) setup_prepare()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	ip link add name $DUMMY_DEV type dummy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) cleanup()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	pre_cleanup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	ip link del name $DUMMY_DEV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) trap cleanup EXIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) setup_prepare
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) tests_run
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) exit $EXIT_STATUS