403Webshell
Server IP : 13.213.54.232  /  Your IP : 216.73.216.72
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ip-172-31-17-110 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 7.1.33-67+ubuntu22.04.1+deb.sury.org+1
Disable Function : 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/self/root/lib/modules/6.8.0-1031-aws/build/tools/testing/selftests/bpf/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/lib/modules/6.8.0-1031-aws/build/tools/testing/selftests/bpf/test_xdp_features.sh
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

readonly NS="ns1-$(mktemp -u XXXXXX)"
readonly V0_IP4=10.10.0.11
readonly V1_IP4=10.10.0.1
readonly V0_IP6=2001:db8::11
readonly V1_IP6=2001:db8::1

ret=1

setup() {
	{
		ip netns add ${NS}

		ip link add v1 type veth peer name v0 netns ${NS}

		ip link set v1 up
		ip addr add $V1_IP4/24 dev v1
		ip addr add $V1_IP6/64 nodad dev v1
		ip -n ${NS} link set dev v0 up
		ip -n ${NS} addr add $V0_IP4/24 dev v0
		ip -n ${NS} addr add $V0_IP6/64 nodad dev v0

		# Enable XDP mode and disable checksum offload
		ethtool -K v1 gro on
		ethtool -K v1 tx-checksumming off
		ip netns exec ${NS} ethtool -K v0 gro on
		ip netns exec ${NS} ethtool -K v0 tx-checksumming off
	} > /dev/null 2>&1
}

cleanup() {
	ip link del v1 2> /dev/null
	ip netns del ${NS} 2> /dev/null
	[ "$(pidof xdp_features)" = "" ] || kill $(pidof xdp_features) 2> /dev/null
}

wait_for_dut_server() {
	while sleep 1; do
		ss -tlp | grep -q xdp_features
		[ $? -eq 0 ] && break
	done
}

test_xdp_features() {
	setup

	## XDP_PASS
	./xdp_features -f XDP_PASS -D $V1_IP6 -T $V0_IP6 v1 &
	wait_for_dut_server
	ip netns exec ${NS} ./xdp_features -t -f XDP_PASS \
					   -D $V1_IP6 -C $V1_IP6 \
					   -T $V0_IP6 v0
	[ $? -ne 0 ] && exit

	## XDP_DROP
	./xdp_features -f XDP_DROP -D ::ffff:$V1_IP4 -T ::ffff:$V0_IP4 v1 &
	wait_for_dut_server
	ip netns exec ${NS} ./xdp_features -t -f XDP_DROP \
					   -D ::ffff:$V1_IP4 \
					   -C ::ffff:$V1_IP4 \
					   -T ::ffff:$V0_IP4 v0
	[ $? -ne 0 ] && exit

	## XDP_ABORTED
	./xdp_features -f XDP_ABORTED -D $V1_IP6 -T $V0_IP6 v1 &
	wait_for_dut_server
	ip netns exec ${NS} ./xdp_features -t -f XDP_ABORTED \
					   -D $V1_IP6 -C $V1_IP6 \
					   -T $V0_IP6 v0
	[ $? -ne 0 ] && exit

	## XDP_TX
	./xdp_features -f XDP_TX -D ::ffff:$V1_IP4 -T ::ffff:$V0_IP4 v1 &
	wait_for_dut_server
	ip netns exec ${NS} ./xdp_features -t -f XDP_TX \
					   -D ::ffff:$V1_IP4 \
					   -C ::ffff:$V1_IP4 \
					   -T ::ffff:$V0_IP4 v0
	[ $? -ne 0 ] && exit

	## XDP_REDIRECT
	./xdp_features -f XDP_REDIRECT -D $V1_IP6 -T $V0_IP6 v1 &
	wait_for_dut_server
	ip netns exec ${NS} ./xdp_features -t -f XDP_REDIRECT \
					   -D $V1_IP6 -C $V1_IP6 \
					   -T $V0_IP6 v0
	[ $? -ne 0 ] && exit

	## XDP_NDO_XMIT
	./xdp_features -f XDP_NDO_XMIT -D ::ffff:$V1_IP4 -T ::ffff:$V0_IP4 v1 &
	wait_for_dut_server
	ip netns exec ${NS} ./xdp_features -t -f XDP_NDO_XMIT \
					   -D ::ffff:$V1_IP4 \
					   -C ::ffff:$V1_IP4 \
					   -T ::ffff:$V0_IP4 v0
	ret=$?
	cleanup
}

set -e
trap cleanup 2 3 6 9

test_xdp_features

exit $ret

Youez - 2016 - github.com/yon3zu
LinuXploit