core: 设置网络时过滤 azure vf

This commit is contained in:
bin456789 2024-08-11 22:49:59 +08:00
parent 78d2454327
commit d2d6049bbd
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -25,10 +25,13 @@ fi
# debian 11 initrd 没有 xargs awk
# debian 12 initrd 没有 xargs
get_ethx() {
# 过滤 azure vf (带 master ethx)
# 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000\ link/ether 60:45:bd:21:8a:51 brd ff:ff:ff:ff:ff:ff
# 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP800> mtu 1500 qdisc mq master eth0 state UP qlen 1000\ link/ether 60:45:bd:21:8a:51 brd ff:ff:ff
if false; then
ip -o link | grep -i "$mac_addr" | awk '{print $2}' | cut -d: -f1
ip -o link | grep -i "$mac_addr" | grep -v master | awk '{print $2}' | cut -d: -f1
else
ip -o link | grep -i "$mac_addr" | cut -d' ' -f2 | cut -d: -f1
ip -o link | grep -i "$mac_addr" | grep -v master | cut -d' ' -f2 | cut -d: -f1
fi
}