电缆断开时网络链接丢失

电缆断开时网络链接丢失

背景:

oDroid XU4 上的 ArchlinuxARM 带有内置 NIC 和 USB 以太网加密狗。

问题:

当以太网电缆与 USB 适配器断开连接时,以太网 USB 设备将从系统树中掉线,并且在重新连接以太网电缆时不会重新连接。USB 端口本身仍然存在,子系统链接回 USB 总线设备而不是网络设备。该ip link命令还反映了网络接口的丢失,直到 USB 适配器本身与系统断开连接,然后重新连接到系统。通用设备udevadm —-trigger不会重新识别网络设备。

例如:

# When the USB dongle is connected and there is a carrier…
> udevadm trigger —verbose —sysname-match=“eth1”
/sys/devices/platform/soc/soc:usb3-0/12000000.usb/xhci-hcd.8.auto/usb4/4-1/4-1.2/4-1.2:2.0/net/eth1
# Try to disable auto power control
> sudo echo -ne “on” | tee /sys/devices/platform/soc/soc:usb3-0/12000000.usb/xhci-hcd.8.auto/usb4/4-1/4-1.2/4-1.2:2.0/net/eth1/power/control
# Disconnect Ethernet cable from the USB dongle and check system tree (wait 30sec after disconnect) …
> ls /sys/devices/platform/soc/soc:usb3-0/12000000.usb/xhci-hcd.8.auto/usb4/4-1/4-1.2/4-1.2:2.0/net
ls: cannot access '/sys/devices/platform/soc/soc:usb3-0/12000000.usb/xhci-hcd.8.auto/usb4/4-1/4-1.2/4-1.2:2.0/net': No such file or directory
# Reattach Ethernet cable to the USB dongle and check system tree (wait 30sec after connect) …
> udevadm —-trigger
> ls /sys/devices/platform/soc/soc:usb3-0/12000000.usb/xhci-hcd.8.auto/usb4/4-1/4-1.2/4-1.2:2.0/net
ls: cannot access '/sys/devices/platform/soc/soc:usb3-0/12000000.usb/xhci-hcd.8.auto/usb4/4-1/4-1.2/4-1.2:2.0/net': No such file or directory

期望结果:

尽管载波信号丢失,网络接口 eth1 仍然存在,但ip link应该报告链路断开。

系统环境:

uname -a
Linux x.y.z 6.2.10-1-ARCH #1 SMP PREEMPT Fri Apr  7 11:19:04 2023 armv7l GNU/Linux

相关内容