Commit graph

251 commits

Author SHA1 Message Date
Jo-Philipp Wich
fd2e755b6f luci-mod-network: fix legacy_rates option dependency
The recently introduced band option support changed the internal frequency
selector choice values, breaking the legacy rates option dependency.

Fixes: #5234
Fixes: 0829d31290 ("luci-mod-network: support newer wireless.wifi-device.band option")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-08-09 19:43:56 +02:00
Jo-Philipp Wich
e5626ece12 luci-mod-network: fix 60GHz radio frequency configuration
Fix incorrect minimum 60GHz frequency value and ensure that a 60GHz band
choice option is available once corresponding channels are found on the
system.

Ref: http://lists.openwrt.org/pipermail/openwrt-devel/2021-July/035810.html
Suggested-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-07-09 21:39:45 +02:00
Jo-Philipp Wich
f57d20bfff luci-mod-network: dhcp.js: don't fail on not existing interface
Fixes: #5177
Fixes: 7e56289538 ("luci-mod-network: improve static DHCP lease validation")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-07-08 18:56:23 +02:00
Jo-Philipp Wich
9d15a4e70c luci-mod-network: fixes to DHCP lease validation
- validate current form value IP instead of stored uci one
 - ensure to not pass non-string values to the validator
 - remove leftover debug code
 - simplify obtaining formvalues

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-07-03 20:40:29 +02:00
Jo-Philipp Wich
7e56289538 luci-mod-network: improve static DHCP lease validation
- Ensure that MAC addresses are unique within the same pool
 - Ensure that IP addresses are globally unique
 - Ensure that IP addresses are within any DHCP pool range

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-07-03 18:54:14 +02:00
Jo-Philipp Wich
91f46d765b Revert "luci-mod-network: issue with breakdown of dnsmasq after duplication of static IP was fixed"
This reverts commit 463e910119.

This change causes the entire static lease to get deleted when attempting
to change the MAC address.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-07-03 07:20:37 +02:00
Jo-Philipp Wich
f1f566bfe2 luci-mod-network: fix saving bridge VLANs without member ports
Calling `uci.set()` with an empty array yields an invalid argument error,
make sure to pass `null` instead in this case.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-07-02 20:47:11 +02:00
Jo-Philipp Wich
2869c9cf32 luci-mod-network: work around jsmin bug
The jsmin minifier incorrectly transforms the expression `/\*/.test(...)`
into `/\* /.test(...)`, causing the VLAN filter dialog to not recognize
PVID settings in the configuration.

Work around the issue by using an equivalent `\x2a` escape sequence instead.

Ref: https://forum.openwrt.org/t/x/99222/28
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-07-02 20:43:31 +02:00
Jo-Philipp Wich
c4f4294615 luci-mod-network: enforce IPv4 mode for traceroute call
Recent busybox traceroute applet versions support both IPv4 and IPv6 and
default to IPv6 when running a route trace to an IPv6 enabled target
host. Pass the `-4` flag to enforce IPv4 mode in this case.

Fixes: #5155
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-30 17:23:55 +02:00
Florian Eckert
b88157e69a
Merge pull request #4965 from tano-systems/pr/20210406-disable-routes-support
luci-mod-network: Support for disabling routes
2021-06-21 12:44:36 +02:00
Jo-Philipp Wich
c48d8f4a2c treewide: fix typo in "Enable VLAN filtering" label
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-21 08:27:14 +02:00
Jo-Philipp Wich
e57f8663af luci-mod-network: parse ports without tag/pvid annotation as well
Fixes: 01eac366f6 ("luci-mod-network: fix tagging/pvid state parsing in bridge-vlan ports")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-17 17:44:21 +02:00
Jo-Philipp Wich
01eac366f6 luci-mod-network: fix tagging/pvid state parsing in bridge-vlan ports
The previous code naively looked for a `t` in the entire port spec,
wrongly matching untagged ports having a `t` in their name, such
as `eth0`.

