__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

lib_dir=$(dirname $0)/../../../net/forwarding

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

BUS_ADDR=10
PORT_COUNT=4
DEV_NAME=netdevsim$BUS_ADDR
SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV_NAME/net/
DL_HANDLE=netdevsim/$DEV_NAME
NETNS_NAME=testns1

port_netdev_get()
{
	local port_index=$1

	cmd_jq "devlink -N $NETNS_NAME port show -j" \
	       ".[][\"$DL_HANDLE/$port_index\"].netdev" "-e"
}

check_ports_test()
{
	RET=0

	for i in $(seq 0 $(expr $PORT_COUNT - 1)); do
		netdev_name=$(port_netdev_get $i)
		check_err $? "Failed to get netdev name for port $DL_HANDLE/$i"
		ip -n $NETNS_NAME link show $netdev_name &> /dev/null
		check_err $? "Failed to find netdev $netdev_name"
	done

	log_test "check ports test"
}

check_devlink_test()
{
	RET=0

	devlink -N $NETNS_NAME dev show $DL_HANDLE &> /dev/null
	check_err $? "Failed to show devlink instance"

	log_test "check devlink test"
}

setup_prepare()
{
	modprobe netdevsim
	ip netns add $NETNS_NAME
	ip netns exec $NETNS_NAME \
		echo "$BUS_ADDR $PORT_COUNT" > /sys/bus/netdevsim/new_device
	while [ ! -d $SYSFS_NET_DIR ] ; do :; done
}

cleanup()
{
	pre_cleanup
	echo "$BUS_ADDR" > /sys/bus/netdevsim/del_device
	ip netns del $NETNS_NAME
	modprobe -r netdevsim
}

trap cleanup EXIT

setup_prepare

tests_run

exit $EXIT_STATUS

Filemanager

Name Type Size Permission Actions
Makefile File 396 B 0644
devlink.sh File 19.29 KB 0755
devlink_in_netns.sh File 1.34 KB 0755
devlink_trap.sh File 12.62 KB 0755
ethtool-coalesce.sh File 3.19 KB 0755
ethtool-common.sh File 1.06 KB 0644
ethtool-features.sh File 665 B 0644
ethtool-fec.sh File 3.1 KB 0755
ethtool-pause.sh File 1.27 KB 0755
ethtool-ring.sh File 1.79 KB 0755
fib.sh File 7.54 KB 0755
fib_notifications.sh File 10.13 KB 0755
hw_stats_l3.sh File 9.16 KB 0755
macsec-offload.sh File 2.84 KB 0755
nexthop.sh File 26.37 KB 0755
peer.sh File 3.26 KB 0755
psample.sh File 4.02 KB 0755
tc-mq-visibility.sh File 1.64 KB 0755
udp_tunnel_nic.sh File 20.27 KB 0755
Filemanager