We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

Ethernet connection check issue Omega2+



  • Hello, guys!
    I have found some strange with Omega2+ ethernet link.

    At start ethernet cable is disconnected. ubus utility confirms this:

    # /bin/ubus call network.interface.wan status
    {
            "up": false,
            "pending": true,
            "available": true,
            "autostart": true,
            "dynamic": false,
            "proto": "dhcp",
            "device": "eth0",
            "data": {
    
            }
    }
    

    After ethernet cable connect:
    '''

    [ 763.914064] rt3050-esw 10110000.esw: link changed 0x01

    /bin/ubus call network.interface.wan status

    {
    "up": true,
    "pending": false,
    "available": true,
    "autostart": true,
    "dynamic": false,
    "uptime": 7,
    "l3_device": "eth0",
    "proto": "dhcp",
    "device": "eth0",
    "updated": [
    "addresses",
    "routes",
    "data"
    ],
    "metric": 0,
    "dns_metric": 0,
    "delegation": true,
    "ipv4-address": [
    {
    "address": "192.168.1.40",
    "mask": 24
    ..........

    All good. Now I disconnect cable and call utility to check network state:
    
    # [  854.682436] rt3050-esw 10110000.esw: link changed 0x00
    
    # [  937.070589] rt3050-esw 10110000.esw: link changed 0x00
    # /bin/ubus call network.interface.wan status
    {
            "up": true,
            "pending": false,
            "available": true,
            "autostart": true,
            "dynamic": false,
            "uptime": 295,
            "l3_device": "eth0",
            "proto": "dhcp",
            "device": "eth0",
            "updated": [
                    "addresses",
                    "routes",
                    "data"
            ],
            "metric": 0,
            "dns_metric": 0,
            "delegation": true,
            "ipv4-address": [
                    {
                            "address": "192.168.1.40",
                            "mask": 24
                    }
            ],
    ...............
    
    # ifconfig eth0
    eth0      Link encap:Ethernet  HWaddr 40:A3:6B:C1:30:7B
              inet addr:192.168.1.40  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::42a3:6bff:fec1:307b/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:1101 errors:0 dropped:1 overruns:0 frame:0
              TX packets:306 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:166652 (162.7 KiB)  TX bytes:84785 (82.7 KiB)
              Interrupt:5
    Utilities says that I have ethernet connection, but this is wrong!!!
    As I can see ethernet kernel driver works correctly, utility fails. After reboot all ok.
    How I can to monitor ethernet connection on-the-fly?
    
    Thanks


  • @Pavel-Negrobov If you monitor ubus (ubus monitor) you will see that disconnecting the cable generates no ubus message.

    Usually under Linux you can check the file system /sys/class/net/eth0/operstate but this is also not updated when we use the Warp Core driver. The only way I have found to reliably check link state on the ethernet port is to use the command:

    swconfig dev switch0 show

    Look at port 0 and you will be able to see the link state is reliably updated.

    You can use the command:

    swconfig dev switch0 port 0 get link

    This will get the status of the ethernet device port 0 which is the one you're interested in.


  • administrators

    @Pavel-Negrobov you can also try parsing the output of dmesg
    This command outputs all kernel messages since boot.

    Find the last instance of rt3050-esw 10110000.esw: link changed 0x0* and read the 0 or 1 character at the end to find out if ethernet is connected or not.



  • Thanks to all

    # [ 1019.154853] rt3050-esw 10110000.esw: link changed 0x00
    
    # swconfig dev switch0 port 0 get link
    port:0 link:down
    
    # [ 1047.063981] rt3050-esw 10110000.esw: link changed 0x01
    # swconfig dev switch0 port 0 get link
    port:0 link:up speed:100baseT full-duplex
    

    This work fine.


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.