Commit Graph

95 Commits

Author SHA1 Message Date
Paul Donald a818ac89bb luci-base: correctness fixes
validation:

use correct argument position for apply

network:

spec.need_tag -> port.need_tag agrees with old lua compat

widgets:

rv.length is undefined, use firstChild

form:

Follow-up to 315dbfc749
checkDepends recursion fix and implement cache lookup

uci:

improve timeout and Promise handling

ui:

follow-up to 92381c3ca2
renderListing sort: put directories first
getActiveTabId: check isNaN for tab state
getScrollParent: fix evaluation logic
fadeOutNotification: implement immediate timeout
openDropdown: accelerate draw via getBoundingClientRect

form:
ensure FlagValue parse always resolves

fs:
parse all 'expect' keys in RpcReply

luci:

Use the same source of truth in both the check and the dispatch
for flushRequestQueue

string check for dom string additions

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-05-27 15:49:44 +03:00
Konstantin Glukhov e839b9d18d luci-base: network.js: de-dup ifc IPv6 addresses
De-dup IPv6 addresses before getIP6Addrs() returns an array
from "ipv6-address" and "ipv6-prefix-assignment" ubus data.

This can happen when the local address derived from a delegated prefix
matches an explicitly configured IPv6 address. Use a Set to ensure that
duplicate entries are filtered out before returning the address list.

Signed-off-by: Konstantin Glukhov <KGlukhov@Hotmail.com>
2026-03-16 22:04:55 +01:00
Paul Donald daca0e85a8 luci-base: prevent save/traceback race for _state
A _state race is possible during save when a refresh is in
progress. Attempt to avoid it by not nulling state prior
to refresh.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-03-04 01:13:05 +01:00
Paul Donald c1f55dd43a luci-base: fix refresh in initNetworkState
Stale state is kept around due to the _init = _init
(re)assignment, and this assignment prevents a refresh.

After running everything through testing, I also
found uci.delete -> uci.remove. I could completely remove
both deleteWifiNetwork functions and still delete
networks, suggesting these go unused. There are no
other references to them anywhere...

Add also pse property, as a follow-up to
8e493db75a

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-02-19 01:50:37 +01:00
Paul Donald 172f7687e9 luci-base: js linting fixes / ES6 treatment
follow-up to 50a8d5325d

Fix loop variable collision in getWifiNetidBySid

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-02-18 17:56:26 +01:00
Paul Donald 92e1012314 luci-base: fix front matter for luci-base classes
Linking the namespaces provides hierarchy which satisfies
various errors and warnings, but hides the front matter
for the classes for some reason.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-02-16 03:41:36 +01:00
Paul Donald 50a8d5325d luci-base: js linting fixes / ES6 treatment
prevent global variable bleed and reduce size somewhat

-cbi
-network
-protocol/static
-rpc
-tools/widgets
-tools/views
-uci

protocols

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-02-16 01:42:57 +01:00
Paul Donald 92381c3ca2 luci-base: jsdoc fixes
@name alone does not provide a linkable symbol.
@member and @memberof do.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-02-16 01:42:56 +01:00
Carlo Szelinsky 8e493db75a luci-base: poe and PSE details & configuration
Adds PoE/PSE configuration support for modern linux (PSE-PD).
This change is based on the PSE-PD backport (from 6.17)
and netifd|ubus changes.

* Add getPSE() [receive all status information]
and hasPSE() [has the device PSE hardware?]

* Changes ACL permissions to query network.device status information

* Add two new PoE icons (PoE active with link up + link down) for
the port status page

* Changes port status to show PoE information, next to link information
and data transfer.

