I need the test case for Ethernet in Linux using C code to check eth0. If eth0 is down, we enable the net then check if up and the test is passed.<
eth0
The network interfaces can be seen in sysfs: /sys/class/net/eth[x]. There you can check the link, interface status, and more.
sysfs
/sys/class/net/eth[x]