Commit graph

14688 commits

Author SHA1 Message Date
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
Rafał Miłecki
cdaf5635b2 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>
(cherry picked from commit b7f3cf66ca)
2021-05-27 12:19:08 +02:00
Jo-Philipp Wich
220f5006af 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>
(cherry picked from commit 2072c66c5a)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
e7a9d9e4bd 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>
(cherry picked from commit 935e9a3c34)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
9f76002dae luci-mod-network: fix changing ifname in disabled legacy bridge mode
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 7dde01be3c)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
08f5bc236e 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>
(cherry picked from commit f48f9f11e7)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
8c2ea08aa8 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>
(cherry picked from commit b9fad85f2e)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
216ddcce71 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>
(cherry picked from commit a9a223b973)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
dec5d8099e 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>
(cherry picked from commit 9a92f9c761)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
7684c18604 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>
(cherry picked from commit 2bfd4908a9)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
a3ec9b262d 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>
(cherry picked from commit edf640af58)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
7147b37a24 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>
(cherry picked from commit 1c4284150d)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
dfd499b4d4 luci-mod-network: fix opacity for device icon tooltips
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit bea7b8dc7c)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
f366dfe484 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>
(cherry picked from commit 14fdce0fcd)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
482f342d25 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>
(cherry picked from commit 3b4c161e01)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
470848fac9 luci-base: network.js: recognize DSA ports and bridge VLANs
Use the newly introduced devtype attribute for more robust network device
type detection. This also allows us to easily recognize DSA ports.

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

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

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit d1bf56d7f1)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
15ae326879 luci-mod-network: add support for bridge vlan filtering
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit eeef38d534)
2021-05-27 12:19:05 +02:00
Jo-Philipp Wich
e75ac2ae34 luci-mod-network: add support for network.device sections
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit faad7464a8)
2021-05-27 12:19:04 +02:00
Jo-Philipp Wich
9e57b782aa luci-mod-network: interfaces.js: simplify some code using new ui helpers
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 069a97e55c)
2021-05-27 12:19:04 +02:00
Oleksandr Pastushkov
5047592f77 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>
(cherry picked from commit 463e910119)
2021-05-27 12:18:42 +02:00
Rafał Miłecki
a5586749d0 luci-mod-network: drop duplicated "Master" option
It got accidentally added while cherry picking RA and NDP params
support.

Fixes: 3a9ebc537f ("luci-mod-network: Introduce new RA and NDP params with help-text.")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-27 08:41:14 +02:00
Hannu Nyman
d851570070 treewide: backport i18n translations from master
Backport translations.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-05-26 19:11:37 +03:00
Liangbin Lian
ac0bcc2d10 luci-theme-material: fix wrong active state on common prefix node
Before fixed, if we have two nodes: 'services/ddns' and 'services/ddnsto',
click any one of they, will show they all actived.

Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
(cherry picked from commit 97d50d2c6b)
2021-05-26 10:09:05 +03:00
Liangbin Lian
19de3acdde luci-app-samba4: support listen on multiple interfaces
/etc/init.d/samba4 already support that

Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
(cherry picked from commit 169ab9979eee780758256c2859f7c2ee86a0b0ae)
2021-05-25 20:04:30 +03:00
Hannu Nyman
53c572ac9b treewide: i18n - Backport translations
Backport translations from master and sync.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-05-16 20:52:12 +03:00
Jo-Philipp Wich
e2abb45b0e luci-mod-status: fix potential XSS via specially crafted DNS names
When an upstream NS returns PTR domain names containing HTML, it is
added verbatim to the connection status table.

Prevent this issue by HTML escaping any values in the source and
destination columns.

Fixes: CVE-2021-32019
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 3c66c5b165)
2021-05-12 12:03:00 +02:00
Hannu Nyman
766e8f8cbf treewide: backport translations i18n
Backport translations.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-05-08 17:05:54 +03:00
Jo-Philipp Wich
e9b6431b14 luci-mod-status: iptables: always make tab pane visible
When ip6tables is not present, the tab group was not initialized,
causing the iptables status display to be empty with certain themes.

Manually mark the pane active in this case to avoid the problem.

Fixes: #5040
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit d24e3295f0)
2021-05-07 19:19:35 +02:00
Paul Spooren
56c323505b luci-app-attendedsysupgrade: fix branch detection
The running branch determines which upgrades are suggested. A jump to a
newer branch (e.g. 19.07.8 to 21.02.1) is only suggested if the advanced
mode is enable, since it may break the router.

OpenWrt versions end in either `-SNAPSHOT`, `.X-rcY` or `.x`. All these
suffixes are removed, resulting in the branch name.

Previously the `-SNAPSHOT` suffix wasn't removed resulting in wrong
branch names.

Also clean up some log spam.

Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit 85e9ee3123)
2021-05-07 03:45:32 -10:00
Paul Spooren
29d3ed290c luci-app-attendedsysupgrade: hide branch update
Branch updates (e.g. 19.07 to 21.02) are risky and shouldn't be
suggested by default. Hide those unless the advanced mode is enabled.

Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit 9184721fab)
2021-05-07 03:45:32 -10:00
Florian Eckert
424d11381b luci-app-mwan3: i18n sync translations
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-05-06 12:27:00 +02:00