Commit graph

14718 commits

Author SHA1 Message Date
Jo-Philipp Wich
e8dd9331c1 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>
(cherry picked from commit 3c6b59504a)
2021-06-12 19:24:00 +02:00
Jo-Philipp Wich
5886f7478d 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>
(cherry picked from commit 3fbd433884)
2021-06-12 19:23:49 +02:00
Jo-Philipp Wich
9660eedfda luci-app-firewall: further luci-rpc/getHostHints compatibility fixes
Rework some further code instances to fall back to the legacy ipv4/ipv6
properties if needed.

Fixes: c7b7b42cd3 ("treewide: Update JS using luci-rpc getHostHints")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit dc0cfc642e)
2021-06-12 19:23:46 +02:00
Jo-Philipp Wich
a6a6d61d9c luci-proto-wireguard: fix fwmark validation to allow 32 bit values
The iptables mark field is 32 bits wide, which is 4 bytes and so 8 hex
characters. Fix the fwmark validation to allow 8 characters in the hex
string.

Fixes: #5098
Suggested-by: Robert <32970961+differentblue@users.noreply.github.com>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit bc1015f7db)
2021-06-12 19:23:42 +02:00
Jo-Philipp Wich
49e25bd03e luci-base: network.js: sorting fixes
Ensure that sort callbacks consistently return [-N .. 0 .. +N] values
instead of just true/false.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit e35041e0a8)
2021-06-12 19:23:37 +02:00
Niels Widger
7d7df070c3 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>
(cherry picked from commit c7b7b42cd3)
2021-06-12 19:23:28 +02:00
Niels Widger
87bcf9e923 rpcd-mod-luci: Return array of addresses in getHostHints
Update luci-rpc's getHostHints method to return two string arrays for
each host, `ipaddrs` and `ip6addrs`, each containing the host's IPv4
and IPv6 addresses, respectively.  Each array is sorted by a priority
derived from the source from which the address was discovered.  The
current address sources and their priority is as follows (a
higher (larger) priority is listed first):

    - neighbor table entries: 10
    - /etc/ethers entries:    50
    - DHCP leasefile:        100
    - RRDNS queries:         100
    - getifaddrs():          200
    - UCI static leases:     200

The existing `ipv4` and `ipv6` string fields for each host in
`getHostHints` has been removed.  Downstream users of getHostHints
still need to be updated.

Fixes: #4838
Signed-off-by: Niels Widger <niels@qacafe.com>
[squash commits, reformat fixes tag]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit a5195e7825)
2021-06-12 19:23:25 +02:00
Jo-Philipp Wich
127b896a52 protocols: rename "device" option to "_modem_device"
This is required to resolve clashes with the generic "option device"
referring to netdev names in current netifd versions.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 96ee6dc8d6)
2021-06-12 19:23:21 +02:00
Jo-Philipp Wich
56cd1abbe8 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>
(cherry picked from commit 10f02472c5)
2021-06-12 19:23:18 +02:00
Jo-Philipp Wich
caa0abf99a luci-mod-network: clarify device settings reset button tooltip
Ref: #5090
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 26e21d43b5)
2021-06-12 19:23:13 +02:00
Jo-Philipp Wich
9bbf5d4002 luci-base: form.js: consider aliased options in AbstractValue.remove()
If different options point to the same underlying uci option, we must only
remove the uci value if none of the other alias options is active in order
to prevent inactive options (due to unsatisfied depends) removing the uci
value of active once on save.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit f3f74bd0fe)
2021-06-12 19:23:10 +02:00
Jo-Philipp Wich
5bdb5fd697 luci-mod-network: don't accidentally reset macvlan device names
Fixes: #5081
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 671c94b034)
2021-06-12 19:23:06 +02:00
Jo-Philipp Wich
1818ddcac3 luci-theme-bootstrap: add svg help icon to form field descriptions
The still referenced help.gif icon is absent by default since it has been
moved to luci-compat.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 6960819997)
2021-06-12 19:23:01 +02:00
Jo-Philipp Wich
b796bff7a9 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>
(cherry picked from commit fc12933670)
2021-06-12 19:22:57 +02:00
Jo-Philipp Wich
1ef7cbf9da 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>
(cherry picked from commit 147188f6ee)
2021-06-12 19:22:53 +02:00
Anderson McKinley
54b2195dcf luci-app-statistics: fix read of hostname
Existing javascript did not read a non-default statistics hostname due to
incorrect config ids.

