openwrt / luci

LuCI - OpenWrt Configuration Interface
Apache License 2.0
6.34k stars 2.53k forks source link

the new luci no switch config display #3914

Closed ptpt52 closed 4 years ago

ptpt52 commented 4 years ago

on page /cgi-bin/luci/admin/network/switch

device: mt7621 ubnt-erx-sfp

I build mt7621 with swconfig and ralink-eth support and everything work but switch luci page show no config

/etc/config/network has config for switch and network work fine

config switch
    option name 'switch0'
    option reset '1'
    option enable_vlan '1'

config switch_vlan
    option device 'switch0'
    option vlan '1'
    option ports '0 1 2 3 6t'

config switch_vlan
    option device 'switch0'
    option vlan '2'
    option ports '4 6t'

/etc/board.json

{
    "model": {
        "id": "ubiquiti,edgerouterx-sfp",
        "name": "UBNT-ERX-SFP"
    },
    "switch": {
        "switch0": {
            "enable": true,
            "reset": true,
            "ports": [
                {
                    "num": 1,
                    "role": "lan"
                },
                {
                    "num": 2,
                    "role": "lan"
                },
                {
                    "num": 3,
                    "role": "lan"
                },
                {
                    "num": 4,
                    "role": "lan"
                },
                {
                    "num": 0,
                    "role": "wan"
                },
                {
                    "num": 6,
                    "device": "eth0",
                    "need_tag": false,
                    "want_untag": false
                }
            ],
            "roles": [
                {
                    "role": "lan",
                    "ports": "1 2 3 4 6t",
                    "device": "eth0.1"
                },
                {
                    "role": "wan",
                    "ports": "0 6t",
                    "device": "eth0.2"
                }
            ]
        }
    },
    "network": {
        "lan": {
            "ifname": "eth0.1",
            "protocol": "static",
            "macaddr": "74:8xxxxxxxxxxx"
        },
        "wan": {
            "ifname": "eth0.2",
            "protocol": "dhcp",
            "macaddr": "74:8xxxxxxxxxxx"
        }
    },
    "gpioswitch": {
        "poe_power_port0": {
            "name": "PoE Power Port0",
            "pin": 496,
            "default": 0
        },
        "poe_power_port1": {
            "name": "PoE Power Port1",
            "pin": 497,
            "default": 0
        },
        "poe_power_port2": {
            "name": "PoE Power Port2",
            "pin": 498,
            "default": 0
        },
        "poe_power_port3": {
            "name": "PoE Power Port3",
            "pin": 499,
            "default": 0
        },
        "poe_power_port4": {
            "name": "PoE Power Port4",
            "pin": 500,
            "default": 0
        }
    }
}
ptpt52 commented 4 years ago

it seems var switchSections = uci.sections('network', 'switch'); get null in file : luci-static/resources/view/network/switch.js

jow- commented 4 years ago

Is swconfig installed?

ptpt52 commented 4 years ago

swconfig installed and swconfig list get the resault:

Found: switch0 - mt7530
jow- commented 4 years ago

What is reported by uci show network and ubus call session list ?

ptpt52 commented 4 years ago

very long output

ubus call session list
{
        "ubus_rpc_session": "00000000000000000000000000000000",
        "timeout": 0,
        "expires": 0,
        "acls": {
                "access-group": {
                        "unauthenticated": [
                                "read"
                        ]
                },
                "ubus": {
                        "luci": [
                                "getFeatures"
                        ],
                        "session": [
                                "access",
                                "login"
                        ]
                }
        },
        "data": {

        }
}
{
        "ubus_rpc_session": "77805123f7575a34e4c9e869a6d1c2d7",
        "timeout": 3600,
        "expires": 3586,
        "acls": {
                "access-group": {
                        "luci-app-ddns": [
                                "read",
                                "write"
                        ],
                        "luci-app-firewall": [
                                "read",
                                "write"
                        ],
                        "luci-app-macvlan": [
                                "read",
                                "write"
                        ],
                        "luci-app-mwan3": [
                                "read",
                                "write"
                        ],
                        "luci-app-natcap": [
                                "read",
                                "write"
                        ],
                        "luci-app-nft-qos": [
                                "read",
                                "write"
                        ],
                        "luci-app-openvpn": [
                                "read",
                                "write"
                        ],
                        "luci-app-opkg": [
                                "read",
                                "write"
                        ],
                        "luci-app-sqm": [
                                "read",
                                "write"
                        ],
                        "luci-app-wizard": [
                                "read",
                                "write"
                        ],
                        "luci-app-xwan": [
                                "read",
                                "write"
                        ],
                        "luci-base": [
                                "read",
                                "write"
                        ],
                        "luci-base-network-status": [
                                "read"
                        ],
                        "luci-mod-network-config": [
                                "read",
                                "write"
                        ],
                        "luci-mod-network-dhcp": [
                                "read",
                                "write"
                        ],
                        "luci-mod-network-diagnostics": [
                                "read"
                        ],
                        "luci-mod-status-firewall": [
                                "read",
                                "write"
                        ],
                        "luci-mod-status-index": [
                                "read"
                        ],
                        "luci-mod-status-index-dhcp": [
                                "read"
                        ],
                        "luci-mod-status-index-dsl": [
                                "read"
                        ],
                        "luci-mod-status-index-wifi": [
                                "read",
                                "write"
                        ],
                        "luci-mod-status-logs": [
                                "read"
                        ],
                        "luci-mod-status-processes": [
                                "read",
                                "write"
                        ],
                        "luci-mod-status-realtime": [
                                "read"
                        ],
                        "luci-mod-status-routes": [
                                "read"
                        ],
                        "luci-mod-system-config": [
                                "read",
                                "write"
                        ],
                        "luci-mod-system-cron": [
                                "read",
                                "write"
                        ],
                        "luci-mod-system-flash": [
                                "read",
                                "write"
                        ],
                        "luci-mod-system-init": [
                                "read",
                                "write"
                        ],
                        "luci-mod-system-mounts": [
                                "read",
                                "write"
                        ],
                        "luci-mod-system-reboot": [
                                "write"
                        ],
                        "luci-mod-system-ssh": [
                                "read",
                                "write"
                        ],
                        "unauthenticated": [
                                "read"
                        ]
                },
                "cgi-io": {
                        "backup": [
                                "read"
                        ],
                        "download": [
                                "read"
                        ],
                        "exec": [
                                "read",
                                "write"
                        ],
                        "upload": [
                                "write"
                        ]
                },
                "file": {
                        "/": [
                                "list"
                        ],
                        "/*": [
                                "list"
                        ],
                        "/bin/dmesg -r": [
                                "exec"
                        ],
                        "/bin/kill": [
                                "exec"
                        ],
                        "/bin/ping": [
                                "exec"
                        ],
                        "/bin/ping6": [
                                "exec",
                                "list"
                        ],
                        "/bin/tar -tzf /tmp/backup.tar.gz": [
                                "exec"
                        ],
                        "/bin/traceroute": [
                                "exec"
                        ],
                        "/bin/traceroute6": [
                                "exec",
                                "list"
                        ],
                        "/bin/umount": [
                                "exec"
                        ],
                        "/dev/mtdblock[0-9]*": [
                                "read"
                        ],
                        "/etc/crontabs/root": [
                                "read",
                                "write"
                        ],
                        "/etc/ddns/services": [
                                "read"
                        ],
                        "/etc/ddns/services_ipv6": [
                                "read"
                        ],
                        "/etc/dropbear/authorized_keys": [
                                "read",
                                "write"
                        ],
                        "/etc/filesystems": [
                                "read"
                        ],
                        "/etc/firewall.user": [
                                "read",
                                "write"
                        ],
                        "/etc/init.d/firewall restart": [
                                "exec"
                        ],
                        "/etc/luci-uploads/*": [
                                "write"
                        ],
                        "/etc/openvpn/*": [
                                "write"
                        ],
                        "/etc/opkg.conf": [
                                "read",
                                "write"
                        ],
                        "/etc/opkg/*.conf": [
                                "read",
                                "write"
                        ],
                        "/etc/rc.local": [
                                "read",
                                "write"
                        ],
                        "/etc/sysupgrade.conf": [
                                "read",
                                "write"
                        ],
                        "/lib/upgrade/platform.sh": [
                                "list"
                        ],
                        "/proc/filesystems": [
                                "read"
                        ],
                        "/proc/mounts": [
                                "read"
                        ],
                        "/proc/mtd": [
                                "read"
                        ],
                        "/proc/partitions": [
                                "read"
                        ],
                        "/proc/sys/kernel/hostname": [
                                "read"
                        ],
                        "/proc/sys/net/netfilter/nf_conntrack_count": [
                                "read"
                        ],
                        "/proc/sys/net/netfilter/nf_conntrack_max": [
                                "read"
                        ],
                        "/sbin/block": [
                                "exec"
                        ],
                        "/sbin/firstboot -r -y": [
                                "exec"
                        ],
                        "/sbin/ifdown": [
                                "exec"
                        ],
                        "/sbin/ifup": [
                                "exec"
                        ],
                        "/sbin/ip -[46] neigh show": [
                                "exec"
                        ],
                        "/sbin/ip -[46] route show table all": [
                                "exec"
                        ],
                        "/sbin/logread": [
                                "stat"
                        ],
                        "/sbin/logread -e ^": [
                                "exec"
                        ],
                        "/sbin/reboot": [
                                "exec"
                        ],
                        "/sbin/sysupgrade --force /tmp/firmware.bin": [
                                "exec"
                        ],
                        "/sbin/sysupgrade --list-backup": [
                                "exec"
                        ],
                        "/sbin/sysupgrade --restore-backup /tmp/backup.tar.gz": [
                                "exec"
                        ],
                        "/sbin/sysupgrade --test /tmp/firmware.bin": [
                                "exec"
                        ],
                        "/sbin/sysupgrade -n --force /tmp/firmware.bin": [
                                "exec"
                        ],
                        "/sbin/sysupgrade -n /tmp/firmware.bin": [
                                "exec"
                        ],
                        "/sbin/sysupgrade /tmp/firmware.bin": [
                                "exec"
                        ],
                        "/sbin/wifi": [
                                "exec"
                        ],
                        "/tmp/backup.tar.gz": [
                                "write"
                        ],
                        "/tmp/firmware.bin": [
                                "write"
                        ],
                        "/tmp/upload.ipk": [
                                "write"
                        ],
                        "/usr/bin/btrfsck": [
                                "list"
                        ],
                        "/usr/bin/nslookup": [
                                "exec"
                        ],
                        "/usr/bin/ntfsfix": [
                                "list"
                        ],
                        "/usr/bin/ping": [
                                "exec"
                        ],
                        "/usr/bin/ping6": [
                                "exec",
                                "list"
                        ],
                        "/usr/bin/traceroute": [
                                "exec"
                        ],
                        "/usr/bin/traceroute6": [
                                "exec",
                                "list"
                        ],
                        "/usr/lib/ddns/dynamic_dns_lucihelper.sh": [
                                "exec"
                        ],
                        "/usr/lib/lua/luci/version.lua": [
                                "read"
                        ],
                        "/usr/libexec/luci-peeraddr": [
                                "exec"
                        ],
                        "/usr/libexec/opkg-call install *": [
                                "exec"
                        ],
                        "/usr/libexec/opkg-call list-available": [
                                "exec"
                        ],
                        "/usr/libexec/opkg-call list-installed": [
                                "exec"
                        ],
                        "/usr/libexec/opkg-call remove *": [
                                "exec"
                        ],
                        "/usr/libexec/opkg-call update *": [
                                "exec"
                        ],
                        "/usr/libexec/opkg-list available": [
                                "exec"
                        ],
                        "/usr/libexec/opkg-list installed": [
                                "exec"
                        ],
                        "/usr/sbin/e2fsck": [
                                "list"
                        ],
                        "/usr/sbin/fsck.f2fs": [
                                "list"
                        ],
                        "/usr/sbin/fsck.fat": [
                                "list"
                        ],
                        "/usr/sbin/ip6tables": [
                                "list"
                        ],
                        "/usr/sbin/ip6tables --line-numbers -w -nvxL -t *": [
                                "exec"
                        ],
                        "/usr/sbin/ip6tables -Z": [
                                "exec"
                        ],
                        "/usr/sbin/iptables --line-numbers -w -nvxL -t *": [
                                "exec"
                        ],
                        "/usr/sbin/iptables -Z": [
                                "exec"
                        ],
                        "/usr/sbin/logread": [
                                "stat"
                        ],
                        "/usr/sbin/logread -e ^": [
                                "exec"
                        ],
                        "/www/luci-static/resources/view/status/include": [
                                "list"
                        ]
                },
                "ubus": {
                        "file": [
                                "read",
                                "write",
                                "list",
                                "remove",
                                "exec",
                                "stat"
                        ],
                        "hostapd.*": [
                                "del_client"
                        ],
                        "iwinfo": [
                                "assoclist",
                                "countrylist",
                                "freqlist",
                                "txpowerlist",
                                "scan"
                        ],
                        "luci": [
                                "setInitAction",
                                "getConntrackHelpers",
                                "getMountPoints",
                                "getFeatures",
                                "getSwconfigFeatures",
                                "getSwconfigPortState",
                                "getConntrackList",
                                "getRealtimeStats",
                                "getProcessList",
                                "getInitList",
                                "getLEDs",
                                "getLocaltime",
                                "getTimezones",
                                "getUSBDevices",
                                "setLocaltime",
                                "setPassword",
                                "getBlockDevices",
                                "setBlockDetect"
                        ],
                        "luci-rpc": [
                                "getBoardJSON",
                                "getHostHints",
                                "getNetworkDevices",
                                "getWirelessDevices",
                                "getDHCPLeases",
                                "getDUIDHints",
                                "getDSLStatus"
                        ],
                        "luci.ddns": [
                                "get_services_status",
                                "get_ddns_state",
                                "get_env",
                                "get_services_log"
                        ],
                        "luci.upnp": [
                                "get_status",
                                "delete_rule"
                        ],
                        "network": [
                                "get_proto_handlers"
                        ],
                        "network.interface": [
                                "dump"
                        ],
                        "network.rrdns": [
                                "lookup"
                        ],
                        "session": [
                                "access",
                                "login"
                        ],
                        "system": [
                                "board",
                                "info",
                                "validate_firmware_image"
                        ],
                        "uci": [
                                "changes",
                                "get",
                                "add",
                                "apply",
                                "confirm",
                                "delete",
                                "order",
                                "set"
                        ]
                },
                "uci": {
                        "ddns": [
                                "read"
                        ],
                        "dhcp": [
                                "read",
                                "write"
                        ],
                        "dropbear": [
                                "read",
                                "write"
                        ],
                        "firewall": [
                                "read",
                                "write"
                        ],
                        "fstab": [
                                "read",
                                "write"
                        ],
                        "luci": [
                                "read",
                                "write"
                        ],
                        "macvlan": [
                                "read",
                                "write"
                        ],
                        "mwan3": [
                                "read",
                                "write"
                        ],
                        "natcapd": [
                                "read",
                                "write"
                        ],
                        "network": [
                                "read",
                                "write"
                        ],
                        "nft-qos": [
                                "read",
                                "write"
                        ],
                        "openvpn": [
                                "read",
                                "write"
                        ],
                        "sqm": [
                                "read",
                                "write"
                        ],
                        "system": [
                                "read",
                                "write"
                        ],
                        "upnpd": [
                                "read",
                                "write"
                        ],
                        "wireless": [
                                "read",
                                "write"
                        ],
                        "wizard": [
                                "read",
                                "write"
                        ],
                        "xwan": [
                                "read",
                                "write"
                        ]
                }
        },
        "data": {
                "token": "f9aef8d876a55ea71180be24138c9909",
                "username": "root"
        }
}
ptpt52 commented 4 years ago

and

uci show network
network.loopback=interface
network.loopback.ifname='lo'
network.loopback.proto='static'
network.loopback.ipaddr='127.0.0.1'
network.loopback.netmask='255.0.0.0'
network.globals=globals
network.globals.ula_prefix='fd84:cb37:4bc1::/48'
network.globals.packet_steering='1'
network.lan=interface
network.lan.type='bridge'
network.lan.ifname='eth0.1 eth0.200'
network.lan.proto='static'
network.lan.ipaddr='192.168.15.1'
network.lan.netmask='255.255.255.0'
network.lan.ip6assign='60'
network.wan6=interface
network.wan6.proto='dhcpv6'
network.wan6.ifname='@wan'
network.wan6.reqaddress='try'
network.wan6.reqprefix='auto'
network.@switch[0]=switch
network.@switch[0].name='switch0'
network.@switch[0].reset='1'
network.@switch[0].enable_vlan='1'
network.@switch_vlan[0]=switch_vlan
network.@switch_vlan[0].device='switch0'
network.@switch_vlan[0].vlan='1'
network.@switch_vlan[0].ports='0 1 2 6t'
network.@switch_vlan[1]=switch_vlan
network.@switch_vlan[1].device='switch0'
network.@switch_vlan[1].vlan='2'
network.@switch_vlan[1].ports='4 6t'
network.@switch_vlan[2]=switch_vlan
network.@switch_vlan[2].device='switch0'
network.@switch_vlan[2].vlan='200'
network.@switch_vlan[2].ports='3t 6t'
network.wan=interface
network.wan.proto='pppoe'
network.wan.ifname='eth0.2'
network.wan.metric='40'
network.wan.username='user'
network.wan.password='password'
network.wan.keepalive='5 5'
network.wan.mtu='1492'
network.wan.ipv6='1'
network.wan1=interface
network.wan1.proto='static'
network.wan1.ifname='eth0.2'
network.wan1.ipaddr='192.168.17.254'
network.wan1.netmask='255.255.255.0'
network.wan1.gateway='192.168.17.1'
network.wan1.metric='41'
jow- commented 4 years ago