* Add a new tab for PoE/PSE to the device configuration,
which will only be displayed if the device supports PSE

Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
2026-01-26 03:40:38 +01:00
Paul Donald 7722292e88 luci-mod-network: prevent loading non-existent protocol/bonding
Bonding is configured under interface properties, and handled by netifd.
luci-proto-bonding was removed, even if the proto-bonding package is still
useful. This change prevents the trace-back from attempting to load
luci-proto-bonding.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-10-30 14:30:46 +01:00
Florian Eckert 7b6b0d0139 luci-base: add getPending ubus function call
Exporting the ubus “pending” information so that this information can be
used in LuCI.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-10-10 14:08:24 +02:00
Sergey Ponomarev 6c5f78ffd2 luci-base: form.js, luci.js, network.js: fix typos and add articles
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
[ minor adjustments ]
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-10-08 00:40:00 +02:00
Paul Donald 9c0f071bbd luci-base: check for wifi system feature before Promise.all
Allows the hasSystemFeature call to complete before executing the
Promise bundle.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-06-22 22:35:46 +02:00
Paul Donald f5da7a6016 luci-base: implement Virtual Routing and Forwarding (VRF) options
VRF in netifd is now in main. See:
https://github.com/openwrt/netifd/pull/38/
https://github.com/openwrt/openwrt/commit/15c2ca0a834752cc9505751fc6d2f51861d34dfd

VRF netifd management was added to 24.10 in
https://github.com/openwrt/openwrt/pull/19125

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-06-17 00:08:06 +02:00
Paul Donald fa6ca8a618 treewide: vectorise iconography
follow-up to ae5d91da90

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-06-14 00:13:52 +02:00
Paul Donald 68082d24e6 luci-base: spell fix
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-04-21 23:32:13 +02:00
Tobias Waldvogel 29fe3f5fda luci: show wifi vlan in the associated wireless stations list
This patch adds a badge to the associated wireless stations with the vlan id
and name. It is displayed in the same color as the network, to which it is
bridged, so the color corresponds to the color in the network configuration
page.

Signed-off-by: Tobias Waldvogel <tobias.waldvogel@gmail.com>
2025-02-23 12:51:07 -06:00
Erik Karlsson ba1fb8ee42 luci-base: handle default protocol for UCI interfaces
The protocol defaults to 'none' in netifd if unspecified.

Signed-off-by: Erik Karlsson <erik.karlsson@iopsys.eu>
2025-01-22 15:49:14 +01:00
Paul Donald 41cbd31c90 luci-base: prevent trace-back loading wireless on non-WiFi devices
Manifests in the console as:

RPCError: RPC call to uci/get failed with ubus code 4: Resource not found

The lazy-loading is harmless and has been that way for years, but the
presence of the trace-back clouds other problems. This should keep the
console cleaner; it conditionally attempts to load wireless when a more
fundamental check for it passes.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2024-12-22 16:23:26 +00:00
Paul Donald 8d13ea410d luci-base, luci-proto-*: rename getOpkgPackage -> getPackageName
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2024-12-15 20:13:56 +01:00
Paul Donald 37682ded6f luci-base: network; implement getIP6Prefixes()
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2024-11-05 18:33:29 +01:00
Paul Donald ade3606800 luci-base: space -> tab
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2024-10-17 17:31:26 +02:00
Paul Donald 4afb477527 luci-base: Minor spell fixes
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2024-10-16 01:50:12 +02:00
Rudy Andram 383edb4d6d luci-wireless: Add 11be support
Tested with filogic banana rpi4 / QNAP qualcommax ipq8074

Signed-off-by: Rudy Andram <rmandrad@gmail.com>
Tested-By: Daniel Pawlik <pawlik.dan@gmail.com>
2024-10-07 19:29:35 +02:00
hitech95 2bb1e06b52 luci-base: return ipv6 lease time from getExpiry()
This commit introduces a streamlined method for retrieving lease time
 information on IPv6 interfaces.

While IPv4 interfaces typically have a single lease time (available
 in the interface data), IPv6 interfaces commonly feature multiple
 lease times due to factors like delegated prefixes or multiple /64 subnet.

Users typically receive only one prefix delegation from their ISP, leading
 this PR to the retrieval of lease time from the first available prefix
 or IPv6 address.

