PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /usr/local/bin/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //usr/local/bin/i40e-lldp-switch

#!/bin/bash
# script to disable hardware lldp on intel x710 NICs
# ref: T3O2-5773

if ! command -v lspci &>/dev/null; then
    echo "lspci not found - unable to check for Intel Ethernet Controller X710"
    exit 1
fi

if ! lspci | grep -q "Intel Corporation Ethernet Controller X710"; then
    echo "Intel Ethernet Controller X710 not found"
    exit 0 # no action required
fi

devs=$(lspci | grep "Intel Corporation Ethernet Controller X710" | awk '{print $1}')

if [[ ! -d /sys/module/i40e ]]; then
    echo "i40e module not loaded"
    exit 1
fi

iface_arr=()
# Read eth device names
for iface in /sys/class/net/*; do
    path=$(readlink "$iface")
    for dev in $devs; do
        if echo "$path" | grep -q "${dev}/net/"; then
            iface=$(basename "$path")
            iface_arr+=("${iface}")
            break
        fi
    done
done

# Finally loop ethtool
for iface in "${iface_arr[@]}"; do
    setting=$(ethtool --show-priv-flags "$iface" | grep lldp)
    if [[ -n "$1" ]] && [[ $iface != "$1" ]]; then
        # skip if arg1 selects an interface
        continue;
    fi 
    if echo "$setting" | grep -q off; then
        echo "Updating $iface"
        ethtool --set-priv-flags "$iface" disable-fw-lldp on
    else
        echo "disable-fw-lldp already enabled"
    fi
done