diff --git a/LuCI.network.Device.html b/LuCI.network.Device.html index 08d7e7b46f..d7719b9a68 100644 --- a/LuCI.network.Device.html +++ b/LuCI.network.Device.html @@ -1,3 +1,3 @@ Class: Device
On this page

LuCI.network. Device

A Network.Device class instance represents an underlying Linux network device and allows querying device details such as packet statistics or MTU.

Methods

getBridgeID() → {null|string}

Get the bridge ID

Returns:

Returns the ID of this network bridge or null if this network device is not a Linux bridge.

Type: 
null | string

getBridgeSTP() → {boolean}

Get the bridge STP setting

Returns:

Returns true when this device is a Linux bridge and has stp enabled, else false.

Type: 
boolean

getCarrier() → {boolean}

Get the carrier state of the network device.

Returns:

Returns true if the device has a carrier, e.g. when a cable is inserted into an Ethernet port of false if there is none.

Type: 
boolean

getDuplex() → {string|null}

Get the current duplex mode of the network device if available.

Returns:

Returns the current duplex mode of the network device. Returns either "full" or "half" if the device supports duplex modes or null if the duplex mode is unknown or unsupported.

Type: 
string | null

getI18n() → {string}

Get a long description string for the device.

Returns:

Returns a string containing the type description and device name for non-WiFi devices or operation mode and SSID for WiFi ones.

Type: 
string

getIP6Addrs() → {Array.<string>}

Get the IPv6 addresses configured on the device.

Returns:

Returns an array of IPv6 address strings.

Type: 
Array.<string>

getIPAddrs() → {Array.<string>}

Get the IPv4 addresses configured on the device.

Returns:

Returns an array of IPv4 address strings.

Type: 
Array.<string>

getMAC() → {null|string}

Get the MAC address of the device.

Returns:

Returns the MAC address of the device or null if not applicable, e.g. for non-Ethernet tunnel devices.

Type: 
null | string

getMTU() → {number}

Get the MTU of the device.

Returns:

Returns the MTU of the device.

Type: 
number

getName() → {string}

Get the name of the network device.

Returns:

Returns the name of the device, e.g. eth0 or wlan0.

Type: 
string

getNetwork() → {null|LuCI.network.Protocol}

Get the primary logical interface this device is assigned to.

Returns:

Returns a Network.Protocol instance representing the logical interface this device is attached to or null if it is not assigned to any logical interface.

Type: 
null | LuCI.network.Protocol

getNetworks() → {Array.<LuCI.network.Protocol>}

Get the logical interfaces this device is assigned to.

Returns:

Returns an array of Network.Protocol instances representing the logical interfaces this device is assigned to.

Type: 
Array.<LuCI.network.Protocol>

getPSE() → {Object|null}

Get the PSE (Power Sourcing Equipment / PoE) status of the device.

Returns:

Returns an object containing PSE status information or null if PSE is not available on this device. The object may contain:

  • c33AdminState: "enabled" or "disabled" (C33 PoE admin state)
  • c33PowerStatus: "disabled", "searching", "delivering", "test", "fault", "otherfault"
  • c33PowerClass: Power class number (1-8)
  • c33ActualPower: Actual power consumption in mW
  • c33AvailablePowerLimit: Available power limit in mW
  • podlAdminState: "enabled" or "disabled" (PoDL admin state)
  • podlPowerStatus: "disabled", "searching", "delivering", "sleep", "idle", "error"
  • priority: Current priority level
  • priorityMax: Maximum priority level
Type: 
Object | null

getParent() → {null|LuCI.network.Device}

Get the logical parent device of this device.

In case of DSA switch ports, the parent device will be the DSA switch device itself, for VLAN devices, the parent refers to the base device etc.

Returns:

Returns a Network.Device instance representing the parent device or null when this device has no parent, as it is the case for e.g. ordinary Ethernet interfaces.

Type: 
null | LuCI.network.Device

getPorts() → {null|Array.<LuCI.network.Device>}

Get the associated bridge ports of the device.

Returns:

Returns an array of Network.Device instances representing the ports (slave interfaces) of the bridge or null when this device isn't a Linux bridge.

Type: 
null | Array.<LuCI.network.Device>

getRXBytes() → {number}

Get the amount of received bytes.

Returns:

Returns the amount of bytes received by the network device.

Type: 
number

getRXPackets() → {number}

Get the amount of received packets.

Returns:

Returns the amount of packets received by the network device.

Type: 
number

getShortName() → {string}

Get a short description string for the device.

Returns:

Returns the device name for non-WiFi devices or a string containing the operation mode and SSID for WiFi devices.

Type: 
string

getSpeed() → {number|null}

Get the current link speed of the network device if available.

Returns:

Returns the current speed of the network device in Mbps. If the device supports no Ethernet speed levels, null is returned. If the device supports Ethernet speeds but has no carrier, -1 is returned.

Type: 
number | null

getTXBytes() → {number}

Get the amount of transmitted bytes.

Returns:

Returns the amount of bytes transmitted by the network device.

Type: 
number

getTXPackets() → {number}

Get the amount of transmitted packets.

Returns:

Returns the amount of packets transmitted by the network device.

Type: 
number

getType() → {string}

Get the type of the device.

Returns:

Returns a string describing the type of the network device:

  • alias if it is an abstract alias device (@ notation)
  • wifi if it is a wireless interface (e.g. wlan0)
  • bridge if it is a bridge device (e.g. br-lan)
  • tunnel if it is a tun or tap device (e.g. tun0)
  • vlan if it is a vlan device (e.g. eth0.1)
  • vrf if it is a Virtual Routing and Forwarding type (e.g. vrf0)
  • switch if it is a switch device (e.g.eth1 connected to switch0)
  • ethernet for all other device types
Type: 
string

getTypeI18n() → {string}

Get a string describing the device type.

Returns:

Returns a string describing the type, e.g. "Wireless Adapter" or "Bridge".

Type: 
string

getWifiNetwork() → {null|LuCI.network.WifiNetwork}

Get the related wireless network this device is related to.

Returns:

Returns a Network.WifiNetwork instance representing the wireless network corresponding to this network device or null if this device is not a wireless device.

Type: 
null | LuCI.network.WifiNetwork

hasPSE() → {boolean}

Check if PSE (PoE) is available on this device.

Returns:

Returns true if PSE hardware is available on this device.

Type: 
boolean

isBridge() → {boolean}

Checks whether this device is a Linux bridge.

Returns:

Returns true when the network device is present and a Linux bridge, else false.

Type: 
boolean

isBridgePort() → {boolean}

Checks whether this device is part of a Linux bridge.

Returns:

Returns true when this network device is part of a bridge, else false.

Type: 
boolean

isUp() → {boolean}

Checks whether this device is up.

Returns:

Returns true when the associated device is running or false when it is down or absent.

Type: 
boolean
LuCI Documentation
\ No newline at end of file +
On this page

LuCI.network. Device

A Network.Device class instance represents an underlying Linux network device and allows querying device details such as packet statistics or MTU.

Methods

getBridgeID() → {null|string}

Get the bridge ID

Returns:

Returns the ID of this network bridge or null if this network device is not a Linux bridge.

Type: 
null | string

getBridgeSTP() → {boolean}

Get the bridge STP setting

Returns:

Returns true when this device is a Linux bridge and has stp enabled, else false.

Type: 
boolean

getCarrier() → {boolean}

Get the carrier state of the network device.

Returns:

Returns true if the device has a carrier, e.g. when a cable is inserted into an Ethernet port of false if there is none.

Type: 
boolean

getDuplex() → {string|null}

Get the current duplex mode of the network device if available.

Returns:

Returns the current duplex mode of the network device. Returns either "full" or "half" if the device supports duplex modes or null if the duplex mode is unknown or unsupported.

Type: 
string | null

getI18n() → {string}

Get a long description string for the device.

Returns:

Returns a string containing the type description and device name for non-WiFi devices or operation mode and SSID for WiFi ones.

Type: 
string

getIP6Addrs() → {Array.<string>}

Get the IPv6 addresses configured on the device.

Returns:

Returns an array of IPv6 address strings.

Type: 
Array.<string>

getIPAddrs() → {Array.<string>}

Get the IPv4 addresses configured on the device.

Returns:

Returns an array of IPv4 address strings.

Type: 
Array.<string>

getMAC() → {null|string}

Get the MAC address of the device.

Returns:

Returns the MAC address of the device or null if not applicable, e.g. for non-Ethernet tunnel devices.

Type: 
null | string

getMTU() → {number}

Get the MTU of the device.

Returns:

Returns the MTU of the device.

Type: 
number

getName() → {string}

Get the name of the network device.

Returns:

Returns the name of the device, e.g. eth0 or wlan0.

Type: 
string

getNetwork() → {null|LuCI.network.Protocol}

Get the primary logical interface this device is assigned to.

Returns:

Returns a Network.Protocol instance representing the logical interface this device is attached to or null if it is not assigned to any logical interface.

Type: 
null | LuCI.network.Protocol

getNetworks() → {Array.<LuCI.network.Protocol>}

Get the logical interfaces this device is assigned to.

Returns:

Returns an array of Network.Protocol instances representing the logical interfaces this device is assigned to.

Type: 
Array.<LuCI.network.Protocol>

getPSE() → {Object|null}

Get the PSE (Power Sourcing Equipment / PoE) status of the device.

Returns:

Returns an object containing PSE status information or null if PSE is not available on this device. The object may contain:

  • c33AdminState: "enabled" or "disabled" (C33 PoE admin state)
  • c33PowerStatus: "disabled", "searching", "delivering", "test", "fault", "otherfault"
  • c33PowerClass: Power class number (1-8)
  • c33ActualPower: Actual power consumption in mW
  • c33AvailablePowerLimit: Available power limit in mW
  • podlAdminState: "enabled" or "disabled" (PoDL admin state)
  • podlPowerStatus: "disabled", "searching", "delivering", "sleep", "idle", "error"
  • priority: Current priority level
  • priorityMax: Maximum priority level
Type: 
Object | null

getParent() → {null|LuCI.network.Device}

Get the logical parent device of this device.

In case of DSA switch ports, the parent device will be the DSA switch device itself, for VLAN devices, the parent refers to the base device etc.

Returns:

Returns a Network.Device instance representing the parent device or null when this device has no parent, as it is the case for e.g. ordinary Ethernet interfaces.

Type: 
null | LuCI.network.Device

getPorts() → {null|Array.<LuCI.network.Device>}

Get the associated bridge ports of the device.

Returns:

Returns an array of Network.Device instances representing the ports (slave interfaces) of the bridge or null when this device isn't a Linux bridge.

Type: 
null | Array.<LuCI.network.Device>

getRXBytes() → {number}

Get the amount of received bytes.

Returns:

Returns the amount of bytes received by the network device.

Type: 
number

getRXPackets() → {number}

Get the amount of received packets.

Returns:

Returns the amount of packets received by the network device.

Type: 
number

getShortName() → {string}

Get a short description string for the device.

Returns:

Returns the device name for non-WiFi devices or a string containing the operation mode and SSID for WiFi devices.

Type: 
string

getSpeed() → {number|null}

Get the current link speed of the network device if available.

Returns:

Returns the current speed of the network device in Mbps. If the device supports no Ethernet speed levels, null is returned. If the device supports Ethernet speeds but has no carrier, -1 is returned.

Type: 
number | null

getTXBytes() → {number}

Get the amount of transmitted bytes.

Returns:

Returns the amount of bytes transmitted by the network device.

Type: 
number

getTXPackets() → {number}

Get the amount of transmitted packets.

Returns:

Returns the amount of packets transmitted by the network device.

Type: 
number

getType() → {string}

Get the type of the device.

Returns:

Returns a string describing the type of the network device:

  • alias if it is an abstract alias device (@ notation)
  • wifi if it is a wireless interface (e.g. wlan0)
  • bridge if it is a bridge device (e.g. br-lan)
  • tunnel if it is a tun or tap device (e.g. tun0)
  • vlan if it is a vlan device (e.g. eth0.1)
  • vrf if it is a Virtual Routing and Forwarding type (e.g. vrf0)
  • switch if it is a switch device (e.g.eth1 connected to switch0)
  • ethernet for all other device types
Type: 
string

getTypeI18n() → {string}

Get a string describing the device type.

Returns:

Returns a string describing the type, e.g. "Wireless Adapter" or "Bridge".

Type: 
string

getWifiNetwork() → {null|LuCI.network.WifiNetwork}

Get the related wireless network this device is related to.

Returns:

Returns a Network.WifiNetwork instance representing the wireless network corresponding to this network device or null if this device is not a wireless device.

Type: 
null | LuCI.network.WifiNetwork

hasPSE() → {boolean}

Check if PSE (PoE) is available on this device.

Returns:

Returns true if PSE hardware is available on this device.

Type: 
boolean

isBridge() → {boolean}

Checks whether this device is a Linux bridge.

Returns:

Returns true when the network device is present and a Linux bridge, else false.

Type: 
boolean

isBridgePort() → {boolean}

Checks whether this device is part of a Linux bridge.

Returns:

Returns true when this network device is part of a bridge, else false.

Type: 
boolean

isUp() → {boolean}

Checks whether this device is up.

Returns:

Returns true when the associated device is running or false when it is down or absent.

Type: 
boolean
LuCI Documentation
\ No newline at end of file diff --git a/LuCI.network.Hosts.html b/LuCI.network.Hosts.html index 58346a5906..3b8586fdff 100644 --- a/LuCI.network.Hosts.html +++ b/LuCI.network.Hosts.html @@ -1,3 +1,3 @@ Class: Hosts
On this page

LuCI.network. Hosts

The LuCI.network.Hosts class encapsulates host information aggregated from multiple sources and provides convenience functions to access the host information by different criteria.

Methods

getHostnameByIP6Addr(ip6addr) → {null|string}

Look up the hostname associated with the given IPv6 address.

Parameters:
NameTypeDescription
ip6addrstring

The IPv6 address to look up.

Returns:

Returns the hostname associated with the given IPv6 or null if no matching host could be found or if no hostname is known for the corresponding host.

Type: 
null | string

getHostnameByIPAddr(ipaddr) → {null|string}

Look up the hostname associated with the given IPv4 address.

Parameters:
NameTypeDescription
ipaddrstring

The IPv4 address to look up.

Returns:

Returns the hostname associated with the given IPv4 or null if no matching host could be found or if no hostname is known for the corresponding host.

Type: 
null | string

getHostnameByMACAddr(mac) → {null|string}

Look up the hostname associated with the given MAC address.

Parameters:
NameTypeDescription
macstring

The MAC address to look up.

Returns:

Returns the hostname associated with the given MAC or null if no matching host could be found or if no hostname is known for the corresponding host.

Type: 
null | string

getIP6AddrByMACAddr(mac) → {null|string}

Look up the IPv6 address associated with the given MAC address.

Parameters:
NameTypeDescription
macstring

The MAC address to look up.

Returns:

Returns the IPv6 address associated with the given MAC or null if no matching host could be found or if no IPv6 address is known for the corresponding host.

Type: 
null | string

getIPAddrByMACAddr(mac) → {null|string}

Look up the IPv4 address associated with the given MAC address.

Parameters:
NameTypeDescription
macstring

The MAC address to look up.

Returns:

Returns the IPv4 address associated with the given MAC or null if no matching host could be found or if no IPv4 address is known for the corresponding host.

Type: 
null | string

getMACAddrByIP6Addr(ip6addr) → {null|string}

Look up the MAC address associated with the given IPv6 address.

Parameters:
NameTypeDescription
ip6addrstring

The IPv6 address to look up.

Returns:

Returns the MAC address associated with the given IPv6 or null if no matching host could be found or if no MAC address is known for the corresponding host.

Type: 
null | string

getMACAddrByIPAddr(ipaddr) → {null|string}

Look up the MAC address associated with the given IPv4 address.

Parameters:
NameTypeDescription
ipaddrstring

The IPv4 address to look up.

Returns:

Returns the MAC address associated with the given IPv4 or null if no matching host could be found or if no MAC address is known for the corresponding host.

Type: 
null | string

getMACHints(preferIp6opt) → {Array.<Array.<string>>}

Return an array of (MAC address, name hint) tuples sorted by MAC address.

Parameters:
NameTypeAttributesDefaultDescription
preferIp6boolean<optional>
false

Whether to prefer IPv6 addresses (true) or IPv4 addresses (false) as name hint when no hostname is known for a specific MAC address.

Returns:

Returns an array of arrays containing a name hint for each found MAC address on the system. The array is sorted ascending by MAC.

Each item of the resulting array is a two element array with the MAC being the first element and the name hint being the second element. The name hint is either the hostname, an IPv4 or an IPv6 address related to the MAC address.

If no hostname but both IPv4 and IPv6 addresses are known, the preferIP6 flag specifies whether the IPv6 or the IPv4 address is used as hint.

Type: 
Array.<Array.<string>>
LuCI Documentation
\ No newline at end of file +
On this page

LuCI.network. Hosts

The LuCI.network.Hosts class encapsulates host information aggregated from multiple sources and provides convenience functions to access the host information by different criteria.

Methods

getHostnameByIP6Addr(ip6addr) → {null|string}

Look up the hostname associated with the given IPv6 address.

Parameters:
NameTypeDescription
ip6addrstring

The IPv6 address to look up.

Returns:

Returns the hostname associated with the given IPv6 or null if no matching host could be found or if no hostname is known for the corresponding host.

Type: 
null | string

getHostnameByIPAddr(ipaddr) → {null|string}

Look up the hostname associated with the given IPv4 address.

Parameters:
NameTypeDescription
ipaddrstring

The IPv4 address to look up.

Returns:

Returns the hostname associated with the given IPv4 or null if no matching host could be found or if no hostname is known for the corresponding host.

Type: 
null | string

getHostnameByMACAddr(mac) → {null|string}

Look up the hostname associated with the given MAC address.

Parameters:
NameTypeDescription
macstring

The MAC address to look up.

Returns:

Returns the hostname associated with the given MAC or null if no matching host could be found or if no hostname is known for the corresponding host.

Type: 
null | string

getIP6AddrByMACAddr(mac) → {null|string}

Look up the IPv6 address associated with the given MAC address.

Parameters:
NameTypeDescription
macstring

The MAC address to look up.

Returns:

Returns the IPv6 address associated with the given MAC or null if no matching host could be found or if no IPv6 address is known for the corresponding host.

Type: 
null | string

getIPAddrByMACAddr(mac) → {null|string}

Look up the IPv4 address associated with the given MAC address.

Parameters:
NameTypeDescription
macstring

The MAC address to look up.

Returns:

Returns the IPv4 address associated with the given MAC or null if no matching host could be found or if no IPv4 address is known for the corresponding host.

Type: 
null | string

getMACAddrByIP6Addr(ip6addr) → {null|string}

Look up the MAC address associated with the given IPv6 address.

Parameters:
NameTypeDescription
ip6addrstring

The IPv6 address to look up.

Returns:

Returns the MAC address associated with the given IPv6 or null if no matching host could be found or if no MAC address is known for the corresponding host.

Type: 
null | string

getMACAddrByIPAddr(ipaddr) → {null|string}

Look up the MAC address associated with the given IPv4 address.

Parameters:
NameTypeDescription
ipaddrstring

The IPv4 address to look up.

Returns:

Returns the MAC address associated with the given IPv4 or null if no matching host could be found or if no MAC address is known for the corresponding host.

Type: 
null | string

getMACHints(preferIp6opt) → {Array.<Array.<string>>}

Return an array of (MAC address, name hint) tuples sorted by MAC address.

Parameters:
NameTypeAttributesDefaultDescription
preferIp6boolean<optional>
false

Whether to prefer IPv6 addresses (true) or IPv4 addresses (false) as name hint when no hostname is known for a specific MAC address.

Returns:

Returns an array of arrays containing a name hint for each found MAC address on the system. The array is sorted ascending by MAC.

Each item of the resulting array is a two element array with the MAC being the first element and the name hint being the second element. The name hint is either the hostname, an IPv4 or an IPv6 address related to the MAC address.

If no hostname but both IPv4 and IPv6 addresses are known, the preferIP6 flag specifies whether the IPv6 or the IPv4 address is used as hint.

Type: 
Array.<Array.<string>>
LuCI Documentation
\ No newline at end of file diff --git a/LuCI.network.Protocol.html b/LuCI.network.Protocol.html index a3d7467559..2331e218fa 100644 --- a/LuCI.network.Protocol.html +++ b/LuCI.network.Protocol.html @@ -1,3 +1,3 @@ Class: Protocol
On this page

LuCI.network. Protocol

The Network.Protocol class serves as the base for protocol-specific subclasses which describe logical UCI networks defined by config interface sections in /etc/config/network.

Methods

addDevice(device) → {boolean}

Add the given network device to the logical interface.

Parameters:
NameTypeDescription
deviceLuCI.network.Protocol | LuCI.network.Device | LuCI.network.WifiDevice | LuCI.network.WifiNetwork | string

The object or device name to add to the logical interface. In case the given argument is not a string, it is resolved though the Network.getIfnameOf() function.

Returns:

Returns true if the device name has been added or false if any argument was invalid, if the device was already part of the logical interface or if the logical interface is virtual.

Type: 
boolean

containsDevice(device) → {boolean}

Checks whether this logical interface contains the given device object.

Parameters:
NameTypeDescription
deviceLuCI.network.Protocol | LuCI.network.Device | LuCI.network.WifiDevice | LuCI.network.WifiNetwork | string

The object or device name to check. In case the given argument is not a string, it is resolved though the Network.getIfnameOf() function.

Returns:

Returns true when this logical interface contains the given network device or false if not.

Type: 
boolean

(abstract) deleteConfiguration() → {*|Promise.<*>}

Cleanup related configuration entries.

This function will be invoked if an interface is about to be removed from the configuration and is responsible for performing any required cleanup tasks, such as unsetting uci entries in related configurations.

It should be overridden by protocol specific subclasses.

Returns:

This function may return a promise which is awaited before the rest of the configuration is removed. Any non-promise return value and any resolved promise value is ignored. If the returned promise is rejected, the interface removal will be aborted.

Type: 
* | Promise.<*>

deleteDevice(device) → {boolean}

Remove the given network device from the logical interface.

Parameters:
NameTypeDescription
deviceLuCI.network.Protocol | LuCI.network.Device | LuCI.network.WifiDevice | LuCI.network.WifiNetwork | string

The object or device name to remove from the logical interface. In case the given argument is not a string, it is resolved though the Network.getIfnameOf() function.

Returns:

Returns true if the device name has been added or false if any argument was invalid, if the device was already part of the logical interface or if the logical interface is virtual.

Type: 
boolean

get(opt) → {null|string|Array.<string>}

Read the given UCI option value of this network.

Parameters:
NameTypeDescription
optstring

The UCI option name to read.

Returns:

Returns the UCI option value or null if the requested option is not found.

Type: 
null | string | Array.<string>

getDNS6Addrs() → {Array.<string>}

Query the IPv6 DNS servers associated with the logical interface.

Returns:

Returns an array of IPv6 DNS servers registered by the remote protocol back-end.

Type: 
Array.<string>

getDNSAddrs() → {Array.<string>}

Query the IPv4 DNS servers associated with the logical interface.

Returns:

Returns an array of IPv4 DNS servers registered by the remote protocol back-end.

Type: 
Array.<string>

getDevice() → {LuCI.network.Device}

Returns the Linux network device associated with this logical interface.

Returns:

Returns a Network.Device class instance representing the expected Linux network device according to the configuration.

Type: 
LuCI.network.Device

getDevices() → {null|Array.<LuCI.network.Device>}

Returns a list of network sub-devices associated with this logical interface.

Returns:

Returns an array of Network.Device class instances representing the sub-devices attached to this logical interface or null if the logical interface does not support sub-devices, e.g. because it is virtual and not a bridge.

Type: 
null | Array.<LuCI.network.Device>

getErrors() → {Array.<string>}

Query interface error messages published in ubus runtime state.

Interface errors are emitted by remote protocol handlers if the setup of the underlying logical interface failed, e.g. due to bad configuration or network connectivity issues.

This function will translate the found error codes to human readable messages using the descriptions registered by Network.registerErrorCode() and fall back to "Unknown error (%s)" where %s is replaced by the error code in case no translation can be found.

Returns:

Returns an array of translated interface error messages.

Type: 
Array.<string>

getExpiry() → {number}

Get the logical interface expiry time in seconds.

For protocols that have a concept of a lease, such as DHCP or DHCPv6, this function returns the remaining time in seconds until the lease expires.

Returns:

Returns the number of seconds until the lease expires or -1 if it isn't applicable to the associated protocol.

Type: 
number

getGateway6Addr() → {string}

Query the gateway (nexthop) of the IPv6 default route associated with this logical interface.

Returns:

Returns a string containing the IPv6 nexthop address of the associated default route or null if no default route was found.

Type: 
string

getGatewayAddr() → {string}

Query the gateway (nexthop) of the default route associated with this logical interface.

Returns:

Returns a string containing the IPv4 nexthop address of the associated default route or null if no default route was found.

Type: 
string

(abstract) getI18n() → {string}

Return a human readable description for the protocol, such as Static address or DHCP client.

This function should be overridden by subclasses.

Returns:

Returns the description string.

Type: 
string

getIP6Addr() → {null|string}

Query the first (primary) IPv6 address of the logical interface.

Returns:

Returns the primary IPv6 address registered by the protocol handler in CIDR notation or null if no IPv6 addresses were set.

Type: 
null | string

getIP6Addrs() → {Array.<string>}

Query all IPv6 addresses of the logical interface.

Returns:

Returns an array of IPv6 addresses in CIDR notation which have been registered by the protocol handler. The order of the resulting array follows the order of the addresses in ubus runtime information.

Type: 
Array.<string>

getIP6Prefix() → {null|string}

Query the routed IPv6 prefix associated with the logical interface.

Returns:

Returns the routed IPv6 prefix registered by the remote protocol handler or null if no prefix is present.

Type: 
null | string

getIP6Prefixes() → {null|Array.<string>}

Query the routed IPv6 prefixes associated with the logical interface.

Returns:

Returns an array of the routed IPv6 prefixes registered by the remote protocol handler or null if no prefixes are present.

Type: 
null | Array.<string>

getIPAddr() → {null|string}

Query the first (primary) IPv4 address of the logical interface.

Returns:

Returns the primary IPv4 address registered by the protocol handler or null if no IPv4 addresses were set.

Type: 
null | string

getIPAddrs() → {Array.<string>}

Query all IPv4 addresses of the logical interface.

Returns:

Returns an array of IPv4 addresses in CIDR notation which have been registered by the protocol handler. The order of the resulting array follows the order of the addresses in ubus runtime information.

Type: 
Array.<string>

getIfname() → {null|string}

Get the associated Linux network device of this network.

Returns:

Returns the name of the associated network device or null if it could not be determined.

Type: 
null | string

getL2Device() → {LuCI.network.Device}

Returns the layer 2 Linux network device currently associated with this logical interface.

Returns:

Returns a Network.Device class instance representing the Linux network device currently associated with the logical interface.

Type: 
LuCI.network.Device

getL3Device() → {LuCI.network.Device}

Returns the layer 3 Linux network device currently associated with this logical interface.

Returns:

Returns a Network.Device class instance representing the Linux network device currently associated with the logical interface.

Type: 
LuCI.network.Device

getMetric() → {number}

Get the metric value of the logical interface.

Returns:

Returns the current metric value used for device and network routes spawned by the associated logical interface.

Type: 
number

getName() → {string}

Get the name of the associated logical interface.

Returns:

Returns the logical interface name, such as lan or wan.

Type: 
string

getNetmask() → {null|string}

Query the first (primary) IPv4 netmask of the logical interface.

Returns:

Returns the netmask of the primary IPv4 address registered by the protocol handler or null if no IPv4 addresses were set.

Type: 
null | string

(abstract) getPackageName() → {string}

Gets the name of the package providing the protocol functionality. The package is available via the system default package manager. This is used when a config refers to a protocol handler which is not yet installed.

This function should be overridden by protocol specific subclasses.

Returns:

Returns the name of the package to download, required for the protocol to function, e.g. odhcp6c for the dhcpv6 protocol.

Type: 
string

(abstract) getProtocol() → {string}

Get the name of this network protocol class.

This function will be overridden by subclasses created by Network.registerProtocol().

Returns:

Returns the name of the network protocol implementation, e.g. static or dhcp.

Type: 
string

getType() → {null|string}

Get the type of the underlying interface.

This function actually is a convenience wrapper around proto.get("type") and is mainly used by other LuCI.network code to check whether the interface is declared as bridge in UCI.

Returns:

Returns the value of the type option of the associated logical interface or null if no type option is set.

Type: 
null | string

getUptime() → {number}

Get the uptime of the logical interface.

Returns:

Returns the uptime of the associated interface in seconds.

Type: 
number

getZoneName() → {null|string}

Get the requested firewall zone name of the logical interface.

Some protocol implementations request a specific firewall zone to trigger inclusion of their resulting network devices into the firewall rule set.

Returns:

Returns the requested firewall zone name as published in the ubus runtime information or null if the remote protocol handler didn't request a zone.

Type: 
null | string

isAlias() → {null|string}

Checks whether this interface is an alias interface.

Alias interfaces are interfaces layering on top of another interface and are denoted by a special @interfacename notation in the underlying device option.

Returns:

Returns the name of the parent interface if this logical interface is an alias or null if it is not an alias interface.

Type: 
null | string

isBridge() → {boolean}

Checks whether the underlying logical interface is declared as bridge.

Returns:

Returns true when the interface is declared with option type bridge and when the associated protocol implementation is not marked virtual or false when the logical interface is no bridge.

Type: 
boolean

(abstract) isCreateable(ifname) → {Promise.<void>}

Check function for the protocol handler if a new interface is creatable.

This function should be overridden by protocol specific subclasses.

Parameters:
NameTypeDescription
ifnamestring

The name of the interface to be created.

Returns:

Returns a promise resolving if a new interface is creatable, else rejects with an error message string.

Type: 
Promise.<void>

isDynamic() → {boolean}

Checks whether this logical interface is dynamic.

A dynamic interface is an interface that has been created at runtime. E.g. as a sub-interface of another interface, but which is not backed by any user configuration. Such dynamic interfaces cannot be edited but only brought down or restarted.

Returns:

Returns a boolean indicating whether this interface is dynamic (true) or not (false).

Type: 
boolean

isEmpty() → {boolean}

Checks whether this logical interface is "empty", where empty means that it has no network devices attached.

Returns:

Returns true if this logical interface is empty, else false.

Type: 
boolean

isFloating() → {boolean}

Checks whether this protocol is "floating".

A "floating" protocol is a protocol which spawns its own interfaces on demand, like a virtual one but which relies on an existing lower level interface to initiate the connection.

An example for such a protocol is "pppoe".

This function exists for backwards compatibility with older code but should not be used anymore.

Deprecated
  • Yes
Returns:

Returns a boolean indicating whether this protocol is floating (true) or not (false).

Type: 
boolean

(abstract) isInstalled() → {boolean}

Checks whether the protocol functionality is installed.

This function exists for compatibility with old code, it always returns true.

Deprecated
  • Yes
Returns:

Returns true if the protocol support is installed, else false.

Type: 
boolean

isPending() → {boolean}

Checks whether this logical interface is pending.

Returns:

returns true when the interface is pending or false when it is not.

Type: 
boolean

isUp() → {boolean}

Checks whether this logical interface is configured and running.

Returns:

Returns true when the interface is active or false when it is not.

Type: 
boolean

isVirtual() → {boolean}

Checks whether this protocol is "virtual".

A "virtual" protocol is a protocol which spawns its own interfaces on demand instead of using existing physical interfaces.

Examples for virtual protocols are 6in4 which gre spawn a tunnel network device on startup, examples for non-virtual protocols are dhcp or static which apply IP configuration to existing interfaces.

This function should be overridden by subclasses.

Returns:

Returns a boolean indicating whether the underlying protocol spawns dynamic interfaces (true) or not (false).

Type: 
boolean

set(opt, val) → {null}

Set the given UCI option of this network to the given value.

Parameters:
NameTypeDescription
optstring

The name of the UCI option to set.

valnull | string | Array.<string>

The value to set or null to remove the given option from the configuration.

Returns:
Type: 
null
LuCI Documentation
\ No newline at end of file +
On this page

LuCI.network. Protocol

The Network.Protocol class serves as the base for protocol-specific subclasses which describe logical UCI networks defined by config interface sections in /etc/config/network.

Methods

addDevice(device) → {boolean}

Add the given network device to the logical interface.

Parameters:
NameTypeDescription
deviceLuCI.network.Protocol | LuCI.network.Device | LuCI.network.WifiDevice | LuCI.network.WifiNetwork | string

The object or device name to add to the logical interface. In case the given argument is not a string, it is resolved though the Network.getIfnameOf() function.

Returns:

Returns true if the device name has been added or false if any argument was invalid, if the device was already part of the logical interface or if the logical interface is virtual.

Type: 
boolean

containsDevice(device) → {boolean}

Checks whether this logical interface contains the given device object.

Parameters:
NameTypeDescription
deviceLuCI.network.Protocol | LuCI.network.Device | LuCI.network.WifiDevice | LuCI.network.WifiNetwork | string

The object or device name to check. In case the given argument is not a string, it is resolved though the Network.getIfnameOf() function.

Returns:

Returns true when this logical interface contains the given network device or false if not.

Type: 
boolean

(abstract) deleteConfiguration() → {*|Promise.<*>}

Cleanup related configuration entries.

This function will be invoked if an interface is about to be removed from the configuration and is responsible for performing any required cleanup tasks, such as unsetting uci entries in related configurations.

It should be overridden by protocol specific subclasses.

Returns:

This function may return a promise which is awaited before the rest of the configuration is removed. Any non-promise return value and any resolved promise value is ignored. If the returned promise is rejected, the interface removal will be aborted.

Type: 
* | Promise.<*>

deleteDevice(device) → {boolean}

Remove the given network device from the logical interface.

Parameters:
NameTypeDescription
deviceLuCI.network.Protocol | LuCI.network.Device | LuCI.network.WifiDevice | LuCI.network.WifiNetwork | string

The object or device name to remove from the logical interface. In case the given argument is not a string, it is resolved though the Network.getIfnameOf() function.

Returns:

Returns true if the device name has been added or false if any argument was invalid, if the device was already part of the logical interface or if the logical interface is virtual.

Type: 
boolean

get(opt) → {null|string|Array.<string>}

Read the given UCI option value of this network.

Parameters:
NameTypeDescription
optstring

The UCI option name to read.

Returns:

Returns the UCI option value or null if the requested option is not found.

Type: 
null | string | Array.<string>

getDNS6Addrs() → {Array.<string>}

Query the IPv6 DNS servers associated with the logical interface.

Returns:

Returns an array of IPv6 DNS servers registered by the remote protocol back-end.

Type: 
Array.<string>

getDNSAddrs() → {Array.<string>}

Query the IPv4 DNS servers associated with the logical interface.

Returns:

Returns an array of IPv4 DNS servers registered by the remote protocol back-end.

Type: 
Array.<string>

getDevice() → {LuCI.network.Device}

Returns the Linux network device associated with this logical interface.

Returns:

Returns a Network.Device class instance representing the expected Linux network device according to the configuration.

Type: 
LuCI.network.Device

getDevices() → {null|Array.<LuCI.network.Device>}

Returns a list of network sub-devices associated with this logical interface.

Returns:

Returns an array of Network.Device class instances representing the sub-devices attached to this logical interface or null if the logical interface does not support sub-devices, e.g. because it is virtual and not a bridge.

Type: 
null | Array.<LuCI.network.Device>

getErrors() → {Array.<string>}

Query interface error messages published in ubus runtime state.

Interface errors are emitted by remote protocol handlers if the setup of the underlying logical interface failed, e.g. due to bad configuration or network connectivity issues.

This function will translate the found error codes to human readable messages using the descriptions registered by Network.registerErrorCode() and fall back to "Unknown error (%s)" where %s is replaced by the error code in case no translation can be found.

Returns:

Returns an array of translated interface error messages.

Type: 
Array.<string>

getExpiry() → {number}

Get the logical interface expiry time in seconds.

For protocols that have a concept of a lease, such as DHCP or DHCPv6, this function returns the remaining time in seconds until the lease expires.

Returns:

Returns the number of seconds until the lease expires or -1 if it isn't applicable to the associated protocol.

Type: 
number

getGateway6Addr() → {string}

Query the gateway (nexthop) of the IPv6 default route associated with this logical interface.

Returns:

Returns a string containing the IPv6 nexthop address of the associated default route or null if no default route was found.

Type: 
string

getGatewayAddr() → {string}

Query the gateway (nexthop) of the default route associated with this logical interface.

Returns:

Returns a string containing the IPv4 nexthop address of the associated default route or null if no default route was found.

Type: 
string

(abstract) getI18n() → {string}

Return a human readable description for the protocol, such as Static address or DHCP client.

This function should be overridden by subclasses.

Returns:

Returns the description string.

Type: 
string

getIP6Addr() → {null|string}

Query the first (primary) IPv6 address of the logical interface.

Returns:

Returns the primary IPv6 address registered by the protocol handler in CIDR notation or null if no IPv6 addresses were set.

Type: 
null | string

getIP6Addrs() → {Array.<string>}

Query all IPv6 addresses of the logical interface.

Returns:

Returns an array of IPv6 addresses in CIDR notation which have been registered by the protocol handler. The order of the resulting array follows the order of the addresses in ubus runtime information.

Type: 
Array.<string>

getIP6Prefix() → {null|string}

Query the routed IPv6 prefix associated with the logical interface.

Returns:

Returns the routed IPv6 prefix registered by the remote protocol handler or null if no prefix is present.

Type: 
null | string

getIP6Prefixes() → {null|Array.<string>}

Query the routed IPv6 prefixes associated with the logical interface.

Returns:

Returns an array of the routed IPv6 prefixes registered by the remote protocol handler or null if no prefixes are present.

Type: 
null | Array.<string>

getIPAddr() → {null|string}

Query the first (primary) IPv4 address of the logical interface.

Returns:

Returns the primary IPv4 address registered by the protocol handler or null if no IPv4 addresses were set.

Type: 
null | string

getIPAddrs() → {Array.<string>}

Query all IPv4 addresses of the logical interface.

Returns:

Returns an array of IPv4 addresses in CIDR notation which have been registered by the protocol handler. The order of the resulting array follows the order of the addresses in ubus runtime information.

Type: 
Array.<string>

getIfname() → {null|string}

Get the associated Linux network device of this network.

Returns:

Returns the name of the associated network device or null if it could not be determined.

Type: 
null | string

getL2Device() → {LuCI.network.Device}

Returns the layer 2 Linux network device currently associated with this logical interface.

Returns:

Returns a Network.Device class instance representing the Linux network device currently associated with the logical interface.

Type: 
LuCI.network.Device

getL3Device() → {LuCI.network.Device}

Returns the layer 3 Linux network device currently associated with this logical interface.

Returns:

Returns a Network.Device class instance representing the Linux network device currently associated with the logical interface.

Type: 
LuCI.network.Device

getMetric() → {number}

Get the metric value of the logical interface.

Returns:

Returns the current metric value used for device and network routes spawned by the associated logical interface.

Type: 
number

getName() → {string}

Get the name of the associated logical interface.

Returns:

Returns the logical interface name, such as lan or wan.

Type: 
string

getNetmask() → {null|string}

Query the first (primary) IPv4 netmask of the logical interface.

Returns:

Returns the netmask of the primary IPv4 address registered by the protocol handler or null if no IPv4 addresses were set.

Type: 
null | string

(abstract) getPackageName() → {string}

Gets the name of the package providing the protocol functionality. The package is available via the system default package manager. This is used when a config refers to a protocol handler which is not yet installed.

This function should be overridden by protocol specific subclasses.

Returns:

Returns the name of the package to download, required for the protocol to function, e.g. odhcp6c for the dhcpv6 protocol.

Type: 
string

(abstract) getProtocol() → {string}

Get the name of this network protocol class.

This function will be overridden by subclasses created by Network.registerProtocol().

Returns:

Returns the name of the network protocol implementation, e.g. static or dhcp.

Type: 
string

getType() → {null|string}

Get the type of the underlying interface.

This function actually is a convenience wrapper around proto.get("type") and is mainly used by other LuCI.network code to check whether the interface is declared as bridge in UCI.

Returns:

Returns the value of the type option of the associated logical interface or null if no type option is set.

Type: 
null | string

getUptime() → {number}

Get the uptime of the logical interface.

Returns:

Returns the uptime of the associated interface in seconds.

Type: 
number

getZoneName() → {null|string}

Get the requested firewall zone name of the logical interface.

Some protocol implementations request a specific firewall zone to trigger inclusion of their resulting network devices into the firewall rule set.

Returns:

Returns the requested firewall zone name as published in the ubus runtime information or null if the remote protocol handler didn't request a zone.

Type: 
null | string

isAlias() → {null|string}

Checks whether this interface is an alias interface.

Alias interfaces are interfaces layering on top of another interface and are denoted by a special @interfacename notation in the underlying device option.

Returns:

Returns the name of the parent interface if this logical interface is an alias or null if it is not an alias interface.

Type: 
null | string

isBridge() → {boolean}

Checks whether the underlying logical interface is declared as bridge.

Returns:

Returns true when the interface is declared with option type bridge and when the associated protocol implementation is not marked virtual or false when the logical interface is no bridge.

Type: 
boolean

(abstract) isCreateable(ifname) → {Promise.<void>}

Check function for the protocol handler if a new interface is creatable.

This function should be overridden by protocol specific subclasses.

Parameters:
NameTypeDescription
ifnamestring

The name of the interface to be created.

Returns:

Returns a promise resolving if a new interface is creatable, else rejects with an error message string.

Type: 
Promise.<void>

isDynamic() → {boolean}

Checks whether this logical interface is dynamic.

A dynamic interface is an interface that has been created at runtime. E.g. as a sub-interface of another interface, but which is not backed by any user configuration. Such dynamic interfaces cannot be edited but only brought down or restarted.

Returns:

Returns a boolean indicating whether this interface is dynamic (true) or not (false).

Type: 
boolean

isEmpty() → {boolean}

Checks whether this logical interface is "empty", where empty means that it has no network devices attached.

Returns:

Returns true if this logical interface is empty, else false.

Type: 
boolean

isFloating() → {boolean}

Checks whether this protocol is "floating".

A "floating" protocol is a protocol which spawns its own interfaces on demand, like a virtual one but which relies on an existing lower level interface to initiate the connection.

An example for such a protocol is "pppoe".

This function exists for backwards compatibility with older code but should not be used anymore.

Deprecated
  • Yes
Returns:

Returns a boolean indicating whether this protocol is floating (true) or not (false).

Type: 
boolean

(abstract) isInstalled() → {boolean}

Checks whether the protocol functionality is installed.

This function exists for compatibility with old code, it always returns true.

Deprecated
  • Yes
Returns:

Returns true if the protocol support is installed, else false.

Type: 
boolean

isPending() → {boolean}

Checks whether this logical interface is pending.

Returns:

returns true when the interface is pending or false when it is not.

Type: 
boolean

isUp() → {boolean}

Checks whether this logical interface is configured and running.

Returns:

Returns true when the interface is active or false when it is not.

Type: 
boolean

isVirtual() → {boolean}

Checks whether this protocol is "virtual".

A "virtual" protocol is a protocol which spawns its own interfaces on demand instead of using existing physical interfaces.

Examples for virtual protocols are 6in4 which gre spawn a tunnel network device on startup, examples for non-virtual protocols are dhcp or static which apply IP configuration to existing interfaces.

This function should be overridden by subclasses.

Returns:

Returns a boolean indicating whether the underlying protocol spawns dynamic interfaces (true) or not (false).

Type: 
boolean

set(opt, val) → {null}

Set the given UCI option of this network to the given value.

Parameters:
NameTypeDescription
optstring

The name of the UCI option to set.

valnull | string | Array.<string>

The value to set or null to remove the given option from the configuration.

Returns:
Type: 
null
LuCI Documentation
\ No newline at end of file diff --git a/LuCI.network.WifiDevice.html b/LuCI.network.WifiDevice.html index dc747153e8..bff3ea6dbc 100644 --- a/LuCI.network.WifiDevice.html +++ b/LuCI.network.WifiDevice.html @@ -1,3 +1,3 @@ Class: WifiDevice
On this page

LuCI.network. WifiDevice

A Network.WifiDevice class instance represents a wireless radio device present on the system and provides wireless capability information as well as methods for enumerating related wireless networks.

Methods

addWifiNetwork(optionsopt) → {Promise.<(null|LuCI.network.WifiNetwork)>}

Adds a new wireless network associated with this radio device to the configuration and sets its options to the provided values.

Parameters:
NameTypeAttributesDescription
optionsObject.<string, (string|Array.<string>)><optional>

The options to set for the newly added wireless network.

Returns:

Returns a promise resolving to a WifiNetwork instance describing the newly added wireless network or null if the given options were invalid.

Type: 
Promise.<(null|LuCI.network.WifiNetwork)>

deleteWifiNetwork(network) → {Promise.<boolean>}

Deletes the wireless network with the given name associated with this radio device.

Parameters:
NameTypeDescription
networkstring

The name of the wireless network to look up. This may be either an uci configuration section ID, a network ID in the form radio#.network# or a Linux network device name like wlan0 which is resolved to the corresponding configuration section through ubus runtime information.

Returns:

Returns a promise resolving to true when the wireless network was successfully deleted from the configuration or false when the given network could not be found or if the found network was not associated with this wireless radio device.

Type: 
Promise.<boolean>

get(opt) → {null|string|Array.<string>}

Read the given UCI option value of this wireless device.

Parameters:
NameTypeDescription
optstring

The UCI option name to read.

Returns:

Returns the UCI option value or null if the requested option is not found.

Type: 
null | string | Array.<string>

getHTModes() → {Array.<string>}

Gets a list of supported htmodes.

The htmode values describe the wide-frequency options supported by the wireless phy.

Returns:

Returns an array of valid htmode values for this radio. Currently known mode values are:

  • HT20 - applicable to IEEE 802.11n, 20 MHz wide channels
  • HT40 - applicable to IEEE 802.11n, 40 MHz wide channels
  • VHT20 - applicable to IEEE 802.11ac, 20 MHz wide channels
  • VHT40 - applicable to IEEE 802.11ac, 40 MHz wide channels
  • VHT80 - applicable to IEEE 802.11ac, 80 MHz wide channels
  • VHT160 - applicable to IEEE 802.11ac, 160 MHz wide channels
  • HE20 - applicable to IEEE 802.11ax, 20 MHz wide channels
  • HE40 - applicable to IEEE 802.11ax, 40 MHz wide channels
  • HE80 - applicable to IEEE 802.11ax, 80 MHz wide channels
  • HE160 - applicable to IEEE 802.11ax, 160 MHz wide channels
  • EHT20 - applicable to IEEE 802.11be, 20 MHz wide channels
  • EHT40 - applicable to IEEE 802.11be, 40 MHz wide channels
  • EHT80 - applicable to IEEE 802.11be, 80 MHz wide channels
  • EHT160 - applicable to IEEE 802.11be, 160 MHz wide channels
  • EHT320 - applicable to IEEE 802.11be, 320 MHz wide channels
Type: 
Array.<string>

getHWModes() → {Array.<string>}

Gets a list of supported hwmodes.

The hwmode values describe the frequency band and wireless standard versions supported by the wireless phy.

Returns:

Returns an array of valid hwmode values for this radio. Currently known mode values are:

  • a - Legacy 802.11a mode, 5 GHz, up to 54 Mbit/s
  • b - Legacy 802.11b mode, 2.4 GHz, up to 11 Mbit/s
  • g - Legacy 802.11g mode, 2.4 GHz, up to 54 Mbit/s
  • n - IEEE 802.11n mode, 2.4 or 5 GHz, up to 600 Mbit/s
  • ac - IEEE 802.11ac mode, 5 GHz, up to 6770 Mbit/s
  • ax - IEEE 802.11ax mode, 2.4 or 5 GHz
  • 'be' - IEEE 802.11be mode, 2.4, 5 or 6 GHz
Type: 
Array.<string>

getI18n() → {string}

Get a string describing the wireless radio hardware.

Returns:

Returns the description string.

Type: 
string

getName() → {string}

Get the configuration name of this wireless radio.

Returns:

Returns the UCI section name (e.g. radio0) of the corresponding radio configuration, which also serves as a unique logical identifier for the wireless phy.

Type: 
string

getScanList() → {Promise.<Array.<LuCI.network.WifiScanResult>>}

Trigger a wireless scan on this radio device and obtain a list of nearby networks.

Returns:

Returns a promise resolving to an array of scan result objects describing the networks found in the vicinity.

Type: 
Promise.<Array.<LuCI.network.WifiScanResult>>

getWifiNetwork(network) → {Promise.<LuCI.network.WifiNetwork>}

Get the wifi network of the given name belonging to this radio device

Parameters:
NameTypeDescription
networkstring

The name of the wireless network to look up. This may be either an uci configuration section ID, a network ID in the form radio#.network# or a Linux network device name like wlan0 which is resolved to the corresponding configuration section through ubus runtime information.

Returns:

Returns a promise resolving to a Network.WifiNetwork instance representing the wireless network and rejecting with null if the given network could not be found or is not associated with this radio device.

Type: 
Promise.<LuCI.network.WifiNetwork>

getWifiNetworks() → {Promise.<Array.<LuCI.network.WifiNetwork>>}

Get all wireless networks associated with this wireless radio device.

Returns:

Returns a promise resolving to an array of Network.WifiNetwork instances representing the wireless networks associated with this radio device.

Type: 
Promise.<Array.<LuCI.network.WifiNetwork>>

isDisabled() → {boolean}

Checks whether this wireless radio is disabled.

Returns:

Returns true when the wireless radio is marked as disabled in ubus runtime state or when the disabled option is set in the corresponding UCI configuration.

Type: 
boolean

isUp() → {boolean}

Check whether the wireless radio is marked as up in the ubus runtime state.

Returns:

Returns true when the radio device is up, else false.

Type: 
boolean

set(opt, value) → {null}

Set the given UCI option of this network to the given value.

Parameters:
NameTypeDescription
optstring

The name of the UCI option to set.

valuenull | string | Array.<string>

The value to set or null to remove the given option from the configuration.

Returns:
Type: 
null
LuCI Documentation
\ No newline at end of file +
On this page

LuCI.network. WifiDevice

A Network.WifiDevice class instance represents a wireless radio device present on the system and provides wireless capability information as well as methods for enumerating related wireless networks.

Methods

addWifiNetwork(optionsopt) → {Promise.<(null|LuCI.network.WifiNetwork)>}

Adds a new wireless network associated with this radio device to the configuration and sets its options to the provided values.

Parameters:
NameTypeAttributesDescription
optionsObject.<string, (string|Array.<string>)><optional>

The options to set for the newly added wireless network.

Returns:

Returns a promise resolving to a WifiNetwork instance describing the newly added wireless network or null if the given options were invalid.

Type: 
Promise.<(null|LuCI.network.WifiNetwork)>

deleteWifiNetwork(network) → {Promise.<boolean>}

Deletes the wireless network with the given name associated with this radio device.

Parameters:
NameTypeDescription
networkstring

The name of the wireless network to look up. This may be either an uci configuration section ID, a network ID in the form radio#.network# or a Linux network device name like wlan0 which is resolved to the corresponding configuration section through ubus runtime information.

Returns:

Returns a promise resolving to true when the wireless network was successfully deleted from the configuration or false when the given network could not be found or if the found network was not associated with this wireless radio device.

Type: 
Promise.<boolean>

get(opt) → {null|string|Array.<string>}

Read the given UCI option value of this wireless device.

Parameters:
NameTypeDescription
optstring

The UCI option name to read.

Returns:

Returns the UCI option value or null if the requested option is not found.

Type: 
null | string | Array.<string>

getHTModes() → {Array.<string>}

Gets a list of supported htmodes.

The htmode values describe the wide-frequency options supported by the wireless phy.

Returns:

Returns an array of valid htmode values for this radio. Currently known mode values are:

  • HT20 - applicable to IEEE 802.11n, 20 MHz wide channels
  • HT40 - applicable to IEEE 802.11n, 40 MHz wide channels
  • VHT20 - applicable to IEEE 802.11ac, 20 MHz wide channels
  • VHT40 - applicable to IEEE 802.11ac, 40 MHz wide channels
  • VHT80 - applicable to IEEE 802.11ac, 80 MHz wide channels
  • VHT160 - applicable to IEEE 802.11ac, 160 MHz wide channels
  • HE20 - applicable to IEEE 802.11ax, 20 MHz wide channels
  • HE40 - applicable to IEEE 802.11ax, 40 MHz wide channels
  • HE80 - applicable to IEEE 802.11ax, 80 MHz wide channels
  • HE160 - applicable to IEEE 802.11ax, 160 MHz wide channels
  • EHT20 - applicable to IEEE 802.11be, 20 MHz wide channels
  • EHT40 - applicable to IEEE 802.11be, 40 MHz wide channels
  • EHT80 - applicable to IEEE 802.11be, 80 MHz wide channels
  • EHT160 - applicable to IEEE 802.11be, 160 MHz wide channels
  • EHT320 - applicable to IEEE 802.11be, 320 MHz wide channels
Type: 
Array.<string>

getHWModes() → {Array.<string>}

Gets a list of supported hwmodes.

The hwmode values describe the frequency band and wireless standard versions supported by the wireless phy.

Returns:

Returns an array of valid hwmode values for this radio. Currently known mode values are:

  • a - Legacy 802.11a mode, 5 GHz, up to 54 Mbit/s
  • b - Legacy 802.11b mode, 2.4 GHz, up to 11 Mbit/s
  • g - Legacy 802.11g mode, 2.4 GHz, up to 54 Mbit/s
  • n - IEEE 802.11n mode, 2.4 or 5 GHz, up to 600 Mbit/s
  • ac - IEEE 802.11ac mode, 5 GHz, up to 6770 Mbit/s
  • ax - IEEE 802.11ax mode, 2.4 or 5 GHz
  • 'be' - IEEE 802.11be mode, 2.4, 5 or 6 GHz
Type: 
Array.<string>

getI18n() → {string}

Get a string describing the wireless radio hardware.

Returns:

Returns the description string.

Type: 
string

getName() → {string}

Get the configuration name of this wireless radio.

Returns:

Returns the UCI section name (e.g. radio0) of the corresponding radio configuration, which also serves as a unique logical identifier for the wireless phy.

Type: 
string

getScanList() → {Promise.<Array.<LuCI.network.WifiScanResult>>}

Trigger a wireless scan on this radio device and obtain a list of nearby networks.

Returns:

Returns a promise resolving to an array of scan result objects describing the networks found in the vicinity.

Type: 
Promise.<Array.<LuCI.network.WifiScanResult>>

getWifiNetwork(network) → {Promise.<LuCI.network.WifiNetwork>}

Get the wifi network of the given name belonging to this radio device

Parameters:
NameTypeDescription
networkstring

The name of the wireless network to look up. This may be either an uci configuration section ID, a network ID in the form radio#.network# or a Linux network device name like wlan0 which is resolved to the corresponding configuration section through ubus runtime information.

Returns:

Returns a promise resolving to a Network.WifiNetwork instance representing the wireless network and rejecting with null if the given network could not be found or is not associated with this radio device.

Type: 
Promise.<LuCI.network.WifiNetwork>

getWifiNetworks() → {Promise.<Array.<LuCI.network.WifiNetwork>>}

Get all wireless networks associated with this wireless radio device.

Returns:

Returns a promise resolving to an array of Network.WifiNetwork instances representing the wireless networks associated with this radio device.

Type: 
Promise.<Array.<LuCI.network.WifiNetwork>>

isDisabled() → {boolean}

Checks whether this wireless radio is disabled.

Returns:

Returns true when the wireless radio is marked as disabled in ubus runtime state or when the disabled option is set in the corresponding UCI configuration.

Type: 
boolean

isUp() → {boolean}

Check whether the wireless radio is marked as up in the ubus runtime state.

Returns:

Returns true when the radio device is up, else false.

Type: 
boolean

set(opt, value) → {null}

Set the given UCI option of this network to the given value.

Parameters:
NameTypeDescription
optstring

The name of the UCI option to set.

valuenull | string | Array.<string>

The value to set or null to remove the given option from the configuration.

Returns:
Type: 
null
LuCI Documentation
\ No newline at end of file diff --git a/LuCI.network.WifiNetwork.html b/LuCI.network.WifiNetwork.html index 6a54546755..5dcaae0446 100644 --- a/LuCI.network.WifiNetwork.html +++ b/LuCI.network.WifiNetwork.html @@ -1,3 +1,3 @@ Class: WifiNetwork
On this page

LuCI.network. WifiNetwork

A Network.WifiNetwork instance represents a wireless network (vif) configured on top of a radio device and provides functions for querying the runtime state of the network. Most radio devices support multiple such networks in parallel.

Methods

disconnectClient(mac, deauthopt, reasonopt, ban_timeopt) → {Promise.<number>}

Forcibly disconnect the given client from the wireless network.

Parameters:
NameTypeAttributesDefaultDescription
macstring

The MAC address of the client to disconnect.

deauthboolean<optional>
false

Specifies whether to de-authenticate (true) or disassociate (false) the client.

reasonnumber<optional>
1

Specifies the IEEE 802.11 reason code to disassoc/deauth the client with. Default is 1 which corresponds to Unspecified reason.

ban_timenumber<optional>
0

Specifies the number of milliseconds to ban the client from reconnecting. By default, no ban time is set which allows the client to re-associate / reauthenticate immediately.

Returns:

Returns a promise resolving to the underlying ubus call result code which is typically 0, even for not existing MAC addresses. The promise might reject with an error in case invalid arguments are passed.

Type: 
Promise.<number>

get(opt) → {null|string|Array.<string>}

Read the given UCI option value of this wireless network.

Parameters:
NameTypeDescription
optstring

The UCI option name to read.

Returns:

Returns the UCI option value or null if the requested option is not found.

Type: 
null | string | Array.<string>

getActiveBSSID() → {string}

Query the current BSSID from runtime information.

Returns:

Returns the current BSSID or Mesh ID as reported by ubus runtime information.

Type: 
string

getActiveEncryption() → {string}

Query the current encryption settings from runtime information.

Returns:

Returns a string describing the current encryption or - if the encryption state could not be found in ubus runtime information.

Type: 
string

getActiveMode() → {string}

Query the current operation mode from runtime information.

Returns:

Returns the human readable mode name as reported by iwinfo or uci mode. Possible returned values are:

  • Master
  • Ad-Hoc
  • Client
  • Monitor
  • Master (VLAN)
  • WDS
  • Mesh Point
  • P2P Client
  • P2P Go
  • Unknown
Type: 
string

getActiveModeI18n() → {string}

Query the current operation mode from runtime information as translated string.

Returns:

Returns the translated, human readable mode name as reported by ubus runtime state.

Type: 
string

getActiveSSID() → {string}

Query the current SSID from runtime information.

Returns:

Returns the current SSID or Mesh ID as reported by ubus runtime information.

Type: 
string

getAssocList() → {Promise.<Array.<LuCI.network.WifiPeerEntry>>}

Fetch the list of associated peers.

Returns:

Returns a promise resolving to an array of wireless peers associated with this network.

Type: 
Promise.<Array.<LuCI.network.WifiPeerEntry>>

getBSSID() → {null|string}

Get the configured BSSID of the wireless network.

Returns:

Returns the BSSID value or null if none has been specified.

Type: 
null | string

getBitRate() → {null|number}

Query the current average bit-rate of all peers associated with this wireless network.

Returns:

Returns the average bit rate among all peers associated with the network as reported by ubus runtime information or null if the information is not available.

Type: 
null | number

getChannel() → {null|number}

Query the current wireless channel.

Returns:

Returns the wireless channel as reported by ubus runtime information or null if it cannot be determined.

Type: 
null | number

getCountryCode() → {string}

Query the current country code.

Returns:

Returns the wireless country code as reported by ubus runtime information or 00 if it cannot be determined.

Type: 
string

getDevice() → {LuCI.network.Device}

Get the associated Linux network device.

Returns:

Returns a Network.Device instance representing the Linux network device associated with this wireless network.

Type: 
LuCI.network.Device

getFrequency() → {null|string}

Query the current operating frequency of the wireless network.

Returns:

Returns the current operating frequency of the network from ubus runtime information in GHz or null if the information is not available.

Type: 
null | string

getI18n() → {string}

Get a description string for this wireless network.

Returns:

Returns a string describing this network, consisting of the term Wireless Network, followed by the active operation mode, the SSID, BSSID or internal network ID and the Linux network device name, depending on which information is available.

Type: 
string

getID() → {string}

Get the internal network ID of this wireless network.

The network ID is a LuCI specific identifier in the form radio#.network# to identify wireless networks by their corresponding radio and network index numbers.

Returns:

Returns the LuCI specific network ID.

Type: 
string

getIfname() → {null|string}

Get the Linux network device name.

Returns:

Returns the current Linux network device name as resolved from ubus runtime information or null if this network has no associated network device, e.g. when not configured or up.

Type: 
null | string

getMeshID() → {null|string}

Get the configured Mesh ID of the wireless network.

Returns:

Returns the configured mesh ID value or null when this network is not in mesh mode.

Type: 
null | string

getMode() → {string}

Get the configured operation mode of the wireless network.

Returns:

Returns the configured operation mode. Possible values are:

  • ap - Master (Access Point) mode
  • sta - Station (client) mode
  • adhoc - Ad-Hoc (IBSS) mode
  • mesh - Mesh (IEEE 802.11s) mode
  • monitor - Monitor mode
Type: 
string

getName() → {string}

Get the configuration ID of this wireless network.

Returns:

Returns the corresponding UCI section ID of the network.

Type: 
string

getNetwork() → {null|LuCI.network.Protocol}

Get the primary logical interface this network is attached to.

Returns:

Returns a Network.Protocol instance representing the logical interface or null if this network is not attached to any logical interface.

Type: 
null | LuCI.network.Protocol

getNetworkNames() → {Array.<string>}

Get the names of the logical interfaces this wireless network is attached to.

Returns:

Returns an array of logical interface names.

Type: 
Array.<string>

getNetworks() → {Array.<LuCI.network.Protocol>}

Get the logical interfaces this network is attached to.

Returns:

Returns an array of Network.Protocol instances representing the logical interfaces this wireless network is attached to.

Type: 
Array.<LuCI.network.Protocol>

getNoise() → {number}

Query the current radio noise floor.

Returns:

Returns the radio noise floor in dBm as reported by ubus runtime information or 0 if it cannot be determined.

Type: 
number

getSSID() → {null|string}

Get the configured SSID of the wireless network.

Returns:

Returns the configured SSID value or null when this network is in mesh mode.

Type: 
null | string

getShortName() → {string}

Get a short description string for this wireless network.

Returns:

Returns a string describing this network, consisting of the active operation mode, followed by either the SSID, BSSID or internal network ID, depending on which information is available.

Type: 
string

getSignal() → {null|number}

Query the current wireless signal.

Returns:

Returns the wireless signal in dBm as reported by ubus runtime information or null if it cannot be determined.

Type: 
null | number

getSignalLevel(signal, noise) → {number}

Calculate the current signal.

Parameters:
NameTypeDescription
signalnumber
noisenumber
Deprecated
  • Yes
Returns:

Returns the calculated signal level, which is the difference between noise and signal (SNR), divided by 5.

Type: 
number

getSignalPercent() → {number}

Calculate the current signal quality percentage.

Returns:

Returns the calculated signal quality in percent. The value is calculated from the quality and quality_max indicators reported by ubus runtime state.

Type: 
number

getTXPower() → {null|number}

Query the current radio TX power.

Returns:

Returns the wireless network transmit power in dBm as reported by ubus runtime information or null if it cannot be determined.

Type: 
null | number

getTXPowerOffset() → {number}

Query the radio TX power offset.

Some wireless radios have a fixed power offset, e.g. due to the use of external amplifiers.

Returns:

Returns the wireless network transmit power offset in dBm as reported by ubus runtime information or 0 if there is no offset, or if it cannot be determined.

Type: 
number

getVlanIfnames() → {Array.<string>}

Get the Linux VLAN network device names.

Returns:

Returns the current Linux VLAN network device name as resolved from ubus runtime information or empty array if this network has no associated VLAN network devices.

Type: 
Array.<string>

getVlans() → {Array.<LuCI.network.WifiVlan>}

Fetch the vlans for this network.

Returns:

Returns an array of vlans for this network.

Type: 
Array.<LuCI.network.WifiVlan>

getWifiDevice() → {null|LuCI.network.WifiDevice}

Get the corresponding WiFi radio device.

Returns:

Returns a Network.WifiDevice instance representing the corresponding WiFi radio device or null if the related radio device could not be found.

Type: 
null | LuCI.network.WifiDevice

getWifiDeviceName() → {null|string}

Get the name of the corresponding WiFi radio device.

Returns:

Returns the name of the radio device this network is configured on or null if it cannot be determined.

Type: 
null | string

isClientDisconnectSupported() → {boolean}

Check whether this WiFi network supports de-authenticating clients.

Returns:

Returns true when this WiFi network instance supports forcibly de-authenticating clients, otherwise false.

Type: 
boolean

isDisabled() → {boolean}

Checks whether this wireless network is disabled.

Returns:

Returns true when the wireless radio is marked as disabled in ubus runtime state or when the disabled option is set in the corresponding UCI configuration.

Type: 
boolean

isUp() → {boolean}

Check whether the radio network is up.

This function actually queries the up state of the related radio device and assumes this network to be up as well when the parent radio is up. This is due to the fact that OpenWrt does not control virtual interfaces individually but within one common hostapd instance.

Returns:

Returns true when the network is up, else false.

Type: 
boolean

set(opt, value) → {null}

Set the given UCI option of this network to the given value.

Parameters:
NameTypeDescription
optstring

The name of the UCI option to set.

valuenull | string | Array.<string>

The value to set or null to remove the given option from the configuration.

Returns:
Type: 
null
LuCI Documentation
\ No newline at end of file +
On this page

LuCI.network. WifiNetwork

A Network.WifiNetwork instance represents a wireless network (vif) configured on top of a radio device and provides functions for querying the runtime state of the network. Most radio devices support multiple such networks in parallel.

Methods

disconnectClient(mac, deauthopt, reasonopt, ban_timeopt) → {Promise.<number>}

Forcibly disconnect the given client from the wireless network.

Parameters:
NameTypeAttributesDefaultDescription
macstring

The MAC address of the client to disconnect.

deauthboolean<optional>
false

Specifies whether to de-authenticate (true) or disassociate (false) the client.

reasonnumber<optional>
1

Specifies the IEEE 802.11 reason code to disassoc/deauth the client with. Default is 1 which corresponds to Unspecified reason.

ban_timenumber<optional>
0

Specifies the number of milliseconds to ban the client from reconnecting. By default, no ban time is set which allows the client to re-associate / reauthenticate immediately.

Returns:

Returns a promise resolving to the underlying ubus call result code which is typically 0, even for not existing MAC addresses. The promise might reject with an error in case invalid arguments are passed.

Type: 
Promise.<number>

get(opt) → {null|string|Array.<string>}

Read the given UCI option value of this wireless network.

Parameters:
NameTypeDescription
optstring

The UCI option name to read.

Returns:

Returns the UCI option value or null if the requested option is not found.

Type: 
null | string | Array.<string>

getActiveBSSID() → {string}

Query the current BSSID from runtime information.

Returns:

Returns the current BSSID or Mesh ID as reported by ubus runtime information.

Type: 
string

getActiveEncryption() → {string}

Query the current encryption settings from runtime information.

Returns:

Returns a string describing the current encryption or - if the encryption state could not be found in ubus runtime information.

Type: 
string

getActiveMode() → {string}

Query the current operation mode from runtime information.

Returns:

Returns the human readable mode name as reported by iwinfo or uci mode. Possible returned values are:

  • Master
  • Ad-Hoc
  • Client
  • Monitor
  • Master (VLAN)
  • WDS
  • Mesh Point
  • P2P Client
  • P2P Go
  • Unknown
Type: 
string

getActiveModeI18n() → {string}

Query the current operation mode from runtime information as translated string.

Returns:

Returns the translated, human readable mode name as reported by ubus runtime state.

Type: 
string

getActiveSSID() → {string}

Query the current SSID from runtime information.

Returns:

Returns the current SSID or Mesh ID as reported by ubus runtime information.

Type: 
string

getAssocList() → {Promise.<Array.<LuCI.network.WifiPeerEntry>>}

Fetch the list of associated peers.

Returns:

Returns a promise resolving to an array of wireless peers associated with this network.

Type: 
Promise.<Array.<LuCI.network.WifiPeerEntry>>

getBSSID() → {null|string}

Get the configured BSSID of the wireless network.

Returns:

Returns the BSSID value or null if none has been specified.

Type: 
null | string

getBitRate() → {null|number}

Query the current average bit-rate of all peers associated with this wireless network.

Returns:

Returns the average bit rate among all peers associated with the network as reported by ubus runtime information or null if the information is not available.

Type: 
null | number

getChannel() → {null|number}

Query the current wireless channel.

Returns:

Returns the wireless channel as reported by ubus runtime information or null if it cannot be determined.

Type: 
null | number

getCountryCode() → {string}

Query the current country code.

Returns:

Returns the wireless country code as reported by ubus runtime information or 00 if it cannot be determined.

Type: 
string

getDevice() → {LuCI.network.Device}

Get the associated Linux network device.

Returns:

Returns a Network.Device instance representing the Linux network device associated with this wireless network.

Type: 
LuCI.network.Device

getFrequency() → {null|string}

Query the current operating frequency of the wireless network.

Returns:

Returns the current operating frequency of the network from ubus runtime information in GHz or null if the information is not available.

Type: 
null | string

getI18n() → {string}

Get a description string for this wireless network.

Returns:

Returns a string describing this network, consisting of the term Wireless Network, followed by the active operation mode, the SSID, BSSID or internal network ID and the Linux network device name, depending on which information is available.

Type: 
string

getID() → {string}

Get the internal network ID of this wireless network.

The network ID is a LuCI specific identifier in the form radio#.network# to identify wireless networks by their corresponding radio and network index numbers.

Returns:

Returns the LuCI specific network ID.

Type: 
string

getIfname() → {null|string}

Get the Linux network device name.

Returns:

Returns the current Linux network device name as resolved from ubus runtime information or null if this network has no associated network device, e.g. when not configured or up.

Type: 
null | string

getMeshID() → {null|string}

Get the configured Mesh ID of the wireless network.

Returns:

Returns the configured mesh ID value or null when this network is not in mesh mode.

Type: 
null | string

getMode() → {string}

Get the configured operation mode of the wireless network.

Returns:

Returns the configured operation mode. Possible values are:

  • ap - Master (Access Point) mode
  • sta - Station (client) mode
  • adhoc - Ad-Hoc (IBSS) mode
  • mesh - Mesh (IEEE 802.11s) mode
  • monitor - Monitor mode
Type: 
string

getName() → {string}

Get the configuration ID of this wireless network.

Returns:

Returns the corresponding UCI section ID of the network.

Type: 
string

getNetwork() → {null|LuCI.network.Protocol}

Get the primary logical interface this network is attached to.

Returns:

Returns a Network.Protocol instance representing the logical interface or null if this network is not attached to any logical interface.

Type: 
null | LuCI.network.Protocol

getNetworkNames() → {Array.<string>}

Get the names of the logical interfaces this wireless network is attached to.

Returns:

Returns an array of logical interface names.

Type: 
Array.<string>

getNetworks() → {Array.<LuCI.network.Protocol>}

Get the logical interfaces this network is attached to.

Returns:

Returns an array of Network.Protocol instances representing the logical interfaces this wireless network is attached to.

Type: 
Array.<LuCI.network.Protocol>

getNoise() → {number}

Query the current radio noise floor.

Returns:

Returns the radio noise floor in dBm as reported by ubus runtime information or 0 if it cannot be determined.

Type: 
number

getSSID() → {null|string}

Get the configured SSID of the wireless network.

Returns:

Returns the configured SSID value or null when this network is in mesh mode.

Type: 
null | string

getShortName() → {string}

Get a short description string for this wireless network.

Returns:

Returns a string describing this network, consisting of the active operation mode, followed by either the SSID, BSSID or internal network ID, depending on which information is available.

Type: 
string

getSignal() → {null|number}

Query the current wireless signal.

Returns:

Returns the wireless signal in dBm as reported by ubus runtime information or null if it cannot be determined.

Type: 
null | number

getSignalLevel(signal, noise) → {number}

Calculate the current signal.

Parameters:
NameTypeDescription
signalnumber
noisenumber
Deprecated
  • Yes
Returns:

Returns the calculated signal level, which is the difference between noise and signal (SNR), divided by 5.

Type: 
number

getSignalPercent() → {number}

Calculate the current signal quality percentage.

Returns:

Returns the calculated signal quality in percent. The value is calculated from the quality and quality_max indicators reported by ubus runtime state.

Type: 
number

getTXPower() → {null|number}

Query the current radio TX power.

Returns:

Returns the wireless network transmit power in dBm as reported by ubus runtime information or null if it cannot be determined.

Type: 
null | number

getTXPowerOffset() → {number}

Query the radio TX power offset.

Some wireless radios have a fixed power offset, e.g. due to the use of external amplifiers.

Returns:

Returns the wireless network transmit power offset in dBm as reported by ubus runtime information or 0 if there is no offset, or if it cannot be determined.

Type: 
number

getVlanIfnames() → {Array.<string>}

Get the Linux VLAN network device names.

Returns:

Returns the current Linux VLAN network device name as resolved from ubus runtime information or empty array if this network has no associated VLAN network devices.

Type: 
Array.<string>

getVlans() → {Array.<LuCI.network.WifiVlan>}

Fetch the vlans for this network.

Returns:

Returns an array of vlans for this network.

Type: 
Array.<LuCI.network.WifiVlan>

getWifiDevice() → {null|LuCI.network.WifiDevice}

Get the corresponding WiFi radio device.

Returns:

Returns a Network.WifiDevice instance representing the corresponding WiFi radio device or null if the related radio device could not be found.

Type: 
null | LuCI.network.WifiDevice

getWifiDeviceName() → {null|string}

Get the name of the corresponding WiFi radio device.

Returns:

Returns the name of the radio device this network is configured on or null if it cannot be determined.

Type: 
null | string

isClientDisconnectSupported() → {boolean}

Check whether this WiFi network supports de-authenticating clients.

Returns:

Returns true when this WiFi network instance supports forcibly de-authenticating clients, otherwise false.

Type: 
boolean

isDisabled() → {boolean}

Checks whether this wireless network is disabled.

Returns:

Returns true when the wireless radio is marked as disabled in ubus runtime state or when the disabled option is set in the corresponding UCI configuration.

Type: 
boolean

isUp() → {boolean}

Check whether the radio network is up.

This function actually queries the up state of the related radio device and assumes this network to be up as well when the parent radio is up. This is due to the fact that OpenWrt does not control virtual interfaces individually but within one common hostapd instance.

Returns:

Returns true when the network is up, else false.

Type: 
boolean

set(opt, value) → {null}

Set the given UCI option of this network to the given value.

Parameters:
NameTypeDescription
optstring

The name of the UCI option to set.

valuenull | string | Array.<string>

The value to set or null to remove the given option from the configuration.

Returns:
Type: 
null
LuCI Documentation
\ No newline at end of file diff --git a/LuCI.network.WifiVlan.html b/LuCI.network.WifiVlan.html index 2ecbed4185..f296d4455c 100644 --- a/LuCI.network.WifiVlan.html +++ b/LuCI.network.WifiVlan.html @@ -1,3 +1,3 @@ Class: WifiVlan
On this page

LuCI.network. WifiVlan

A Network.WifiVlan class instance represents a vlan on a WifiNetwork.

Methods

getI18n() → {string}

Get a long description string for the wifi vlan.

Returns:

Returns a string containing the vlan id and the vlan name, if it is different than the vlan id

Type: 
string

getIfname() → {string}

Get the Linux network device name of the wifi vlan.

Returns:

Returns the current network device name for this wifi vlan.

Type: 
string

getName() → {string}

Get the name of the wifi vlan.

Returns:

Returns the name.

Type: 
string

getNetwork() → {string}

Get the network of the wifi vlan.

Returns:

Returns the network.

Type: 
string

getVlanId() → {number}

Get the vlan id of the wifi vlan.

Returns:

Returns the vlan id.

Type: 
number
LuCI Documentation
\ No newline at end of file +
On this page

LuCI.network. WifiVlan

A Network.WifiVlan class instance represents a vlan on a WifiNetwork.

Methods

getI18n() → {string}

Get a long description string for the wifi vlan.

Returns:

Returns a string containing the vlan id and the vlan name, if it is different than the vlan id

Type: 
string

getIfname() → {string}

Get the Linux network device name of the wifi vlan.

Returns:

Returns the current network device name for this wifi vlan.

Type: 
string

getName() → {string}

Get the name of the wifi vlan.

Returns:

Returns the name.

Type: 
string

getNetwork() → {string}

Get the network of the wifi vlan.

Returns:

Returns the network.

Type: 
string

getVlanId() → {number}

Get the vlan id of the wifi vlan.

Returns:

Returns the vlan id.

Type: 
number
LuCI Documentation
\ No newline at end of file diff --git a/LuCI.network.html b/LuCI.network.html index fc97bdb726..e00924175e 100644 --- a/LuCI.network.html +++ b/LuCI.network.html @@ -1,3 +1,3 @@ Class: network
On this page

LuCI. network

The LuCI.network class combines data from multiple ubus APIs to provide an abstraction of the current network configuration state.

It provides methods to enumerate interfaces and devices, to query current configuration details and to manipulate settings.

Classes

Device
Hosts
Protocol
WifiDevice
WifiNetwork
WifiVlan

Methods

addNetwork(name, optionsopt) → {Promise.<(null|LuCI.network.Protocol)>}

Adds a new network of the given name and update it with the given uci option values.

If a network with the given name already exist but is empty, then this function will update its option, otherwise it will do nothing.

Parameters:
NameTypeAttributesDescription
namestring

The name of the network to add. Must be in the format [a-zA-Z0-9_]+.

optionsObject.<string, (string|Array.<string>)><optional>

An object of uci option values to set on the new network or to update in an existing, empty network.

Returns:

Returns a promise resolving to the Protocol subclass instance describing the added network or resolving to null if the name was invalid or if a non-empty network of the given name already existed.

Type: 
Promise.<(null|LuCI.network.Protocol)>

addWifiNetwork(options) → {Promise.<(null|LuCI.network.WifiNetwork)>}

Adds a new wireless network to the configuration and sets its options to the provided values.

Parameters:
NameTypeDescription
optionsObject.<string, (string|Array.<string>)>

The options to set for the newly added wireless network. This object must at least contain a device property which is set to the radio name the new network belongs to.

Returns:

Returns a promise resolving to a WifiNetwork instance describing the newly added wireless network or null if the given options were invalid or if the associated radio device could not be found.

Type: 
Promise.<(null|LuCI.network.WifiNetwork)>

deleteNetwork(name) → {Promise.<boolean>}

Deletes the given network and its references from the network and firewall configuration.

Parameters:
NameTypeDescription
namestring

The name of the network to delete.

Returns:

Returns a promise resolving to either true if the network and references to it were successfully deleted from the configuration or false if the given network could not be found.

Type: 
Promise.<boolean>

deleteWifiNetwork(netname) → {Promise.<boolean>}

Deletes the given wireless network from the configuration.

Parameters:
NameTypeDescription
netnamestring

The name of the network to remove. This may be either a network ID in the form radio#.network# or a Linux network device name like wlan0 which is resolved to the corresponding configuration section through ubus runtime information.

Returns:

Returns a promise resolving to true if the wireless network has been successfully deleted from the configuration or false if it could not be found.

Type: 
Promise.<boolean>

flushCache() → {Promise.<Object>}

Flushes the local network state cache and fetches updated information from the remote ubus apis.

Returns:

Returns a promise resolving to the internal network state object.

Type: 
Promise.<Object>

formatWifiEncryption(encryption) → {null|string}

Converts a given encryption entry into a human readable string such as mixed WPA/WPA2 PSK (TKIP, CCMP) or WPA3 SAE (CCMP).

Parameters:
NameTypeDescription
encryptionLuCI.network.WifiEncryption

The wireless encryption entry to convert.

Returns:

Returns the description string for the given encryption entry or null if the given entry was invalid.

Type: 
null | string

getDSLModemType() → {Promise.<(null|string)>}

Queries the internal DSL modem type from board information.

Returns:

Returns a promise resolving to the type of the internal modem (e.g. vdsl) or to null if no internal modem is present.

Type: 
Promise.<(null|string)>

getDevice(name) → {Promise.<(null|LuCI.network.Device)>}

Get a Device instance describing the given network device.

Parameters:
NameTypeDescription
namestring

The name of the network device to get, e.g. eth0 or br-lan.

Returns:

Returns a promise resolving to the Device instance describing the network device or null if the given device name could not be found.

Type: 
Promise.<(null|LuCI.network.Device)>

getDevices() → {Promise.<Array.<LuCI.network.Device>>}

Get a sorted list of all found network devices.

Returns:

Returns a promise resolving to a sorted array of Device class instances describing the network devices found on the system.

Type: 
Promise.<Array.<LuCI.network.Device>>

getHostHints() → {Promise.<LuCI.network.Hosts>}

Queries aggregated information about known hosts.

This function aggregates information from various sources such as DHCP lease databases, ARP and IPv6 neighbour entries, wireless association list etc. and returns a Hosts class instance describing the found hosts.

Returns:

Returns a Hosts instance describing a host known on the system.

Type: 
Promise.<LuCI.network.Hosts>

getIfnameOf(obj) → {null|string}

Obtains the network device name of the given object.

Parameters:
NameTypeDescription
objLuCI.network.Protocol | LuCI.network.Device | LuCI.network.WifiDevice | LuCI.network.WifiNetwork | string

The object to get the device name from.

Returns:

Returns a string containing the device name or null if the given object could not be converted to a name.

Type: 
null | string

getNetwork(name) → {Promise.<(null|LuCI.network.Protocol)>}

Get a Protocol instance describing the network with the given name.

Parameters:
NameTypeDescription
namestring

The logical interface name of the network get, e.g. lan or wan.

Returns:

Returns a promise resolving to a Protocol subclass instance describing the network or null if the network did not exist.

Type: 
Promise.<(null|LuCI.network.Protocol)>

getNetworks() → {Promise.<Array.<LuCI.network.Protocol>>}

Gets an array containing all known networks.

Returns:

Returns a promise resolving to a name-sorted array of Protocol subclass instances describing all known networks.

Type: 
Promise.<Array.<LuCI.network.Protocol>>

getProtocol(protoname, netnameopt) → {null|LuCI.network.Protocol}

Instantiates the given Protocol back-end, optionally using the given network name.

Parameters:
NameTypeAttributesDefaultDescription
protonamestring

The protocol back-end to use, e.g. static or dhcp.

netnamestring<optional>
__dummy__

The network name to use for the instantiated protocol. This should be usually set to one of the interfaces described in /etc/config/network but it is allowed to omit it, e.g. to query protocol capabilities without the need for an existing interface.

Returns:

Returns the instantiated protocol back-end class or null if the given protocol isn't known.

Type: 
null | LuCI.network.Protocol

getProtocols() → {Array.<LuCI.network.Protocol>}

Obtains instances of all known Protocol back-end classes.

Returns:

Returns an array of protocol class instances.

Type: 
Array.<LuCI.network.Protocol>

getSwitchTopologies() → {Promise.<Object.<string, LuCI.network.SwitchTopology>>}

Returns the topologies of all swconfig switches found on the system.

Returns:

Returns a promise resolving to an object containing the topologies of each switch. The object keys correspond to the name of the switches such as switch0, the values are SwitchTopology objects describing the layout.

Type: 
Promise.<Object.<string, LuCI.network.SwitchTopology>>

getWAN6Networks() → {Promise.<Array.<LuCI.network.Protocol>>}

Get IPv6 wan networks.

This function looks up all networks having a default ::/0 route and returns them as an array.

Returns:

Returns a promise resolving to an array of Protocol subclass instances describing the found IPv6 default route interfaces.

Type: 
Promise.<Array.<LuCI.network.Protocol>>

getWANNetworks() → {Promise.<Array.<LuCI.network.Protocol>>}

Get IPv4 wan networks.

This function looks up all networks having a default 0.0.0.0/0 route and returns them as an array.

Returns:

Returns a promise resolving to an array of Protocol subclass instances describing the found default route interfaces.

Type: 
Promise.<Array.<LuCI.network.Protocol>>

getWifiDevice(devname) → {Promise.<(null|LuCI.network.WifiDevice)>}

Get a WifiDevice instance describing the given wireless radio.

Parameters:
NameTypeDescription
devnamestring

The configuration name of the wireless radio to look up, e.g. radio0 for the first mac80211 phy on the system.

Returns:

Returns a promise resolving to the WifiDevice instance describing the underlying radio device or null if the wireless radio could not be found.

Type: 
Promise.<(null|LuCI.network.WifiDevice)>

getWifiDevices() → {Promise.<Array.<LuCI.network.WifiDevice>>}

Obtain a list of all configured radio devices.

Returns:

Returns a promise resolving to an array of WifiDevice instances describing the wireless radios configured in the system. The order of the array corresponds to the order of the radios in the configuration.

Type: 
Promise.<Array.<LuCI.network.WifiDevice>>

getWifiNetwork(netname) → {Promise.<(null|LuCI.network.WifiNetwork)>}

Get a WifiNetwork instance describing the given wireless network.

Parameters:
NameTypeDescription
netnamestring

The name of the wireless network to look up. This may be either an uci configuration section ID, a network ID in the form radio#.network# or a Linux network device name like wlan0 which is resolved to the corresponding configuration section through ubus runtime information.

Returns:

Returns a promise resolving to the WifiNetwork instance describing the wireless network or null if the corresponding network could not be found.

Type: 
Promise.<(null|LuCI.network.WifiNetwork)>

getWifiNetworks() → {Promise.<Array.<LuCI.network.WifiNetwork>>}

Get an array of all WifiNetwork instances describing the wireless networks present on the system.

Returns:

Returns a promise resolving to an array of WifiNetwork instances describing the wireless networks. The array will be empty if no networks are found.

Type: 
Promise.<Array.<LuCI.network.WifiNetwork>>

isIgnoredDevice(name) → {boolean}

Test if a given network device name is in the list of patterns for device names to ignore.

Ignored device names are usually Linux network devices which are spawned implicitly by kernel modules such as tunl0 or hwsim0 and which are unsuitable for use in network configuration.

Parameters:
NameTypeDescription
namestring

The device name to test.

Returns:

Returns true if the given name is in the ignore-pattern list, else returns false.

Type: 
boolean

maskToPrefix(netmask, v6opt) → {null|number}

Converts the given netmask to a prefix size in bits.

Parameters:
NameTypeAttributesDefaultDescription
netmaskstring

The netmask to convert into a bits count.

v6boolean<optional>
false

Whether to parse the given netmask as IPv4 (false) or IPv6 (true) address.

Returns:

Returns the number of prefix bits contained in the netmask or null if the given netmask value was invalid.

Type: 
null | number

prefixToMask(bits, v6opt) → {null|string}

Converts the given prefix size in bits to a netmask.

Parameters:
NameTypeAttributesDefaultDescription
bitsnumber

The prefix size in bits.

v6boolean<optional>
false

Whether to convert the bits value into an IPv4 netmask (false) or an IPv6 netmask (true).

Returns:

Returns a string containing the netmask corresponding to the bit count or null when the given amount of bits exceeds the maximum possible value of 32 for IPv4 or 128 for IPv6.

Type: 
null | string

registerErrorCode(code, message) → {boolean}

Registers a new human readable translation string for a Protocol error code.

Parameters:
NameTypeDescription
codestring

The ubus protocol error code to register a translation for, e.g. NO_DEVICE.

messagestring

The message to use as a translation for the given protocol error code.

Returns:

Returns true if the error code description has been added or false if either the arguments were invalid or if there already was a description for the given code.

Type: 
boolean

registerPatternVirtual(pat)

Registers a new regular expression pattern to recognize virtual interfaces.

Parameters:
NameTypeDescription
patRegExp

A RegExp instance to match a virtual interface name such as 6in4-wan or tun0.

registerProtocol(protoname, methods) → {LuCI.network.Protocol}

Registers a new Protocol subclass with the given methods and returns the resulting subclass value.

This function internally calls baseclass.extend() on the Network.Protocol base class.

Parameters:
NameTypeDescription
protonamestring

The name of the new protocol to register.

methodsObject.<string, *>

The member methods and values of the new Protocol subclass to be passed to baseclass.extend().

Returns:

Returns the new Protocol subclass.

Type: 
LuCI.network.Protocol

renameNetwork(oldName, newName) → {Promise.<boolean>}

Rename the given network and its references to a new name.

Parameters:
NameTypeDescription
oldNamestring

The current name of the network.

newNamestring

The name to rename the network to, must be in the format [a-z-A-Z0-9_]+.

Returns:

Returns a promise resolving to either true if the network was successfully renamed or false if the new name was invalid, if a network with the new name already exists or if the network to rename could not be found.

Type: 
Promise.<boolean>

Type Definitions

SwitchTopology

Describes a swconfig switch topology by specifying the CPU connections and external port labels of a switch.

Type:
  • Object.<string, (Object|Array)>
Properties
NameTypeDescription
netdevsObject.<number, string>

The netdevs property points to an object describing the CPU port connections of the switch. The numeric key of the enclosed object is the port number, the value contains the Linux network device name the port is hardwired to.

portsArray.<Object.<string, (boolean|number|string)>>

The ports property points to an array describing the populated ports of the switch in the external label order. Each array item is an object containing the following keys:

  • num - the internal switch port number
  • label - the label of the port, e.g. LAN 1 or CPU (eth0)
  • device - the connected Linux network device name (CPU ports only)
  • tagged - a boolean indicating whether the port must be tagged to function (CPU ports only)

WifiEncryption

An encryption entry describes active wireless encryption settings such as the used key management protocols, active ciphers and protocol versions.

Type:
  • Object.<string, (boolean|Array.<(number|string)>)>
Properties
NameTypeAttributesDescription
enabledboolean

Specifies whether any kind of encryption, such as WEP or WPA is enabled. If set to false, then no encryption is active and the corresponding network is open.

wepArray.<string><optional>

When the wep property exists, the network uses WEP encryption. In this case, the property is set to an array of active WEP modes which might be either open, shared or both.

wpaArray.<number><optional>

When the wpa property exists, the network uses WPA security. In this case, the property is set to an array containing the WPA protocol versions used, e.g. [ 1, 2 ] for WPA/WPA2 mixed mode or [ 3 ] for WPA3-SAE.

authenticationArray.<string><optional>

The authentication property only applies to WPA encryption and is defined when the wpa property is set as well. It points to an array of active authentication suites used by the network, e.g. [ "psk" ] for a WPA(2)-PSK network or [ "psk", "sae" ] for mixed WPA2-PSK/WPA3-SAE encryption.

ciphersArray.<string><optional>

If either WEP or WPA encryption is active, then the ciphers property will be set to an array describing the active encryption ciphers used by the network, e.g. [ "tkip", "ccmp" ] for a WPA/WPA2-PSK mixed network or [ "wep-40", "wep-104" ] for an WEP network.

WifiPeerEntry

A wireless peer entry describes the properties of a remote wireless peer associated with a local network.

Type:
Properties
NameTypeAttributesDescription
macstring

The MAC address (BSSID).

signalnumber

The received signal strength.

signal_avgnumber<optional>

The average signal strength if supported by the driver.

noisenumber<optional>

The current noise floor of the radio. May be 0 or absent if not supported by the driver.

inactivenumber

The number of milliseconds the peer has been inactive, e.g. due to power-saving.

connected_timenumber

The number of milliseconds the peer is associated to this network.

thrnumber<optional>

The estimated throughput of the peer, May be 0 or absent if not supported by the driver.

authorizedboolean

Specifies whether the peer is authorized to associate to this network.

authenticatedboolean

Specifies whether the peer completed authentication to this network.

preamblestring

The preamble mode used by the peer. May be long or short.

wmeboolean

Specifies whether the peer supports WME/WMM capabilities.

mfpboolean

Specifies whether management frame protection is active.

tdlsboolean

Specifies whether TDLS is active.

mesh_llidnumber<optional>

The mesh LLID, may be 0 or absent if not applicable or supported by the driver.

mesh_plidnumber<optional>

The mesh PLID, may be 0 or absent if not applicable or supported by the driver.

mesh_plinkstring<optional>

The mesh peer link state description, may be an empty string ('') or absent if not applicable or supported by the driver.

The following states are known:

  • LISTEN
  • OPN_SNT
  • OPN_RCVD
  • CNF_RCVD
  • ESTAB
  • HOLDING
  • BLOCKED
  • UNKNOWN
mesh_local_PSnumber<optional>

The local power-save mode for the peer link, may be an empty string ('') or absent if not applicable or supported by the driver.

The following modes are known:

  • ACTIVE (no power save)
  • LIGHT SLEEP
  • DEEP SLEEP
  • UNKNOWN
mesh_peer_PSnumber<optional>

The remote power-save mode for the peer link, may be an empty string ('') or absent if not applicable or supported by the driver.

The following modes are known:

  • ACTIVE (no power save)
  • LIGHT SLEEP
  • DEEP SLEEP
  • UNKNOWN
mesh_non_peer_PSnumber<optional>

The power-save mode for all non-peer neighbours, may be an empty string ('') or absent if not applicable or supported by the driver.

The following modes are known:

  • ACTIVE (no power save)
  • LIGHT SLEEP
  • DEEP SLEEP
  • UNKNOWN
rxLuCI.network.WifiRateEntry

Describes the receiving wireless rate from the peer.

txLuCI.network.WifiRateEntry

Describes the transmitting wireless rate to the peer.

WifiRateEntry

A wireless rate entry describes the properties of a wireless transmission rate to or from a peer.

Type:
  • Object.<string, (boolean|number)>
Properties
NameTypeAttributesDescription
drop_miscnumber<optional>

The amount of received misc. packages that have been dropped, e.g. due to corruption or missing authentication. Only applicable to receiving rates.

packetsnumber

The amount of packets that have been received or sent.

bytesnumber

The amount of bytes that have been received or sent.

failednumber<optional>

The amount of failed transmission attempts. Only applicable to transmit rates.

retriesnumber<optional>

The amount of retried transmissions. Only applicable to transmit rates.

is_htboolean

Specifies whether this rate is an HT (IEEE 802.11n) rate.

is_vhtboolean

Specifies whether this rate is an VHT (IEEE 802.11ac) rate.

mhznumber

The channel width in MHz used for the transmission.

ratenumber

The bitrate in bit/s of the transmission.

mcsnumber<optional>

The MCS index of the used transmission rate. Only applicable to HT or VHT rates.

40mhznumber<optional>

Specifies whether the transmission rate used 40MHz wide channel. Only applicable to HT or VHT rates.

Note: this option exists for backwards compatibility only, and its use is discouraged. The mhz field should be used instead to determine the channel width.

short_giboolean<optional>

Specifies whether a short guard interval is used for the transmission. Only applicable to HT or VHT rates.

nssnumber<optional>

Specifies the number of spatial streams used by the transmission. Only applicable to VHT rates.

heboolean<optional>

Specifies whether this rate is an HE (IEEE 802.11ax) rate.

he_ginumber<optional>

Specifies whether the guard interval used for the transmission. Only applicable to HE rates.

he_dcmnumber<optional>

Specifies whether dual concurrent modulation is used for the transmission. Only applicable to HE rates.

ehtboolean<optional>

Specifies whether this rate is an EHT (IEEE 802.11be) rate.

eht_ginumber<optional>

Specifies whether the guard interval is used for the transmission. Only applicable to EHT rates.

eht_dcmnumber<optional>

Specifies whether dual concurrent modulation is used for the transmission. Only applicable to EHT rates.

WifiScanResult

A wireless scan result object describes a neighbouring wireless network found in the vicinity.

Type:
Properties
NameTypeDescription
ssidstring

The SSID / Mesh ID of the network.

bssidstring

The BSSID if the network.

modestring

The operation mode of the network (Master, Ad-Hoc, Mesh Point).

channelnumber

The wireless channel of the network.

signalnumber

The received signal strength of the network in dBm.

qualitynumber

The numeric quality level of the signal, can be used in conjunction with quality_max to calculate a quality percentage.

quality_maxnumber

The maximum possible quality level of the signal, can be used in conjunction with quality to calculate a quality percentage.

encryptionLuCI.network.WifiEncryption

The encryption used by the wireless network.

LuCI Documentation
\ No newline at end of file +
On this page

LuCI. network

The LuCI.network class combines data from multiple ubus APIs to provide an abstraction of the current network configuration state.

It provides methods to enumerate interfaces and devices, to query current configuration details and to manipulate settings.

Classes

Device
Hosts
Protocol
WifiDevice
WifiNetwork
WifiVlan

Methods

addNetwork(name, optionsopt) → {Promise.<(null|LuCI.network.Protocol)>}

Adds a new network of the given name and update it with the given uci option values.

If a network with the given name already exist but is empty, then this function will update its option, otherwise it will do nothing.

Parameters:
NameTypeAttributesDescription
namestring

The name of the network to add. Must be in the format [a-zA-Z0-9_]+.

optionsObject.<string, (string|Array.<string>)><optional>

An object of uci option values to set on the new network or to update in an existing, empty network.

Returns:

Returns a promise resolving to the Protocol subclass instance describing the added network or resolving to null if the name was invalid or if a non-empty network of the given name already existed.

Type: 
Promise.<(null|LuCI.network.Protocol)>

addWifiNetwork(options) → {Promise.<(null|LuCI.network.WifiNetwork)>}

Adds a new wireless network to the configuration and sets its options to the provided values.

Parameters:
NameTypeDescription
optionsObject.<string, (string|Array.<string>)>

The options to set for the newly added wireless network. This object must at least contain a device property which is set to the radio name the new network belongs to.

Returns:

Returns a promise resolving to a WifiNetwork instance describing the newly added wireless network or null if the given options were invalid or if the associated radio device could not be found.

Type: 
Promise.<(null|LuCI.network.WifiNetwork)>

deleteNetwork(name) → {Promise.<boolean>}

Deletes the given network and its references from the network and firewall configuration.

Parameters:
NameTypeDescription
namestring

The name of the network to delete.

Returns:

Returns a promise resolving to either true if the network and references to it were successfully deleted from the configuration or false if the given network could not be found.

Type: 
Promise.<boolean>

deleteWifiNetwork(netname) → {Promise.<boolean>}

Deletes the given wireless network from the configuration.

Parameters:
NameTypeDescription
netnamestring

The name of the network to remove. This may be either a network ID in the form radio#.network# or a Linux network device name like wlan0 which is resolved to the corresponding configuration section through ubus runtime information.

Returns:

Returns a promise resolving to true if the wireless network has been successfully deleted from the configuration or false if it could not be found.

Type: 
Promise.<boolean>

flushCache() → {Promise.<Object>}

Flushes the local network state cache and fetches updated information from the remote ubus apis.

Returns:

Returns a promise resolving to the internal network state object.

Type: 
Promise.<Object>

formatWifiEncryption(encryption) → {null|string}

Converts a given encryption entry into a human readable string such as mixed WPA/WPA2 PSK (TKIP, CCMP) or WPA3 SAE (CCMP).

Parameters:
NameTypeDescription
encryptionLuCI.network.WifiEncryption

The wireless encryption entry to convert.

Returns:

Returns the description string for the given encryption entry or null if the given entry was invalid.

Type: 
null | string

getDSLModemType() → {Promise.<(null|string)>}

Queries the internal DSL modem type from board information.

Returns:

Returns a promise resolving to the type of the internal modem (e.g. vdsl) or to null if no internal modem is present.

Type: 
Promise.<(null|string)>

getDevice(name) → {Promise.<(null|LuCI.network.Device)>}

Get a Device instance describing the given network device.

Parameters:
NameTypeDescription
namestring

The name of the network device to get, e.g. eth0 or br-lan.

Returns:

Returns a promise resolving to the Device instance describing the network device or null if the given device name could not be found.

Type: 
Promise.<(null|LuCI.network.Device)>

getDevices() → {Promise.<Array.<LuCI.network.Device>>}

Get a sorted list of all found network devices.

Returns:

Returns a promise resolving to a sorted array of Device class instances describing the network devices found on the system.

Type: 
Promise.<Array.<LuCI.network.Device>>

getHostHints() → {Promise.<LuCI.network.Hosts>}

Queries aggregated information about known hosts.

This function aggregates information from various sources such as DHCP lease databases, ARP and IPv6 neighbour entries, wireless association list etc. and returns a Hosts class instance describing the found hosts.

Returns:

Returns a Hosts instance describing a host known on the system.

Type: 
Promise.<LuCI.network.Hosts>

getIfnameOf(obj) → {null|string}

Obtains the network device name of the given object.

Parameters:
NameTypeDescription
objLuCI.network.Protocol | LuCI.network.Device | LuCI.network.WifiDevice | LuCI.network.WifiNetwork | string

The object to get the device name from.

Returns:

Returns a string containing the device name or null if the given object could not be converted to a name.

Type: 
null | string

getNetwork(name) → {Promise.<(null|LuCI.network.Protocol)>}

Get a Protocol instance describing the network with the given name.

Parameters:
NameTypeDescription
namestring

The logical interface name of the network get, e.g. lan or wan.

Returns:

Returns a promise resolving to a Protocol subclass instance describing the network or null if the network did not exist.

Type: 
Promise.<(null|LuCI.network.Protocol)>

getNetworks() → {Promise.<Array.<LuCI.network.Protocol>>}

Gets an array containing all known networks.

Returns:

Returns a promise resolving to a name-sorted array of Protocol subclass instances describing all known networks.

Type: 
Promise.<Array.<LuCI.network.Protocol>>

getProtocol(protoname, netnameopt) → {null|LuCI.network.Protocol}

Instantiates the given Protocol back-end, optionally using the given network name.

Parameters:
NameTypeAttributesDefaultDescription
protonamestring

The protocol back-end to use, e.g. static or dhcp.

netnamestring<optional>
__dummy__

The network name to use for the instantiated protocol. This should be usually set to one of the interfaces described in /etc/config/network but it is allowed to omit it, e.g. to query protocol capabilities without the need for an existing interface.

Returns:

Returns the instantiated protocol back-end class or null if the given protocol isn't known.

Type: 
null | LuCI.network.Protocol

getProtocols() → {Array.<LuCI.network.Protocol>}

Obtains instances of all known Protocol back-end classes.

Returns:

Returns an array of protocol class instances.

Type: 
Array.<LuCI.network.Protocol>

getSwitchTopologies() → {Promise.<Object.<string, LuCI.network.SwitchTopology>>}

Returns the topologies of all swconfig switches found on the system.

Returns:

Returns a promise resolving to an object containing the topologies of each switch. The object keys correspond to the name of the switches such as switch0, the values are SwitchTopology objects describing the layout.

Type: 
Promise.<Object.<string, LuCI.network.SwitchTopology>>

getWAN6Networks() → {Promise.<Array.<LuCI.network.Protocol>>}

Get IPv6 wan networks.

This function looks up all networks having a default ::/0 route and returns them as an array.

Returns:

Returns a promise resolving to an array of Protocol subclass instances describing the found IPv6 default route interfaces.

Type: 
Promise.<Array.<LuCI.network.Protocol>>

getWANNetworks() → {Promise.<Array.<LuCI.network.Protocol>>}

Get IPv4 wan networks.

This function looks up all networks having a default 0.0.0.0/0 route and returns them as an array.

Returns:

Returns a promise resolving to an array of Protocol subclass instances describing the found default route interfaces.

Type: 
Promise.<Array.<LuCI.network.Protocol>>

getWifiDevice(devname) → {Promise.<(null|LuCI.network.WifiDevice)>}

Get a WifiDevice instance describing the given wireless radio.

Parameters:
NameTypeDescription
devnamestring

The configuration name of the wireless radio to look up, e.g. radio0 for the first mac80211 phy on the system.

Returns:

Returns a promise resolving to the WifiDevice instance describing the underlying radio device or null if the wireless radio could not be found.

Type: 
Promise.<(null|LuCI.network.WifiDevice)>

getWifiDevices() → {Promise.<Array.<LuCI.network.WifiDevice>>}

Obtain a list of all configured radio devices.

Returns:

Returns a promise resolving to an array of WifiDevice instances describing the wireless radios configured in the system. The order of the array corresponds to the order of the radios in the configuration.

Type: 
Promise.<Array.<LuCI.network.WifiDevice>>

getWifiNetwork(netname) → {Promise.<(null|LuCI.network.WifiNetwork)>}

Get a WifiNetwork instance describing the given wireless network.

Parameters:
NameTypeDescription
netnamestring

The name of the wireless network to look up. This may be either an uci configuration section ID, a network ID in the form radio#.network# or a Linux network device name like wlan0 which is resolved to the corresponding configuration section through ubus runtime information.

Returns:

Returns a promise resolving to the WifiNetwork instance describing the wireless network or null if the corresponding network could not be found.

Type: 
Promise.<(null|LuCI.network.WifiNetwork)>

getWifiNetworks() → {Promise.<Array.<LuCI.network.WifiNetwork>>}

Get an array of all WifiNetwork instances describing the wireless networks present on the system.

Returns:

Returns a promise resolving to an array of WifiNetwork instances describing the wireless networks. The array will be empty if no networks are found.

Type: 
Promise.<Array.<LuCI.network.WifiNetwork>>

isIgnoredDevice(name) → {boolean}

Test if a given network device name is in the list of patterns for device names to ignore.

Ignored device names are usually Linux network devices which are spawned implicitly by kernel modules such as tunl0 or hwsim0 and which are unsuitable for use in network configuration.

Parameters:
NameTypeDescription
namestring

The device name to test.

Returns:

Returns true if the given name is in the ignore-pattern list, else returns false.

Type: 
boolean

maskToPrefix(netmask, v6opt) → {null|number}

Converts the given netmask to a prefix size in bits.

Parameters:
NameTypeAttributesDefaultDescription
netmaskstring

The netmask to convert into a bits count.

v6boolean<optional>
false

Whether to parse the given netmask as IPv4 (false) or IPv6 (true) address.

Returns:

Returns the number of prefix bits contained in the netmask or null if the given netmask value was invalid.

Type: 
null | number

prefixToMask(bits, v6opt) → {null|string}

Converts the given prefix size in bits to a netmask.

Parameters:
NameTypeAttributesDefaultDescription
bitsnumber

The prefix size in bits.

v6boolean<optional>
false

Whether to convert the bits value into an IPv4 netmask (false) or an IPv6 netmask (true).

Returns:

Returns a string containing the netmask corresponding to the bit count or null when the given amount of bits exceeds the maximum possible value of 32 for IPv4 or 128 for IPv6.

Type: 
null | string

registerErrorCode(code, message) → {boolean}

Registers a new human readable translation string for a Protocol error code.

Parameters:
NameTypeDescription
codestring

The ubus protocol error code to register a translation for, e.g. NO_DEVICE.

messagestring

The message to use as a translation for the given protocol error code.

Returns:

Returns true if the error code description has been added or false if either the arguments were invalid or if there already was a description for the given code.

Type: 
boolean

registerPatternVirtual(pat)

Registers a new regular expression pattern to recognize virtual interfaces.

Parameters:
NameTypeDescription
patRegExp

A RegExp instance to match a virtual interface name such as 6in4-wan or tun0.

registerProtocol(protoname, methods) → {LuCI.network.Protocol}

Registers a new Protocol subclass with the given methods and returns the resulting subclass value.

This function internally calls baseclass.extend() on the Network.Protocol base class.

Parameters:
NameTypeDescription
protonamestring

The name of the new protocol to register.

methodsObject.<string, *>

The member methods and values of the new Protocol subclass to be passed to baseclass.extend().

Returns:

Returns the new Protocol subclass.

Type: 
LuCI.network.Protocol

renameNetwork(oldName, newName) → {Promise.<boolean>}

Rename the given network and its references to a new name.

Parameters:
NameTypeDescription
oldNamestring

The current name of the network.

newNamestring

The name to rename the network to, must be in the format [a-z-A-Z0-9_]+.

Returns:

Returns a promise resolving to either true if the network was successfully renamed or false if the new name was invalid, if a network with the new name already exists or if the network to rename could not be found.

Type: 
Promise.<boolean>

Type Definitions

SwitchTopology

Describes a swconfig switch topology by specifying the CPU connections and external port labels of a switch.

Type:
  • Object.<string, (Object|Array)>
Properties
NameTypeDescription
netdevsObject.<number, string>

The netdevs property points to an object describing the CPU port connections of the switch. The numeric key of the enclosed object is the port number, the value contains the Linux network device name the port is hardwired to.

portsArray.<Object.<string, (boolean|number|string)>>

The ports property points to an array describing the populated ports of the switch in the external label order. Each array item is an object containing the following keys:

  • num - the internal switch port number
  • label - the label of the port, e.g. LAN 1 or CPU (eth0)
  • device - the connected Linux network device name (CPU ports only)
  • tagged - a boolean indicating whether the port must be tagged to function (CPU ports only)

WifiEncryption

An encryption entry describes active wireless encryption settings such as the used key management protocols, active ciphers and protocol versions.

Type:
  • Object.<string, (boolean|Array.<(number|string)>)>
Properties
NameTypeAttributesDescription
enabledboolean

Specifies whether any kind of encryption, such as WEP or WPA is enabled. If set to false, then no encryption is active and the corresponding network is open.

wepArray.<string><optional>

When the wep property exists, the network uses WEP encryption. In this case, the property is set to an array of active WEP modes which might be either open, shared or both.

wpaArray.<number><optional>

When the wpa property exists, the network uses WPA security. In this case, the property is set to an array containing the WPA protocol versions used, e.g. [ 1, 2 ] for WPA/WPA2 mixed mode or [ 3 ] for WPA3-SAE.

authenticationArray.<string><optional>

The authentication property only applies to WPA encryption and is defined when the wpa property is set as well. It points to an array of active authentication suites used by the network, e.g. [ "psk" ] for a WPA(2)-PSK network or [ "psk", "sae" ] for mixed WPA2-PSK/WPA3-SAE encryption.

ciphersArray.<string><optional>

If either WEP or WPA encryption is active, then the ciphers property will be set to an array describing the active encryption ciphers used by the network, e.g. [ "tkip", "ccmp" ] for a WPA/WPA2-PSK mixed network or [ "wep-40", "wep-104" ] for an WEP network.

WifiPeerEntry

A wireless peer entry describes the properties of a remote wireless peer associated with a local network.

Type:
Properties
NameTypeAttributesDescription
macstring

The MAC address (BSSID).

signalnumber

The received signal strength.

signal_avgnumber<optional>

The average signal strength if supported by the driver.

noisenumber<optional>

The current noise floor of the radio. May be 0 or absent if not supported by the driver.

inactivenumber

The number of milliseconds the peer has been inactive, e.g. due to power-saving.

connected_timenumber

The number of milliseconds the peer is associated to this network.

thrnumber<optional>

The estimated throughput of the peer, May be 0 or absent if not supported by the driver.

authorizedboolean

Specifies whether the peer is authorized to associate to this network.

authenticatedboolean

Specifies whether the peer completed authentication to this network.

preamblestring

The preamble mode used by the peer. May be long or short.

wmeboolean

Specifies whether the peer supports WME/WMM capabilities.

mfpboolean

Specifies whether management frame protection is active.

tdlsboolean

Specifies whether TDLS is active.

mesh_llidnumber<optional>

The mesh LLID, may be 0 or absent if not applicable or supported by the driver.

mesh_plidnumber<optional>

The mesh PLID, may be 0 or absent if not applicable or supported by the driver.

mesh_plinkstring<optional>

The mesh peer link state description, may be an empty string ('') or absent if not applicable or supported by the driver.

The following states are known:

  • LISTEN
  • OPN_SNT
  • OPN_RCVD
  • CNF_RCVD
  • ESTAB
  • HOLDING
  • BLOCKED
  • UNKNOWN
mesh_local_PSnumber<optional>

The local power-save mode for the peer link, may be an empty string ('') or absent if not applicable or supported by the driver.

The following modes are known:

  • ACTIVE (no power save)
  • LIGHT SLEEP
  • DEEP SLEEP
  • UNKNOWN
mesh_peer_PSnumber<optional>

The remote power-save mode for the peer link, may be an empty string ('') or absent if not applicable or supported by the driver.

The following modes are known:

  • ACTIVE (no power save)
  • LIGHT SLEEP
  • DEEP SLEEP
  • UNKNOWN
mesh_non_peer_PSnumber<optional>

The power-save mode for all non-peer neighbours, may be an empty string ('') or absent if not applicable or supported by the driver.

The following modes are known:

  • ACTIVE (no power save)
  • LIGHT SLEEP
  • DEEP SLEEP
  • UNKNOWN
rxLuCI.network.WifiRateEntry

Describes the receiving wireless rate from the peer.

txLuCI.network.WifiRateEntry

Describes the transmitting wireless rate to the peer.

WifiRateEntry

A wireless rate entry describes the properties of a wireless transmission rate to or from a peer.

Type:
  • Object.<string, (boolean|number)>
Properties
NameTypeAttributesDescription
drop_miscnumber<optional>

The amount of received misc. packages that have been dropped, e.g. due to corruption or missing authentication. Only applicable to receiving rates.

packetsnumber

The amount of packets that have been received or sent.

bytesnumber

The amount of bytes that have been received or sent.

failednumber<optional>

The amount of failed transmission attempts. Only applicable to transmit rates.

retriesnumber<optional>

The amount of retried transmissions. Only applicable to transmit rates.

is_htboolean

Specifies whether this rate is an HT (IEEE 802.11n) rate.

is_vhtboolean

Specifies whether this rate is an VHT (IEEE 802.11ac) rate.

mhznumber

The channel width in MHz used for the transmission.

ratenumber

The bitrate in bit/s of the transmission.

mcsnumber<optional>

The MCS index of the used transmission rate. Only applicable to HT or VHT rates.

40mhznumber<optional>

Specifies whether the transmission rate used 40MHz wide channel. Only applicable to HT or VHT rates.

Note: this option exists for backwards compatibility only, and its use is discouraged. The mhz field should be used instead to determine the channel width.

short_giboolean<optional>

Specifies whether a short guard interval is used for the transmission. Only applicable to HT or VHT rates.

nssnumber<optional>

Specifies the number of spatial streams used by the transmission. Only applicable to VHT rates.

heboolean<optional>

Specifies whether this rate is an HE (IEEE 802.11ax) rate.

he_ginumber<optional>

Specifies whether the guard interval used for the transmission. Only applicable to HE rates.

he_dcmnumber<optional>

Specifies whether dual concurrent modulation is used for the transmission. Only applicable to HE rates.

ehtboolean<optional>

Specifies whether this rate is an EHT (IEEE 802.11be) rate.

eht_ginumber<optional>

Specifies whether the guard interval is used for the transmission. Only applicable to EHT rates.

eht_dcmnumber<optional>

Specifies whether dual concurrent modulation is used for the transmission. Only applicable to EHT rates.

WifiScanResult

A wireless scan result object describes a neighbouring wireless network found in the vicinity.

Type:
Properties
NameTypeDescription
ssidstring

The SSID / Mesh ID of the network.

bssidstring

The BSSID if the network.

modestring

The operation mode of the network (Master, Ad-Hoc, Mesh Point).

channelnumber

The wireless channel of the network.

signalnumber

The received signal strength of the network in dBm.

qualitynumber

The numeric quality level of the signal, can be used in conjunction with quality_max to calculate a quality percentage.

quality_maxnumber

The maximum possible quality level of the signal, can be used in conjunction with quality to calculate a quality percentage.

encryptionLuCI.network.WifiEncryption

The encryption used by the wireless network.

LuCI Documentation
\ No newline at end of file diff --git a/network.js.html b/network.js.html index 5b52d8d83d..d641f77341 100644 --- a/network.js.html +++ b/network.js.html @@ -355,7 +355,10 @@ function maskToPrefix(mask, v6) { function initNetworkState(refresh) { if (_state == null || refresh) { const hasWifi = L.hasSystemFeature('wifi'); - _init = _init || Promise.all([ + + if (refresh) _state = null; + if (refresh || !_init) { + _init = Promise.all([ L.resolveDefault(callNetworkInterfaceDump(), []), L.resolveDefault(callLuciBoardJSON(), {}), L.resolveDefault(callLuciNetworkDevices(), {}), @@ -390,6 +393,7 @@ function initNetworkState(refresh) { link: dev.link, stats: dev.stats, macaddr: dev.mac, + pse: dev?.pse, type: dev.type, devtype: dev.devtype, mtu: dev.mtu, @@ -532,6 +536,8 @@ function initNetworkState(refresh) { return (_state = s); }); }); + } // end if (refresh || !_init) + } return (_state != null ? Promise.resolve(_state) : _init); @@ -3676,7 +3682,7 @@ WifiDevice = baseclass.extend(/** @lends LuCI.network.WifiDevice.prototype */ { if (sid == null || uci.get('wireless', sid, 'device') != this.sid) return Promise.resolve(false); - uci.delete('wireless', network); + uci.remove('wireless', sid); return Promise.resolve(true); }