Rework the logic to be more strict when parsing the port member
specification to avoid this issue.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-17 17:33:49 +02:00
Jo-Philipp Wich
f689d0d208 luci-mod-network: refactor device configuration
Since all netifd device types inherit generic device settings, we can
simplify various aspects of the device configuration ui and drop unused
code while we're at it.

 - Remove setIfActive() helper, superseded by commit
   f3f74bd0fe ("luci-base: form.js: consider aliased options in AbstractValue.remove()")

 - Remove most dependency constraints to make all generic device settings
   available for all device types

 - Add MTU value validation to disallow exceeding parent device MTU for
   VLAN interfaces

 - Dynamically update placeholder values when changing base or parent
   device options

 - Undo VLAN network config hack since all options are available now.
   Reverts commit
   3c6b59504a ("luci-mod-interfaces: simplify configuring MAC address of 802.1q devices")

 - Do not suggest inactive wireless networks as existing device or base
   device choices

 - Disallow specifying names of already existing network devices when
   creating new device settings

 - Fix a number of multicast dependency specifications

 - Drop now unused functions

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-17 12:40:43 +02:00
Jo-Philipp Wich
36350e9867 luci-mod-network: change port status layout in vlan filter config
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-17 09:45:48 +02:00
Jo-Philipp Wich
f6f1eacb01 luci-mod-network: only consider bridge vlans belonging to the current device
In case multiple bridges with bridge vlans are declared, LuCI did not
correctly filter the VLANs to show only the ones belonging to the
bridge being configured currently.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-17 09:22:16 +02:00
Jo-Philipp Wich
4286c84825 luci-mod-network: wireless.js: recognize HE* htmodes
Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3856#comment9797
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-14 09:06:20 +02:00
Jo-Philipp Wich
cbf2cc396a luci-mod-network: small styling fixes for vlan filter matrix
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-13 21:48:11 +02:00
Rafał Miłecki
fa51d04459 luci-mod-network: migrate more device options
Include mtu and igmp_snooping while migrating.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-06-12 23:01:28 +02:00
Jo-Philipp Wich
bb3269945c luci-mod-network: reset bridge VLANs on cancelling modal dialog
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-12 22:54:51 +02:00
Jo-Philipp Wich
7a781d9cd8 luci-mod-network: fix vlan filter matrix overflow after redraw
Ensure that the overflow styles are reapplied after a redraw. This also
simplifies the code as a side-effect.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-12 22:08:13 +02:00
Jo-Philipp Wich
8c71b1d01e luci-mod-network: add port status to bridge vlan filter matrix
Also ensure that port devices are ordered numerically.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-11 10:19:06 +02:00
Jo-Philipp Wich
ded6e53bcd luci-mod-network: fix horizontal scrolling in the bridge vlan filter matrix
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-09 21:55:43 +02:00
Jo-Philipp Wich
fb82e03635
Merge pull request #5110 from jow-/wireless-band-option
luci-mod-network: support newer wireless.wifi-device.band option
2021-06-09 19:26:04 +02:00
Jo-Philipp Wich
e13d82a202 luci-mod-network: interfaces.js: fix ifname migration in device sections
The migration code attempted to add new device sections instead of moving
the ifname option to a ports list within the existing ones.

Fixes: #5108
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-09 11:01:36 +02:00
Jo-Philipp Wich
608f89429b luci-mod-network: interfaces: show bridge port device icons again
Restore the display of bridge port device icons in the interface overviews.
This feature has been lost after migrating the network config from legacy
bridge declarations to device bridge declarations.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-09 10:22:38 +02:00
Jo-Philipp Wich
0829d31290 luci-mod-network: support newer wireless.wifi-device.band option
OpenWrt switched from "option hwmode" to "option band" in order to select
the frequency band to use for the radio phy.

Extend the channel selector to recognize and use an existing "option band"
to select the appropriate channel list. When operating upon a wireless
configuration still using "option hwmode", then translate it to a band
value internally and translate it back to "option hwmode" on save.

This should provide forward- and backwards compatibility with both current
OpenWrt master and older versions still using hwmode.

Fixes: #5106
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-09 10:03:54 +02:00
Jo-Philipp Wich
88b9d84388 treewide: consolidate {IPv4,IPv6,MAC} {address,gateway} spellings
- Turn IPv4-Address into IPv4 address
 - Turn IPv4-Gateway into IPv4 gateway
 - Turn IPv6-Address into IPv6 address
 - Turn IPv6-Gateway into IPv6 gateway
 - Turn MAC-Address into MAC address

Also remove related duplicate translation entries.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-07 12:48:08 +02:00
Jo-Philipp Wich
b5832d134e treewide: fix "promiscious" typo
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-07 11:53:04 +02:00
Jo-Philipp Wich
9bd27b0bb8
Merge pull request #5095 from jow-/dhcpv6-rework
luci-mod-network: interfaces: restructure DHCPv6 and IPv6 RA options
2021-06-05 19:13:05 +02:00
David Bauer
516c58e133
Merge pull request #5070 from blocktrron/pr-luci-wifi6
luci-mod-network: add 802.11ax HE support
2021-06-05 19:04:11 +02:00
Jo-Philipp Wich
a6c0ad00b2 luci-mod-network: allow device declarations and device configs to coexist
It is legal to have two device sections referring to the same netdev if one
section is a declaration (a section setting option type) and the other is
a configuration (a section not specifying a type but matching an existing
netdev).

Support this case in LuCI since it might be required for some complex
device setups.

Additionally, fix the device type determination for device configuration
sections without type, those should be treated as ethernet (a.k.a.
simple device) configuration instead of falling back to the underlying
netdev device type.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-05 18:41:39 +02:00
David Bauer
f35e877dc6 luci-mod-network: add 802.11ax HE support
This commit adds the ability to configure HE-modes for radios
(HE20 / HE40 / HE80 / HE160) as well as HE rate information in the
assiciation view.

Tested-on: Ubiquiti UniFi 6 Lite / LR

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-06-05 16:24:19 +02:00
Jo-Philipp Wich
3c6b59504a luci-mod-interfaces: simplify configuring MAC address of 802.1q devices
Treat not explicitly configured, preexisting VLAN interfaces as simple
network devices when adding configuration for them, since it is more
likely that people want to set general device properties such as MAC
address instead of reconfiguring ingress/egress QoS mapping, which is
the only editable property of preexisting VLAN device config dialogs.