To enhance usability and provide users with a more comprehensive view
 of lease time information, however, alternative approaches
 should be discussed.

Suggestions include returning an array of lease times or aggregating
 the various possible values using methods like min or max.

These enhancements aim to improve the clarity the lease time
 management on IPv6 interfaces.

Signed-off-by: hitech95 <nicveronese@gmail.com>
2024-05-14 20:06:18 +02:00
Paul Donald 5355b7b576 luci-base: comment fixes (sp)
Signed-off-by: Paul Donald <newtwen@gmail.com>
2023-12-23 14:33:16 +00:00
Evan Benn e02df6505f luci-base: Use getMode in getActiveMode
Signed-off-by: Evan Benn <evan.benn@morsemicro.com>
2023-12-15 09:11:13 +11:00
Evan Benn 23931c3778 luci-base: Replace mode: Master with Access Point
Access Point is the string used on the network wireless setup dialogue.
Use Access Point to report the mode on the network wireless and status
screens.

Signed-off-by: Evan Benn <evan.benn@morsemicro.com>
2023-12-15 09:11:13 +11:00
Evan Benn 22101eb50a luci-base: Make uci mode strings match iwinfo mode strings
uci mesh was being displayed as 'Mesh', while iwinfo mesh was being
reported as 'Mesh Point'. Unify those. Update getActiveModeI18n to deal
with all the values iwinfo returns. Fix the incorrect 'Mash'
translation.

Signed-off-by: Evan Benn <evan.benn@morsemicro.com>
2023-12-15 09:11:10 +11:00
Sergey Ponomarev 7744ad0075 luci-base: Fix typos in JsDocs
In some places argument name was renamed but in the JsDoc it's remain old.

Added more typing for string enum fields like:

 @param {string} [type=text]

replaced with:

 @param {"blob"|"text"|"blob"} [type=text]

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2023-09-23 10:39:34 +03:00
Sergey Ponomarev d35dd2d489 luci-base: network.js: simplify getWifiNetidBySid
Remove unused variables i and netid and reuse radioname

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2023-09-23 10:34:35 +03:00
Andre Heider d53ea72a88 luci-base: use "hwmodes_text" to describe wireless radios
This is a preformatted string like "ac/ax/b/g/n" for presentation.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2023-01-23 14:51:28 +01:00
Jo-Philipp Wich 37422e891a luci-base: revise array sorting
Refactor various sort operations throughout luci-base to use the new
L.naturalCompare() comparator function.

This primarily ensures that embedded numbers are sorted numerically and
not in a lexicographical way.

It also simplifies some code as a side effect.

Ref: #5899
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-07-27 17:32:58 +02:00
Jo-Philipp Wich 8effea58d7 luci-base: network.js: consider uci config for Device.getType()/getParent()
For network devices declared in uci but not yet created by netifd, the
runtime status information will be unavailable, causing methods such as
`getType()` to assume plain ethernet interfaces and `getParent()` to fail
resolving parent devices.

Fall back to infer the information from uci configuration settings in such
cases to give accurate type hints to callers.

In particular, this prevents LuCI from turning wireless target networks
containing a to-be-created bridge device into bridges themselves.

Fixes: https://github.com/openwrt/packages/issues/18768
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-06-16 09:52:36 +02:00
Jo-Philipp Wich d4092b15ce luci-base: network.js: ignore wireless ifname patterns on retrieving devices
Only treat the given identifier as Linux netdev name if we can find a
corresponding entry in the device info cache and do not consider strings
starting with "wlan", "ath" or "wl" to be existing devices.

This fixes incorrectly adding wireless sections as ifnames to network
interfaces when the wifi-iface section name begins with one of the
`iface_patterns_wireless` patterns.

Fixes: #5069
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-11-10 11:57:43 +01:00
Jo-Philipp Wich 63034c3607 luci-base: remove further related section types on deleting network
When removing a `config interface` section in `/etc/config/network`, drop
related `rule` and `rule6` sections too, as well as related `dhcp` sections
in `/etc/config/dhcp`.

