Skip to content

DAWN ubus API will produce invalid JSON and make luci-app-dawn unusable #247

@CoelacanthusHex

Description

@CoelacanthusHex

Normally, ubus call dawn get_network will produce a JSON like

{
  "SSID": {
    "AP_MAC1": { AP_INFO1 },
    "AP_MAC2": { AP_INFO2 },
    "AP_MAC3": { AP_INFO3 }
  }
}

But don't know what caused it, on my device, it produces invalid JSON like

{
  {
    "AP_MAC1": { AP_INFO1 }
  },
  "SSID": {
    "AP_MAC2": { AP_INFO2 },
    "AP_MAC3": { AP_INFO3 }
  }
}

Some APs were split into another JSON object lacking the key-value pair key, which is not valid in JSON.
In my case, it's

{
        {
                "XX:XX:XX:XX:XX:D8": {
                        "channel": 6,
                        "freq": 2437,
                        "channel_utilization": 4,
                        "num_sta": 0,
                        "ht_support": true,
                        "vht_support": true,
                        "op_class": 81,
                        "local": true,
                        "neighbor_report": "xxxx",
                        "iface": "phy0.0-ap0",
                        "hostname": "router1"
                }
        },
        "My Wi-Fi": {
                "XX:XX:XX:XX:XX:F8": {
                        "channel": 61,
                        "freq": 6255,
                        "channel_utilization": 1,
                        "num_sta": 0,
                        "ht_support": true,
                        "vht_support": true,
                        "op_class": 137,
                        "local": true,
                        "neighbor_report": "xxxx",
                        "iface": "phy0.2-ap0",
                        "hostname": "route1"
                },
                "YY:YY:YY:YY:YY:D2": {
                        "channel": 11,
                        "freq": 2462,
                        "channel_utilization": 36,
                        "num_sta": 0,
                        "ht_support": true,
                        "vht_support": false,
                        "op_class": 81,
                        "local": false,
                        "neighbor_report": "xxxx",
                        "iface": "phy0-ap0",
                        "hostname": "router2"
                },
                "YY:YY:YY:YY:YY:D3": {
                        "channel": 40,
                        "freq": 5200,
                        "channel_utilization": 1,
                        "num_sta": 0,
                        "ht_support": true,
                        "vht_support": true,
                        "op_class": 129,
                        "local": false,
                        "neighbor_report": "xxxx",
                        "iface": "phy1-ap0",
                        "hostname": "router2"
                }
        }
}

It makes luci-app-dawn unhappy and throws "No related RPC reply". In browser devtools, we can see luci-app-dawn got an invalid JSON.

I use OpenWrt SNAPSHOT r28914-be181cb3b3 / LuCI Master 25.057.54985~eb422f5 on BananaPi R4 (Router1) and 23.05.03 on 360T7 (Router2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions