Ifconfig to detect the physical connected or disconnected state

root@OpenWrt:/# ifconfig eth0.1
eth0.1    Link encap:Ethernet  HWaddr 00:0C:43:E1:77:2A  
          inet addr:10.0.0.5  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:43ff:fee1:772a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:70 errors:0 dropped:2 overruns:0 frame:0
          TX packets:67 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:8105 (7.9 KiB)  TX bytes:7409 (7.2 KiB)

root@OpenWrt:/# [  117.312000] RT305x_ESW: Link Status Changed

root@OpenWrt:/# ifconfig eth0.1
eth0.1    Link encap:Ethernet  HWaddr 00:0C:43:E1:77:2A  
          inet addr:10.0.0.5  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:43ff:fee1:772a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:70 errors:0 dropped:2 overruns:0 frame:0
          TX packets:67 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:8105 (7.9 KiB)  TX bytes:7409 (7.2 KiB)

it seems nothing changed, why?

Why do you expect ifconfig to report the connected state?

2 Likes

i see some example from internet using socket flag running to detect it

May be due to force_link option.

2 Likes

Are you referring to the switch ports' link state? Then you can't.

2 Likes
2 Likes

mtk7688, no swconfig support

mt76x8 target does use swconfig, or you're using MTK SDK's OpenWrt.

1 Like

yes, it is

Then I don't think this is the right place to ask. Please refer to their SDK documentation.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.