Ref: https://github.com/openwrt/luci/issues/5102
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-05 16:17:37 +02:00
Jo-Philipp Wich
3fbd433884 luci-mod-network: interfaces: restructure DHCPv6 and IPv6 RA options
- Condense overly large IPv6 RA/DHCPv6 description texts and get rid of most embedded markup

 - Switch ra/ndp/dhcpv6 mode selections to rich dropdown lists and move extended choice
   descriptions next to the selection options

 - Drop ndproxy_static option which has been removed from odhcpd long ago

 - Add format validations to all text input fields

 - Add ability to configure master/relay modes for non-static interfaces (#2998)

 - Move extended RA configuration options into a new tab

 - Prevent enabling master mode on multiple interfaces

 - Prevent enabling ra/dhcpv6 server mode on non-static or master interfaces

 - Drop ra_management in favor to ra_flags option (#5083)

 - Add support for dns_service option

 - Read current effective IPv6 MTU and hop limit placeholder values from procfs

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

Signed-off-by: Niels Widger <niels@qacafe.com>
[rework code to be forwards/backwards compatible, fix some Network.Hosts
 methods, fix IP choice ordering, change commit subject, rewrap commit
 message]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-03 09:51:09 +02:00
Jo-Philipp Wich
10f02472c5 luci-mod-network: rename "device" option to "_net_device" internally
This is required to resolve conflicts with the existing "device" option
in other proto handlers such as PPP or QMI where "device" refers to the
device path of the tty control device instead of a netdev name.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-01 15:34:11 +02:00
Jo-Philipp Wich
26e21d43b5 luci-mod-network: clarify device settings reset button tooltip
Ref: #5090
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-01 15:34:11 +02:00
Jo-Philipp Wich
671c94b034 luci-mod-network: don't accidentally reset macvlan device names
Fixes: #5081
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-01 15:34:11 +02:00
Hannu Nyman
0a6fda27e7 luci-mod-network: drop duplicated "Master" option
It got accidentally added when additional RA and NDP parameters
were added.

Fixes: 504bdb23fb ("luci-mod-network: Introduce new RA and NDP params...")
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-06-01 08:15:01 +03:00
Rafał Miłecki
49be69316b luci-mod-network: migrate macaddr during bridge migration
Link: https://forum.openwrt.org/t/network-migration-21-02-0-rc2/97934
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-31 21:48:09 +02:00
Jo-Philipp Wich
34dc351303 luci-mod-network: allow netifd version query to fail
Fixes: 17af33ee48 ("luci-mod-network: migrate network config depending on netifd version")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-05-31 19:00:15 +02:00
Jo-Philipp Wich
fc12933670 luci-mod-network: make device selector dependent on protocol (again)
This commit effectively reverts the change made with
907b4222f7 ("luci-mod-network: don't hide "Device" on protocol change").

Floating tunnel protocols such as 6in4, plain PPP over modem device,
VPNC etc. do not have any layer 2 device at all, for such protocols the
device selector should be hidden.

Also swap back the incorrect option order introduced with commit
b7f3cf66ca ("luci-mod-network: drop support for *adding* legacy bridges").

Since device depends on proto, it should come after the protocol selection,
not before.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-05-31 14:04:50 +02:00
Jo-Philipp Wich
147188f6ee luci-mod-network: fix device dependencies in add interface dialog
Commit b7f3cf66ca "luci-mod-network: drop support for *adding* legacy bridges"
dropped the protocol dependcies of the ifname/device selector in the add new
interface dialog.

Re-add the required dependencies and swap the order of the protocol and
device inputs while we're at it since latter depends on the former.

Fixes: b7f3cf66ca ("luci-mod-network: drop support for *adding* legacy bridges")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-05-31 11:50:56 +02:00
Rafał Miłecki
e7c9c63c65 luci-mod-network: split config migration into 2 steps
Problem with handling all migrations in 1 step is that uci.sections()
doesn't include changes queued using uci.callAdd() and uci.callSet().
That could result in unexpected behaviour and generating invalid
configs.

For the sake of simplicity and reliability use 2 steps migration. The
downside is that users may get prompted twice to migrate.

Reported-by: Hauke Mehrtens <hauke@hauke-m.de>
Fixes: 74be304e54 ("treewide: use "device" option in UCI "interface" sections")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Tested-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-05-29 18:19:14 +02:00
Rafał Miłecki
bbb3c4c4a5 luci-mod-network: allow setting bridge device MTU and MAC
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-28 15:34:41 +02:00
Rafał Miłecki
bc81e09781 luci-mod-network: bump min netifd version for migration
Using "device" option requires netifd from 2021-05-26 or newer.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-27 11:05:42 +02:00
Rafał Miłecki
74be304e54 treewide: use "device" option in UCI "interface" sections
netifd has been recently patched to use "device" option instead of
"ifname" as more clear & accurate.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-27 10:52:51 +02:00
Rafał Miłecki
17af33ee48 luci-mod-network: migrate network config depending on netifd version
Checking netifd version is important for users of the most recent LuCI
that didn't update netifd (e.g. OpenWrt package).

Suggested-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-26 13:29:55 +02:00
Rafał Miłecki
b8acde7f48 luci-mod-network: migrate config to use "ports" option
LuCI supports only the newer method of specifying bridge ports using the
"ports" option. Offer users migration so they can configure their
network.

Example:

1. Before
config device
        option name 'br-lan'
        option type 'bridge'
        list ifname 'lan1'
        list ifname 'lan2'
        list ifname 'lan3'
        list ifname 'lan4'

2. After
config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-26 11:21:19 +02:00
Rafał Miłecki
398932f39b luci-mod-network: drop 2 unused variables
Fixes: faad7464a8 ("luci-mod-network: add support for network.device sections")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-20 14:04:46 +02:00
Rafał Miłecki
907b4222f7 luci-mod-network: don't hide "Device" on protocol change
Device ("ifname" UCI option) doesn't depend on protocol so there is no
need to hide / reset it on protocol change.

While at it drop names of two removed inputs (dead code).

Fixes: ec020cee0c ("luci-mod-network: drop support for *editing* legacy bridges")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-20 14:04:34 +02:00
Rafał Miłecki
bca76a7673 luci-mod-network: add bridge interface migration
LuCI now supports the updated UCI syntax for bridges that requires:
1. device section for L2
2. interface section for L3

Check for legacy syntax usage and offser user a migration to allow
changing network config.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-18 20:11:22 +02:00
Rafał Miłecki
a90115cd82 luci-mod-network: use "ports" option for setting bridge ports
netifd has been recently patched to use more accurate "ports" option
instead of "ifname"

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-18 20:09:47 +02:00
Rafał Miłecki
ec020cee0c luci-mod-network: drop support for *editing* legacy bridges
The old way of defining bridge (L2) as part of interface (L3) is
deprecated. All such configs should be migrated to define bridge as L3
UCI section type "device".

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-18 20:09:40 +02:00
Rafał Miłecki
b7f3cf66ca luci-mod-network: drop support for *adding* legacy bridges
The old way of defining bridge (L2) as part of interface (L3) is
deprecated. Don't support *adding* interfaces like that.

Support for *editing* legacy bridges is kept for now for compatibility
with existing legacy setups.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-18 12:38:26 +02:00
Michael Pratt
51ab737a4b luci-mod-network: do not remove enable_vlan from config
There are many switch drivers where VLAN functionality is enabled by default.
In this situation, LuCI cannot be used to disable VLAN functionality,
because removing the line from configuration results in VLAN remaining enabled
by the driver.

When enable_vlan is set to 0 by default
by using functions in board.d,
and an unrelated change is made on the Switch webpage,
then the enable_vlan option gets deleted when changes are saved.

Therefore, the option needs to be preserved, whether set to 0 or 1.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
2021-04-21 18:12:43 -04:00
Hannu Nyman
b7dd10da0f luci-mod-network: fix handling of optional RA/NDP options
Fix the handling of optional IPv6 RA and NDP options
that were exposed to LuCI with 504bdb23f

Commit 504bdb23f defined them optional but provided default values.
Those values might get unnecessarily written to /etc/config dhcp when
the the user modifies some other values. Remove the default values,
but provide placeholder for some of them.

Add the missing optional definition to 'ndproxy_routing'.
(It is a flag, so optional default values do not get written to
the config file.)

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-04-20 21:06:42 +03:00
Dirk Brenken
2617fcdc63 luci-mod-network: fix xhtml markup
* fix markup in interfaces.js (#4980)
* sync translations

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-04-14 16:49:30 +03:00
Anton Kikin
bfe8a01040 luci-mod-network: Support for disabling routes
Support for disabling routes in netifd was added in commit [1]. This commit
adds support for disabling routes through the LuCI interface.

Additionally hidden the route options descriptions in the header of the
routes table (they are still available in the modal view).

[1]: https://git.openwrt.org/?p=project/netifd.git;a=commit;h=327da9895327bc56b23413ee91a6e6b6e0e4329d

Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2021-04-06 04:40:02 +03:00
Paul Dee
504bdb23fb luci-mod-network: Introduce new RA and NDP params with help-text.
New: Router Advertisement parameters and accompanying help-text.
New: 3 additional NDP options and accompanying help-text.

Until now, some of the IPv6 settings are mysterious. They are now
clarified. The information is accessible to IPv6 beginners.

Signed-off-by: Paul Dee <itsascambutmailmeanyway@gmail.com>
2021-04-01 22:03:34 +02:00
Paul Dee
988c98bdc6 luci-mod-network: Add help text for many existing odhcpd IPv6 parameters
and Global network options ULA.

Relocated the "DHCPv6 Mode" to below RA-Service: DHCPv6-Mode is actually
ra_management in disguise. Better grouping.

Until now, some of the IPv6 settings are mysterious. They are now
clarified. The information is accessible to IPv6 beginners.

Signed-off-by: Paul Dee <itsascambutmailmeanyway@gmail.com>
2021-04-01 21:56:27 +02:00
Jo-Philipp Wich
2072c66c5a luci-mod-network: fix device section cleanup
Ensure that device sections are only automatically removed after all
related options have been parsed, to avoid prematurely deleting sections.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-29 22:35:50 +02:00
Jo-Philipp Wich
935e9a3c34 luci-mod-network: allow disabling interface->device option migration
Introduce a `migrate` properties which selectively allows disabling the
`config interface` to `config device` migration logic for single options.

Use the new flag to disable migration of the "ipv6" option which has
different semantics in interface and device sections.

Ref: https://forum.openwrt.org/t/pppoe-disable-ipv6/92548
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-29 22:35:10 +02:00
Jo-Philipp Wich
7dde01be3c luci-mod-network: fix changing ifname in disabled legacy bridge mode
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-29 16:33:07 +02:00
Jo-Philipp Wich
f48f9f11e7 luci-mod-network: make condition for disabling legacy bridging more specific
Only disable legacy bridging if an existing network.device section with type
bridge is found, ignore non-type sections since those do not declare a
bridge but set attributes on top of an existing one.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-29 16:30:32 +02:00
Jo-Philipp Wich
b9fad85f2e luci-mod-network: fix unsetting network.device options
The existing logic only handled removing the last remaining device section
option (which results in the deletion of the entire section) but failed to
actually unset single options.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-29 16:27:47 +02:00
Jo-Philipp Wich
a9a223b973 luci-mod-network: don't implicitly move bridge opts into device sections
When setting bridge and device specific options such 'stp' or
'igmp_snooping', LuCI so far transparently created or reused a
`config device` section and set the corresponding option there.

In the case of bridges, this triggers multiple problems:

 - When implicitely creating a `config device` section referring to the
   bridge device, the legacy bridge configuration of the corresponding
   interface is disabled, causing a broken configuration on subsequent
   save operations

 - Netifd does not appear to properly merge bridge settings from config
   device and config interface sections, leading to an incoherent
   configuration state

In order to avoid that issue, do not automatically migrate bridge specific
options.

Fixes: #4948
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-29 16:00:10 +02:00
Jo-Philipp Wich
9a92f9c761 luci-mod-network: fix handling of peerdns/dns/dns_search options
The previous change didn't take dynamic dependency mangling into account.

Fixes: 2bfd4908a9 ("luci-mod-network: restore DNS option semantics for proto static")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-21 00:50:27 +01:00
Jo-Philipp Wich
2bfd4908a9 luci-mod-network: restore DNS option semantics for proto static
The peerdns settings makes little practical sense for proto:static
interfaces, so revert to allow setting the DNS server list directly.

Fixes: faad7464a8 ("luci-mod-network: add support for network.device sections")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-21 00:36:24 +01:00
Jo-Philipp Wich
edf640af58 luci-mod-network: fix legacy bridge configuration
Ref: https://github.com/openwrt/luci/pull/4307#issuecomment-803432603
Fixes: faad7464a8 ("luci-mod-network: add support for network.device sections")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-21 00:19:55 +01:00
Jo-Philipp Wich
1c4284150d luci-mod-network: fix invalid variable access when creating interfaces
Fixes: eeef38d534 ("luci-mod-network: add support for bridge vlan filtering")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-21 00:17:35 +01:00
Jo-Philipp Wich
bea7b8dc7c luci-mod-network: fix opacity for device icon tooltips
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-18 17:28:41 +01:00
Jo-Philipp Wich
14fdce0fcd luci-mod-network: tools.network: handle bridge config and vlan corner cases
- Disable interface-level bridging if a corresponding br-$name bridge
   already exists as device declaration

 - Exempt wireless interfaces from bridge port configuration, they can only
   be attached indirectly through "option network"

 - Consider bridge ports from both "option ifname" in interface/device
   sections and from "option ports" in bridge-vlan ones

 - Small fixes for rendering quirks

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-18 17:28:40 +01:00
Jo-Philipp Wich
3b4c161e01 luci-mod-network: allow wifi bridging with bridge or bridge vlan ifaces
Recent netifd automatically adds wireless devices as bridge ports if the
layer 2 device referenced by the "config interface" target network is a
Linux network bridge or a VLAN interface on top of a network bridge.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-18 17:28:40 +01:00
Jo-Philipp Wich
4cde2bda73
Merge pull request #4307 from jow-/uci-network-device-support
Introduce support for managing `config device` and `config bridge-vlan` sections
2021-03-18 17:27:31 +01:00
Florian Eckert
811225156a
Merge pull request #4709 from opastushkov/dnsmasq_crash_on_duplication_of_static_ip
luci-mod-network: issue with breakdown of dnsmasq after duplication o…
2021-03-17 08:55:09 +01:00
Jo-Philipp Wich
eeef38d534 luci-mod-network: add support for bridge vlan filtering
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-15 11:40:30 +01:00
Jo-Philipp Wich
faad7464a8 luci-mod-network: add support for network.device sections
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-15 11:40:30 +01:00
Jo-Philipp Wich
069a97e55c luci-mod-network: interfaces.js: simplify some code using new ui helpers
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-15 11:40:30 +01:00
Giovanni Giacobbi
af422b1924 treewide: removed trailing whitespaces and extra newlines in 'modules'
Signed-off-by: Giovanni Giacobbi <giovanni@giacobbi.net>
2021-01-20 17:48:16 +02:00
Oleksandr Pastushkov
463e910119 luci-mod-network: issue with breakdown of dnsmasq after duplication of static IP was fixed
Before this commit, assigning the same static IP address to two
different hosts disabled dnsmasq.

Logic of adding a new static lease was modified. If user try to assign a
new MAC address to already reserved IP, old lease will be modified (list
of MAC addresses will be extended by new MAC) instead of creation a new lease with the same IP.

Signed-off-by: Oleksandr Pastushkov <oleks.pastushkov@gmail.com>
2021-01-04 02:07:45 +02:00
Hannu Nyman
e609ef0ef5 luci-mod-network: modernize 802.11w help text
Modernize the 802.11w help text as support for 802.11w is
currently always compiled into hostapd/wpad and most of
the relevant wireless drivers support it well.

Add a cautionary note that some drivers do not fully support
it. Mention mwlwifi by name as it has several 802.11w bugs
open in upstream and its development has stopped.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-01-02 15:20:18 +02:00
Dobroslaw Kijowski
ab01040663 luci-mod-network: skip check for 802.11w feature
OpenWrt commit 1a9b896d ("treewide: nuke DRIVER_11W_SUPPORT") enables
802.11w feature for all wpad/hostapd configurations. The feature flag
was removed at all but for the compatibility reasons 11w is still
advertised (but there's a plan to nuke it also) [1].

Remove conditional 802.11w LuCI support to match current behavior.

[1]: https://github.com/openwrt/openwrt/pull/3347

Signed-off-by: Dobroslaw Kijowski <dobo90@gmail.com>
2021-01-02 14:59:25 +02:00
Jo-Philipp Wich
f3417f2871 luci-mod-network: restrict legacy_rates option to hwmode 11g
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-12-23 19:02:38 +01:00
Florian Eckert
5a021f8419
Merge pull request #4649 from nicklowe/master
luci-mod-network Add description: Hidden SSID, WMM
2020-12-21 11:25:58 +01:00
Jo-Philipp Wich
7b5b7fbcd6 luci-mod-network: properly handle wireless devices when adding interfaces
Wireless device names must not be added as list/option ifname, but the
network must be backreferenced in config wifi-iface instead in these
cases.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-12-12 12:16:45 +01:00
Nick Lowe
9060c12915 luci-mod-network Add description: Hidden SSID, WMM
luci-mod-network Describe issues: Hidden SSID, WMM

The performance and reliability implications of hiding SSIDs or disabling
WMM are not commonly known and these settings often end up being
misconfigured to harmful effect.

To seek to mitigate this, add descriptions explaining that:

Where the ESSID is hidden, clients may fail to roam and airtime efficiency
may be significantly reduced.

Where Wi-Fi Multimedia (WMM) Mode QoS is disabled, clients may be limited
to 802.11a/802.11g rates.

Signed-off-by: Nick Lowe <nick.lowe@gmail.com>
2020-12-09 16:15:07 +00:00
Nick Lowe
ec49f3b546 luci-mod-network: wireless.js Disable 802.11b by default
The time has long come where 802.11b DSSS/CCK data rates should be disabled
By default in OpenWRT. Users in need of 802.11b client support can reasonably
enable these where they are needed.

The balance of equities has significantly, and for a long time, tipped
such that dropping backwards compatibility by default with 802.11b
devices is appropriate, proportionate and justified. By doing so,
management and control traffic is moved by default to a 20
MHz wide 6 Mb/s OFDM data rate instead of a 22 MHz wide 1 Mb/s DSSS data
rate. This is significantly more airtime efficient.

For discoverability:
1) Move the option from the Advanced Settings to the General Setup tab.
2) Add a description explaining potential compatibility implications.

Signed-off-by: Nick Lowe <nick.lowe@gmail.com>
2020-12-06 08:53:08 -10:00
Nick Lowe
f5c04e1a2e luci-mod-network: wireless.js cell_density support
Add support for the cell_density option added to OpenWRT via commit:
81ff23fc91dbbedc374e58afdb4b0b13146c0f15

This configures data rates based on the coverage cell density.
Normal configures basic rates to 6, 12, 24 Mbps if legacy 802.11b rates
are not used else to 5.5, 11 Mbps.
High configures basic rates to 12, 24 Mbps if legacy 802.11b rates are
not used else to the 11 Mbps rate.
Very High configures 24 Mbps as the basic rate. Supported rates lower
than the minimum basic rate are not offered.

Signed-off-by: Nick Lowe <nick.lowe@gmail.com>
2020-12-01 16:01:53 +00:00
Jo-Philipp Wich
03c77dafe3 treewide: transition div tables to actual table markup
Modern browsers allow decomposing table markup equally well as nested div
constructs, therefor migrate our <div> table markup to actual <table> tags
but keep the old table/tr/th/td CSS classes for now to allow for a smooth
theme transition.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-11-27 21:36:40 +01:00
Ansuel Smith
83c912716e
luci-mod-network: require ssid when join hidden wifi
WiFi join won't work if is tried to connect to a Hidden Wifi without specifying the WiFi SSID.

Fixes: #2085
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-11-01 19:04:06 +01:00
Jo-Philipp Wich
4e8620443d luci-mod-network: fix SAE/WPA check on network join
The method array may be null in case of an open network, also not all
occurrences of `is_sae` and `is_psk` were properly checked.

Resolve the issue by moving the length check to the variable initialization.

Fixes: ba98a2fd0 ("luci-mod-network: fix logic bug in parse enc for network join")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-11-01 18:24:13 +01:00
Jo-Philipp Wich
78645e7efe
Merge pull request #4561 from Ansuel/fix-enc-ap
Fix one display bug for ap join and #4524
2020-11-01 17:23:17 +01:00
Ansuel Smith
ba98a2fd05
luci-mod-network: fix logic bug in parse enc for network join
In handleJoinConfirm while is_wep is a boolean, is_psk and is_sae are an array. In the following if check, all 3 are used as boolean but Js treat empty array as positive values and this cause the ui to wrongly set the encryption to sae. fix this by checking if the array actually contains data.

Fixes: #4524
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-11-01 01:51:02 +01:00
Ansuel Smith
ae47a5104d
luci-mod-network: use createHanleFn for handleJoin function
handleJoin can be slow to parse all the data and show the new modal, this can result in the disappear of the scan modal and the showing of the wifi config page while the data are generating. This is wrong since a user can think that he did something wrong. Fix this by using the createHandleFn and by removing the scan pool function instead of calling ScanAbort function that with the other thing wrongly removes the Scan modal. (the modal is replaced with the add one when all the data are ready)

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-11-01 01:45:41 +01:00
Jo-Philipp Wich
40acd95726
Merge pull request #4508 from Ansuel/wpscontrol
luci-mod-status: add WPS control for wifi info
2020-10-30 21:19:40 +01:00
Martin Schiller
0f1a793aea luci-mod-network: diagnostics.js: don't pass IP version flag to ping6
Passing "-6" to ping6 from the iputils package will lead to the
following error:
	"ping6: only one -4 or -6 option may be specified"

It does not make sense either.

Fixes: 547776327a ("luci-mod-network: diagnostics.js: pass IP version flag to ping/ping6")
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
2020-10-14 13:12:03 +02:00
Ansuel Smith
095309cf02
luci-mod-network: check directly if hostapd supports wps
Wps Push Button feature is now supported directly from ubus instead of using hostapd_cli.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-10-11 01:32:21 +02:00
Ansuel Smith
6c9a6c334e
luci-mod-network: handle multiple mac for static lease
The mac section for the static lease doesn't correctly handle when multiple mac are set for a rule.
Fixes: #4291

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-10-08 02:43:29 +02:00