Signed-off-by: Anderson McKinley <coyoso@tuta.io>
(cherry picked from commit 97424d57af)
2021-06-12 19:22:46 +02:00
Sven Roederer
904fb39c31 luci-theme-openwrt-2020: use SVG-file for favicon and logo
Using the scalable graphic in place of the static png file saves some
ressources in flash and network. It also aligns the filetype to the type
announced to the browser.

fixes GitHub-issue #5051

Signed-off-by: Sven Roederer <freifunk@it-solutions.geroedel.de>
(cherry picked from commit 184e93df5f)
2021-06-12 19:22:37 +02:00
Jan Breuer
87daaa24c8 luci-theme-openwrt-2020: remove submenu margin-bottom when submenu not visible
Signed-off-by: Jan Breuer <jan.breuer@jaybee.cz>
(cherry picked from commit 2b5f78e893)
2021-06-12 19:21:24 +02:00
Jo-Philipp Wich
cb5cf7c08f luci-base: uci.js: merge changes when retrieving entire sections
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit ba4e214160)
2021-06-12 19:21:12 +02:00
Jo-Philipp Wich
fc43d4d41c protocols: fix interface.ipv6 vs. device.ipv6 option conflict
Ref: https://forum.openwrt.org/t/pppoe-disable-ipv6/92548
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 7d49508480)
2021-06-12 19:21:06 +02:00
Jo-Philipp Wich
e5900b3bfe rpcd-mod-luci: expose devtype and iflink properties in getNetworkDevices
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 71feaa5285)
2021-06-12 19:20:50 +02:00
Jo-Philipp Wich
66808a9d4c luci-app-firewall: simplify some form actions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit bbf1a5343f)
2021-06-12 19:20:04 +02:00
Jo-Philipp Wich
c336d2681c luci-base: remove references to removed functions from documentation
Fixes: #4778
Fixes: 366707a68 ("luci-base: drop unused functions in luci.sys")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit a9da1dc5a5)
2021-06-12 19:19:29 +02:00
Nicholas Smith
d2a9284836 luci-base: add new member 'hidden' to DummyValue
Signed-off-by: Nicholas Smith <nicholas@nbembedded.com>
(cherry picked from commit 936dde7422)
2021-06-12 19:19:09 +02:00
Huang-Huang Bao
39280c3703 luci-app-frpc: correct prop name 'subdomain'
Signed-off-by: Huang-Huang Bao <eh5@sokka.cn>
(cherry picked from commit de9f21cb8c)
2021-06-12 19:19:03 +02:00
Stan Grishin
aa51a724fc
Merge pull request #5115 from stangri/21.02-luci-app-vpn-policy-routing
[21.02] luci-app-vpn-policy-routing: support for 21.02.0-rc2
2021-06-09 22:49:22 -07:00
Stan Grishin
d29a460260 luci-app-vpn-policy-routing: support for 21.02.0-rc2
Signed-off-by: Stan Grishin <stangri@melmac.net>
2021-06-10 05:47:50 +00:00
Hauke Mehrtens
139edfce8b themes: Call striptags() on hostname to prevent XSS
This calls striptags() on the hostname to prevent any XSS over the
hostname. This should fix CVE-2021-33425 as far as I understood it.

If someone adds some Javascript into system.@system[0].hostname it would
have been directly added to the page, this prevents the problem.