Can't see any obvious problem and unable to reproduce using an ar71xx build on the only swconfig capable device I have lying around here.

Maybe provide screenshots of the broken state and your JS error console in the browser.

ptpt52 commented 4 years ago

yep very strange it only happens on mt7621,i will take more inspection. thank you for your help.

Jo-Philipp Wich notifications@github.com 于 2020年4月15日周三 03:08写道:

Can't see any obvious problem and unable to reproduce using an ar71xx build on the only swconfig capable device I have lying around here.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/openwrt/luci/issues/3914#issuecomment-613628046, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIVTYVQIJBGQ6EMEYIAEMLRMSYEJANCNFSM4MH354EA .

ptpt52 commented 4 years ago

@jow- hi, I found the point:

my device is ubnt-erx-sfp, it has no wireless but after I touch a file touch /etc/config/wireless the switch page work again so it is related missing /etc/config/wireless, a bug in some js

you may reproduce this issue by rm /etc/config/wireless

ptpt52 commented 4 years ago

related on this commit: bd713f870a974d46b214d07d85ac4a895d85a122

ptpt52 commented 4 years ago

and this commit: 65d28a4ac92a4806b5ad836a2dbbe8bc4e87207b

ptpt52 commented 4 years ago

and resolve by modify this:

diff --git a/modules/luci-base/htdocs/luci-static/resources/uci.js b/modules/luci-base/htdocs/luci-static/resources/uci.js
index e6582b3e2..5dd98f5b2 100644
--- a/modules/luci-base/htdocs/luci-static/resources/uci.js
+++ b/modules/luci-base/htdocs/luci-static/resources/uci.js
@@ -31,8 +31,7 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ {
                object: 'uci',
                method: 'get',
                params: [ 'config' ],
-               expect: { values: { } },
-               reject: true
+               expect: { values: { } }
        }),

        callOrder: rpc.declare({