Ref: https://forum.openwrt.org/t/grooming-etc-config/109764/7
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-10-22 19:44:43 +02:00
Jo-Philipp Wich 1bcb12570c luci-base: network.js: add link status information accessors
Fixes: #5121
Fixes: 8c71b1d01e ("luci-mod-network: add port status to bridge vlan filter matrix")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-12 18:42:37 +02:00
David Bauer 516c58e133 Merge pull request #5070 from blocktrron/pr-luci-wifi6
luci-mod-network: add 802.11ax HE support
2021-06-05 19:04:11 +02:00
David Bauer 4b17f8baa3 luci-base: add 11ax HW / HT modes
Add the known values returned for 802.11ax HW as well as HT modes to the
respective method descriptions.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-06-05 16:24:19 +02:00
David Bauer f35e877dc6 luci-mod-network: add 802.11ax HE support
This commit adds the ability to configure HE-modes for radios
(HE20 / HE40 / HE80 / HE160) as well as HE rate information in the
assiciation view.

Tested-on: Ubiquiti UniFi 6 Lite / LR

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-06-05 16:24:19 +02:00
Jo-Philipp Wich e35041e0a8 luci-base: network.js: sorting fixes
Ensure that sort callbacks consistently return [-N .. 0 .. +N] values
instead of just true/false.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-03 09:51:09 +02:00
Niels Widger c7b7b42cd3 treewide: Update JS using luci-rpc getHostHints
Update frontend JS code which uses luci-rpc getHostHints to support the new
response format which removes the `ipv4` and `ipv6` host hint string fields
and replaces them with `ipaddrs` and `ip6addrs` weighted string list fields.

Signed-off-by: Niels Widger <niels@qacafe.com>
[rework code to be forwards/backwards compatible, fix some Network.Hosts
 methods, fix IP choice ordering, change commit subject, rewrap commit
 message]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-03 09:51:09 +02:00
Rafał Miłecki 74be304e54 treewide: use "device" option in UCI "interface" sections
netifd has been recently patched to use "device" option instead of
"ifname" as more clear & accurate.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-27 10:52:51 +02:00
Jo-Philipp Wich d1bf56d7f1 luci-base: network.js: recognize DSA ports and bridge VLANs
Use the newly introduced devtype attribute for more robust network device
type detection. This also allows us to easily recognize DSA ports.

Furthermore, synthesize VLAN devices declared by uci bridge-vlan sections,
similar to how it is done for legacy swconfig switch_vlan ones.

Finally implement a new Network.Device.getParent() method to use the newly
available "parent" attribute to resolve the base device of DSA ports or
VLAN devices.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-18 17:28:40 +01:00
Jo-Philipp Wich 0ee422b4c0 luci-base: network.js: sort interface statuses by metric, then name
Fixes: #4693
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-01 10:42:10 +01:00
Oldřich Jedlička 12e50de9db luci-base: network.js: Show clients also from wifi VLANs.
Iterate through VLANs to get the clients connected on configured wifi
VLANs (as configured by `wifi-vlan` sections in `wireless` configuration).

This is a minimum support for VLANs on wireless network. The VLAN name is
nowhere displayed, but at least clients using VLANs are visible.

Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
2020-10-06 13:30:47 +02:00
Jo-Philipp Wich 354ca57ec8 luci-base: network.js: recognize uci declared network devices
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-05 13:53:12 +02:00
Jo-Philipp Wich 0e22d4d87e luci-base: network.js: don't fail loading network config on missing wireless
Fixes: #3914
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-15 09:29:29 +02:00
Jo-Philipp Wich 65d673f467 luci-base: network.js: gracefully handle missing wireless config
Ref: https://github.com/openwrt/luci/issues/3895
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-11 21:26:16 +02:00
Jo-Philipp Wich e331e32b2c Merge pull request #3749 from Ansuel/fix_relayd
luci-base: fix error 404 on missing relay protocol
2020-04-08 09:15:38 +02:00