This can only be exploited by someone being able to modify the uci
configuration, normally a user with such privileges could also just
modify the webpage.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 5cbd79d7e3)
2021-06-09 20:53:15 +02:00
Hannu Nyman
aaac84602d treewide: i18n - Backport translations
Backport translations from master.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-06-08 20:07:21 +03:00
Sven Roederer
51da4d1561 luci.mk: make SUBMENU package define customizable and optional
When including luci.mk in external repos it's sometimes usefull to not use
the default LuCI-submenu hierarchy.
This change defines the LUCI_SUBMENU_FORCED variable which completely overrides
the default submenu of the LuCI config-section. When LUCI_SUBMENU_FORCED is not
defined, the default submenu derrived from LUCI_TYPE or "Application" fallback
is used.
Defining LUCI_SUBMENU_FORCED in the package Makefile will just use this value.
Setting it to "none" will not define a submenu at all.
Together with LUCI_SECTION and LUCI_CATEGORY menu items can now created at any
place in the menu structure.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
(cherry picked from commit 2b11ec6fd0)
2021-06-03 08:39:15 -10:00
Sven Roederer
50f1e69d5b luci.mk: add PKG_PROVIDES make-macro to set package/provides option
Add PKG_PROVIDES macro to be passed down to buildpackage defines as  PROVIDES variable.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
(cherry picked from commit 209141d491)
2021-06-03 08:39:15 -10:00
Sven Roederer
00aa38894f luci.mk: add URL and MAINTAINER fields to package-definitions
Add the LUCI_URL and LUCI_MAINTAINER variables to pass them to the buildpackage
defines. Give them some sane defaults and allow overwritting by the individual
package.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
(cherry picked from commit ae0795deb0)
2021-06-03 08:39:15 -10:00
Hannu Nyman
74e04dde74 treewide: i18n - backport translations from master
Backport translations from master.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-06-01 08:22:44 +03:00
Rafał Miłecki
b860704936 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>
(cherry picked from commit 49be69316b)
2021-05-31 21:52:13 +02:00
Jo-Philipp Wich
d9bff53a1c 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>
(cherry picked from commit 34dc351303)
2021-05-31 19:00:47 +02:00
Jo-Philipp Wich
8e14a086e9 luci-base: fix network data type validation
Fixes: #5085
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit dece9b063c)
2021-05-31 11:40:05 +02:00
Jo-Philipp Wich
81f41819a5 luci-app-samba4: prevent calling split() on array or null values
Since `uci.get()` may return null or array values, we cannot blindly call
split() on the result. Use the safe `L.toArray()` helper which is intended
to deal with such situations.

Also clean up whitespace while we're at.

Fixes: #5080
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit c4cdfcbe51)
2021-05-31 11:27:48 +02:00
Rafał Miłecki
09329fe7bb 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>
(cherry picked from commit e7c9c63c65)
2021-05-29 18:19:54 +02:00
Rafał Miłecki
14511e5392 treewide: drop MAC and MTU from interfaces (protocols)
Those are L2 options that are not part of interfaces (L3), should not be
set there and don't work. Setting MAC and MTU should be done at device
layer (config device) and is supported for basic types already.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 79947af064)
2021-05-28 15:44:44 +02:00
Jo-Philipp Wich
9eee69a62e treewide: remove rendundant proto handler options
The introduction of network device configuration support also implemented
all common, protocol-independent interface options directly in the
interface config view, so drop the redundant option definitions.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 171ef77e89)
2021-05-28 15:44:44 +02:00
Rafał Miłecki
17a62e0f4e luci-mod-network: allow setting bridge device MTU and MAC
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit bbb3c4c4a5)
2021-05-28 15:44:44 +02:00
Rafał Miłecki
a86e770881 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>
(cherry picked from commit bc81e09781)
2021-05-27 12:19:08 +02:00
Rafał Miłecki
c7fd1bfb12 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>
(cherry picked from commit 74be304e54)
2021-05-27 12:19:08 +02:00
Rafał Miłecki
3c34c4645b 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>
(cherry picked from commit 17af33ee48)
2021-05-27 12:19:08 +02:00
Rafał Miłecki
482fc216ac 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>
(cherry picked from commit b8acde7f48)
2021-05-27 12:19:08 +02:00
Rafał Miłecki
8303c2eac3 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>
(cherry picked from commit 398932f39b)
2021-05-27 12:19:08 +02:00
Rafał Miłecki
a1b62732b8 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>
(cherry picked from commit 907b4222f7)
2021-05-27 12:19:08 +02:00
Rafał Miłecki
5356e3fa25 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>
(cherry picked from commit bca76a7673)
2021-05-27 12:19:08 +02:00
Rafał Miłecki
660156e166 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>
(cherry picked from commit a90115cd82)
2021-05-27 12:19:08 +02:00
Rafał Miłecki
8623436678 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>
(cherry picked from commit ec020cee0c)
2021-05-27 12:19:08 +02:00