Commit Graph

1558 Commits

Author SHA1 Message Date
Matthias Schiffer
298723c22b
gluon-core: gluon-check-site: do not fail when IPKG_INSTROOT is unset 2021-07-12 17:06:49 +02:00
Matthias Schiffer
eb3fad4bae
build: move check_site.lua main script into gluon-core package
Installing the script into the image allows site checks to run for
manual package installations via opkg.
2021-07-12 17:06:35 +02:00
Matthias Schiffer
3386221ef1
gluon.mk: fix indentation
A leading tab character usually marks recipe lines in Makefiles;
non-recipe lines must be indented using spaces.

The incorrect tab character doesn't seen to have caused any issues in
this case, but it should be fixed nonetheless, if only for consistency.
2021-07-11 22:39:48 +02:00
Martin Weinelt
97f6710d45
Merge pull request #2259 from blocktrron/bugfix-util-file-contains-line-exists
gluon-core: util: check if file exists prior to reading
2021-07-01 03:42:36 +02:00
David Bauer
ff9f295f7d gluon-core: util: check if file exists prior to reading
The file_contains_line helper function was not testing whether a file
exists or not prior attempting to read from it.

Add this check to circumvent errors on the private WiFi config in
case the hwflags file is missing.

Reported-by: Tom Herbers <freifunk@tomherbers.de>
Tested-by: Tom Herbers <freifunk@tomherbers.de>
Signed-off-by: David Bauer <mail@david-bauer.net>
2021-07-01 03:14:08 +02:00
David Bauer
439b3e0208 gluon-core: read NanoPi R2S primary MAC from LAN board data
The relevant entry for the primary MAC location was lost when rebasing
the patch on OpenWrt 21.02.

Fixes commit ded4b8a711 ("rockchip-armv8: add FriendlyARM NanoPi R2S")

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-07-01 03:05:50 +02:00
David Bauer
260a75cd59 gluon-core: use HE radio mode if available
Configure a radio for HE (802.11ax) operation in case it's supported by
the hardware. This can be the case for 2.4 GHz as well as 5 GHz.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-06-29 22:23:05 +02:00
Martin Weinelt
4f53b9848c
Merge pull request #2248 from blocktrron/pr-ar71xx-cleanup 2021-06-26 23:53:23 +02:00
David Bauer
69ba8e3cfe gluon-core: fix handling of multi-port interfaces
Multi-port interfaces are stored in the network config as an array using
the ports key.
2021-06-26 19:56:17 +02:00
David Bauer
98b16933d3 gluon-core: update board.json interface path
Single LAN and WAN interfaces are now stored in the network configs
"device" key.
2021-06-26 19:55:38 +02:00
David Bauer
9fdc57c175 treewide: drop ar71xx platform specific code 2021-06-26 02:17:15 +02:00
David Bauer
38a11eaca8 gluon-core: remove default bridge devices 2021-06-22 01:59:48 +02:00
David Bauer
102fcac799 gluon-core: update ramips boardnames 2021-06-22 01:59:48 +02:00
David Bauer
a38f2a4cf1 packages: fix missing argument to posix.glob 2021-06-21 16:28:15 +02:00
David Bauer
4f68ddf0d0
Merge pull request #2242 from Dark4MD/master
ramips-mt76x8: add Xiaomi Mi Router 4A (100M Edition)
2021-06-21 16:17:25 +02:00
Matthias Schiffer
7e45878b4e
Merge pull request #2240 from blocktrron/pr-gluon-mesh-vpn-respondd-fix
gluon-mesh-vpn-core: fix potential null pointer dereferences
2021-06-16 17:29:15 +02:00
David Bauer
344f8a47db gluon-mesh-vpn-core: fix two more missing NULL checks
read_stdout can return NULL and thus the return value need to be checked
prior to accessing it.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-06-16 10:31:49 +02:00
Dark4MD
0b00ed9193 ramips-mt76x8: add Xiaomi Mi Router 4A (100M Edition) 2021-06-15 20:12:35 +02:00
Matthias Schiffer
f7e473edfa
gluon-mesh-vpn-tunneldigger: fix Lua mesh-vpn provider module location 2021-06-15 16:32:37 +02:00
David Bauer
7e1e9fe2bd gluon-mesh-vpn-core: avoid reading null pointer
In case the limit_ingress or limit_egress options are not present in
gluon's mesh_vpn section the respondd provider compares a string literal
with a NULL pointer, crashing respondd.

Check both pointers prior to comparing them in order to mitigate this
issue.

Suggested-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: David Bauer <mail@david-bauer.net>
2021-06-14 11:08:38 +02:00
Matthias Schiffer
8a422ac0cb treewide: use lua-jsonc instead of lua-cjson for JSON handling during build 2021-06-12 23:30:47 +02:00
Martin Weinelt
c97be1e18a
Merge pull request #2209 from T-X/pr-batman-adv-noflood+mcast-fw-relax 2021-06-08 01:40:12 +02:00
aiyion.prime
b973c8f133 gluon-status-page: show bandwidth limits 2021-06-07 21:21:42 +02:00
aiyion.prime
c71959df68 gluon-mesh-vpn-core: add simple-tc respondd-provider
omit unlimited bandwidth limit
A value of '-' marks a streamdirection as unlimited.
2021-06-07 11:27:12 +02:00
aiyion.prime
b53997836f gluon-status-page: show vpn protocol 2021-06-05 21:39:34 +02:00
aiyion.prime
b0b80a32b7 gluon-mesh-vpn-core: add vpn protocol respondd provider 2021-06-04 18:41:10 +02:00
David Bauer
98a1c196ed mesh-vpn: fully abstract VPN methods
This fully abstracts VPN methods, making gluon-mesh-vpn-fastd and
gluon-mesh-vpn-tunneldigger completely self-contained.

Provide a LUA interface for generic interacting with VPN methods in
gluon-mesh-vpn-core and web packages.

This also adds the ability to install tunneldigger and fastd to the same
image, selecting the VPN method based on the selected domain.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-05-22 06:54:23 +02:00
David Bauer
436b29d767 gluon-config-mode-core: add missing uci save
A missing uci save for gluon-setup-mode caused the initial setup-process
to be stuck in a config-mode loop.
2021-05-18 19:16:18 +02:00
Matthias Schiffer
42335a07c9
gluon-config-mode-core: unconditionally run gluon-reconfigure
Simplify the individual form providers by always running reconfigure. This
also commits all UCI packages, so we can remove all tracking of UCI
sections from the wizard code.

Instead of returning a list of packages to commit, the providers just
save their settings directly. Explicit runs of upgrade scripts are
removed, as they are now run by reconfigure.
2021-05-15 00:03:02 +02:00
Matthias Schiffer
16fab561db
gluon-config-mode-mesh-vpn: override Section:write() instead of Section:handle() 2021-05-15 00:03:02 +02:00
Matthias Schiffer
df9fa32d58
gluon-web-model: add state tracking to sections
This add support for a write() method on sections, in addition to the
value and form level write(). write() is only called when the section is
valid and visible. In addition, write() is empty by default, so it can be
overridden more easily.
2021-05-15 00:02:44 +02:00
Martin Weinelt
0ac3061225
Merge pull request #2214 from AiyionPrime/status_page_mesh_protocol 2021-05-09 16:53:49 +02:00
aiyion.prime
5c12b037d7 libgluonutil: free getline
Co-Authored-By: lemoer <git@irrelefant.net>
2021-05-08 20:35:24 +02:00
David Bauer
1c38906eef
Merge pull request #2163 from lemoer/pr_vpn_as_gluon_wired
Generalize proto "gluon_wired.sh"
2021-05-07 00:10:27 +02:00
aiyion.prime
a683486514 fixup! gluon-status-page: add mesh protocol to status-page 2021-05-06 19:03:06 +02:00
aiyion.prime
77a6b9a947 gluon-status-page: add mesh protocol to status-page 2021-05-06 16:37:32 +02:00
lemoer
bbecd44be1 gluon-core: extend gluon_wired proto for l3 devices
This is a preparation to use the gluon_wired.sh proto on top of
layer 3 tunnel interfaces.
2021-05-06 00:43:01 +02:00
lemoer
c14b4c0b4b gluon-core: add vxlan option to gluon_wired proto
Before this commit the decision whether a vxlan layer will be
introduced between the lower interface before the interface is
added to batman was inside the proto. Now the decision is moved
to the user of the proto.
2021-05-06 00:43:01 +02:00
David Bauer
9e09d08cf6
Merge pull request #2177 from blocktrron/pr-wan-radio-ifname
gluon-web-private-wifi: define ifname for WAN radio
2021-05-03 17:39:31 +02:00
David Bauer
e729b81312 gluon-private-wifi: add package
Add a package for handling upgrade-scripts speific for the WAN radio
operation.

This way, the config mode interface can be removed seperately from the
core functionality to perform tasks on system upgrade. This can be
useful when the setup-mode is removed entirely for space preservation.
2021-05-02 23:25:32 +02:00
David Bauer
a922944fee mesh-wireless-sae: drop unused function parameters
Drop these unused parameters in the function description, as only the
first parameter is referenced within the function block.
2021-05-02 02:20:00 +02:00
Linus Lüssing
98f3f63842 gluon-ebtables-filter-multicast: relax IPv6 multicast firewall rules
Allow the transmission of IPv6 multicast packets as long as they are not
flooded through the whole mesh.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
2021-05-01 22:36:14 +02:00
David Bauer
f4adb66772 gluon-web-private-wifi: define ifname for WAN radio
Set the ifname for the WAN radio (Private WLAN) to wanX, X being the
radio index.

All other radios created by Gluon already have their ifname defined
following this pattern.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-05-01 20:57:15 +02:00
David Bauer
d0551c2dcd web-admin: fix firmware partition name
The rudimentary flash size determination function expects the partition
for the devices firmware to be called "linux" while it is (since quite
some time) "firmware".

Fix this error to display available flash size as well as more useful
error message in case the uploaded firmware image exceeds the flash
space.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-05-01 03:15:51 +02:00
Linus Lüssing
288daf5a47 gluon-mesh-batman-adv: reenable batman-adv multicast optimizations
With batman-adv 2020.4 and the according backports to batman-adv v2019.2
several more bugs were found and fixed regarding the batman-adv
multicast optimizations feature.

Also a "wakeup-call" feature was added to the Linux bridge IGMP/MLD
snooping code in Gluon to work around issues with Android devices.

With batman-adv now at v2019.2, multicast-to-multi-unicasts conversion
is supported, too. Which means that even if there are a few outdated nodes
these and all other recipients will be served multicast packets via unicast,
too, as long as the sum of receiving nodes does not exceed the multicast
fanout setting (default: 16). If is exceeded, then batman-adv will revert
back to broadcast flooding automatically.

Long story short, with all these extra measures in place, let's reenable
the batman-adv multicast optimizations to reduce the layer 2 overhead
and in preparation for multicast applications in the future.

The default is enabled for this feature anyway, so removing the
"batctl multicast_mode 0" overwrite is sufficient.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
2021-04-29 00:40:39 +02:00
Jan-Tarek Butt
9826a12b38 ath79-generic: add Archer D50 v1
Signed-off-by: Jan-Tarek Butt <tarek@ring0.de>
Signed-off-by: David Bauer <mail@david-bauer.net>
2021-04-28 00:30:25 +02:00
David Bauer
490c522351
Merge pull request #2200 from AiyionPrime/status_page_role
gluon-status-page: add role to status-page
2021-04-28 00:11:26 +02:00
aiyion.prime
e6bdbe811a gluon-status-page: use sitetranslation for role 2021-04-23 15:57:37 +02:00
aiyion.prime
f14707cfa2 gluon-status-page: use mac80211 identifier (phy) 2021-04-22 22:43:48 +02:00
aiyion.prime
dc400c9220 gluon-status-page: reformat spaces 2021-04-22 21:43:55 +02:00
aiyion.prime
344d3ab686 gluon-status-page: add channels to status-page 2021-04-22 21:43:55 +02:00
aiyion.prime
b6ec181c80 gluon-status-page: add role to status-page 2021-04-12 12:08:04 +02:00
aiyion.prime
5e2525f573 statuspage: fix tq width
overflow for 'DejaVu Sans'.
2021-04-07 13:02:33 +02:00
J. Burfeind
2c0f8292c6
gluon-neighbour-info: end before timeout (#2185)
End the process after one result in case -l is not given
and destination address is unicast.
Reduces singleshot execution time from timeout seconds to around 150ms.

resolves #2184
2021-03-15 17:52:34 +01:00
Matthias Schiffer
2ecbe488bc
gluon-core: remove unneeded KERNEL_L2TP_IP config symbol
No package uses l2tp_ip.
2021-03-07 18:48:06 +01:00
Sven Eckelmann
50537e5474 ipq40xx: add support for Plasma Cloud PA2200
This device is a dual 5GHz device. It is recommended to manually change the
radio of the first device to the lower 5GHz channels and the second radio
to the upper 5GHz channels
2021-01-13 08:28:12 +01:00
Sven Eckelmann
17baf0f415 ipq40xx: add support for Plasma Cloud PA1200 2021-01-13 08:28:12 +01:00
David Bauer
db9768310a
Merge pull request #2153 from FreifunkVogtland/pa300
ath79: Add support for Plasma Cloud PA300(E)
2021-01-12 15:22:03 +01:00
Matthias Schiffer
17123aa420
gluon-respondd: fix count_stations() arguments
Fixes warnings about implicit pointer-to-int and int-to-pointer casts.

Fixes: 59a4cd63b8 ("gluon-respondd: expose OWE clients in nodeinfo")
2021-01-12 04:32:23 +01:00
Matthias Schiffer
52ee93f160
libgluonutil: add missing gluonutil_get_primary_domain() prototype
Fixes respondd on 64bit archs, as gluonutil_get_primary_domain() was
assumed to return int without the prototype.

Fixes: bcf57467dd ("libgluonutil: implement gluonutil_get_primary_domain()")
2021-01-12 04:29:08 +01:00
Sven Eckelmann
6e2faecb4e ath79: add support for Plasma Cloud PA300E 2021-01-10 09:06:02 +01:00
Sven Eckelmann
a9039229d6 ath79: add support for Plasma Cloud PA300 2021-01-10 09:05:58 +01:00
David Bauer
fd3ecea953
gluon-core: use OpenWrt label-mac as fallback (#2170)
This adds the OpenWrt label-mac device selection as the most preferred
fallback.

While this is only used on OpenWrt 19.07 for backports, we can also use
the label-mac device when backporting device support. This way, we have
to deal with less device-sepcific code downstream.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-01-10 00:51:15 +01:00
CodeFetch
50313697c7 packages: introduce syslog function in gluon.util
This commit introduces a simple function for writing to the syslog and
replaces the custom function used by gluon-hoodselector.
2020-12-29 01:33:29 +01:00
David Bauer
430c0ecc60 wireless-encryption mesh-wireless-sae: depend on OpenSSL daemons
This switches the used wireless daemons for OWE / SAE to the OpenSSL
flavors. The WolfSSL implementation currently seems to be broken.

THis switch may be reverted at a later point in time when hostapd /
wpa_supplicant implementations for WolfSSL have matured.
2020-12-16 00:52:27 +01:00
Martin Weinelt
277718887d
ath79-generic: add support TP-Link Archer C2 v3 (#2145)
CPU: 750 MHz QCA9563
Flash: 8 MB
RAM: 64 MB
Radio 1: Qualcomm Atheros QCA9563 (b/g/n)
Radio 2: Qualcomm Atheros QCA9887 (a/n/ac)
2020-11-11 22:44:11 +01:00
Steffen Förster
954f31a761 ramips-mt7620: add support for Netgear EX3700/EX3800
Specifications:
* SoC: MT7620A
* RAM: 64 MB DDR
* Flash: 8MB NOR SPI flash
* WiFi: MT7612E (5Ghz) and builtin MT7620A (2.4GHz)
* LAN: 1x100M

The -factory images can be flashed from the device's web
interface or via nmrpflash.

Both devices differ by a additional power outlet for the EX3800.
This patch has been tested on a EX3800 device.
2020-10-06 00:04:22 +02:00
Andreas Ziegler
ab2f82ca73
clean up old cleanup code lines (#2119)
* gluon-core: remove obsolete file 100-core-reset-sysctl

* gluon-core: remove obsolete cleanup line

* gluon-client-bridge: remove obsolete cleanup line
2020-09-17 18:19:59 +02:00
David Bauer
5b068d7c47
treewide: rename local_client zone (#2115)
This renames the local_client zone to loc_client, as local_clint exceeds
the maximum zone length allowed for firewall3, which is 11 bytes.

This worked previously due to firewall3 using unsafe string operations.
Now creation of the chain fails (latest OpenWrt master).
2020-09-13 05:24:33 +02:00
Andreas Ziegler
37a40cbca2
Merge pull request #2111 from freifunk-gluon/features-fix
Fix two feature handling bugs
2020-08-30 17:20:51 +02:00
T-X
d73c6b2bcf
gluon-ebtables-filter-multicast: allow respondd queries (#2103)
This allows running a respondd querier and map server behind a Gluon
node.

For instance at Freifunk Lübeck we now moved the map server
behind a Gluon VM and removed batman-adv and fastd from the
map server VM to reduce the maintenance work.

Increased multicast overhead should be minimal / non existent, as it is
unlikely to accidentally have respondd queriers running behind a Gluon
node.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
2020-08-29 09:52:55 +02:00
Matthias Schiffer
13b743d51e features: fix handling of logical expressions
The rewrite of the feature handling introduced multiple major bugs. One
of them was caused by the way Lua's logical operators work:

An expression of the form

    _'autoupdater' and _'web-advanced'

would return 'web-advanced' rather than the boolean true when _ returned
both strings unchanged (because the features are enabled).

As entries with more than a single feature name in their expressions did
not set no_default, Gluon would then attempt to add gluon-web-advanced to
the package selection, as web-advanced is a "pure" feature.

To fix this, and get rid of the annoying nodefault, separate handling of
"pure" feature and handling of logical expressions into two separate
functions, called feature() and when(). To simplify the feature
definitions, the package list is now passed directly to these functions
rather than in a table with a single field 'packages'.

Fixes: ee5ec5afe5 ("build: rewrite features.sh in Lua")
2020-08-28 22:27:38 +02:00
Martin Weinelt
b1294472c6
Merge pull request #2065 from freifunk-gluon/early-reconfigure
Domain switch during reboot/gluon-reload
2020-08-22 19:50:55 +02:00
Jan-Tarek Butt
94f5bd23b9 gluon-core: 200-wireless simplify if conditions
Signed-off-by: Jan-Tarek Butt <tarek@ring0.de>
2020-08-19 17:16:22 +02:00
Martin Weinelt
78f4d0a348
Merge pull request #2099 from mweinelt/sae-wolfssl
gluon-mesh-wireless-sae: switch to wpa-supplicant-mesh-wolfssl
2020-08-16 01:50:58 +02:00
Martin Weinelt
e9e22f60e7
Merge pull request #2042 from blocktrron/wpa3-wolfssl
gluon-wireless-encryption-wpa3: switch to hostapd-wolfssl
2020-08-16 01:50:44 +02:00
Martin Weinelt
882595cc21
gluon-mesh-wireless-sae: switch to wpa-supplicant-mesh-wolfssl 2020-08-16 01:14:22 +02:00
Matthias Schiffer
d82ffb4f81
gluon-autoupdater: make site.conf branch setting optional
Default to the alphabetically smallest branch if none is set in
site.conf.

Also prevent enabling the autoupdater when no branches exist.
2020-08-15 16:36:27 +02:00
Matthias Schiffer
ee53357580
gluon-autoupdater: split CONFIG_GLUON_BRANCH into two separate options
The new options are CONFIG_GLUON_AUTOUPDATER_BRANCH and
CONFIG_GLUON_AUTOUPDATER_ENABLED and allow to control the default branch
and default enable status separately.

The `or ''` fallback in targets/generic is removed, as GLUON_ENV will
set all variables in GLUON_VARS, making previously non-existing
variables exist with an empty value.
2020-08-15 16:36:27 +02:00
Matthias Schiffer
26f02a4eb3
gluon-site: print better error message for domain code conflicts (#2098)
We already have a proper message when the creation of an alias fails
because of a name conflict. Also add a message when the primary filename
of a domain config is already occupied by another domain's alias.

Also add an 'Error:' prefix to the existing message to easier to see.
2020-08-15 16:11:49 +02:00
Matthias Schiffer
de5ebfa44c
gluon-core: run firewall upgrade script after basic network setup (#2091)
Reorder scripts so that the mesh_lan interface is accounted for.

Two other firewall upgrade scripts (mesh-babel and l3roamd) are
reordered as well. While there seems to be no hard dependency at the
moment, it makes sense to run the basic setup first, also to avoid
problems with future changes.

Closes: #2090
Fixes: ed094bc68c ("gluon-core: firewall: Allow custom gluon_wired interfaces (#2041)")
2020-08-14 21:02:55 +02:00
Matthias Schiffer
e06081c3fc
Merge pull request #2069 from freifunk-gluon/web-theme-cleanup
gluon-config-mode-theme: cleanup and select box theming
2020-08-10 21:33:40 +02:00
Andreas Ziegler
6346d20b2d
Merge pull request #2058 from freifunk-gluon/board-json-ifnames
Use LAN/WAN interfaces from board.json, add lantiq special case
2020-08-09 00:37:40 +02:00
Andreas Ziegler
892405b9e0
Merge pull request #2043 from freifunk-gluon/iface-type
Fix tunnel interface detection in respondd nodeinfo
2020-08-09 00:36:14 +02:00
David Bauer
64f4095c1c
gluon-status-page: add wireless client count (#2085)
This adds the wireless client count for 2.4GHz and 5 GHz radios to the
status page. Previously, only the total client count advertised by
the mesh protocol was visible.
2020-08-09 00:34:23 +02:00
David Bauer
73b830eb32
gluon-web: don't display outdoor mode on preserve_channels (#2074)
This will hide the outdoor mode setting on compatible devices in case
the defined channels should be preserved.

Otherwise a user might be under the impression their device is compliant
with outdoor operation when in reality it still uses prohibited
channels.
2020-07-05 19:05:27 +02:00
Matthias Schiffer
1fc71a73b3
gluon-config-mode-geo-location-osm, gluon-web-osm: add support for custom tile layers (#2072)
Allow replacing the default OSM layer with a custom XYZ layer in
site.conf.
2020-07-05 17:06:59 +02:00
Matthias Schiffer
9b3ee477fa
Rewrite features.sh in Lua (#2045)
* build: target_config_lib: introduce concat_list helper

* build: rewrite features.sh in Lua

The `features` file is converted to a Lua-based DSL.

A helper function `_` is used in the DSL; this will return the original
string for enabled features, and nil for disabled features. This allows
to use boolean operations on features without making the code too
verbose.

Besides having more readable and robust code, this also fixes the bug
that all files `packages/*/features` were evaluated instead of only
using the feature definitions of currently active feeds.

* build: add luacheck support for package/features
2020-07-04 22:07:55 +02:00
Matthias Schiffer
f75f40d29a
gluon-config-mode-theme: add cross-browser styling for <select> elements
Replace the ugly arrow shown in Firefox with a custom SVG arrow. Tested
and working in Firefox, Chrome and Edge. The arrow doesn't show in IE, but
the gluon-web-model JavaScript is already severely broken in IE, so we
don't care.
2020-07-03 21:53:51 +02:00
Matthias Schiffer
5263583b74
gluon-config-mode-theme: clean up SCSS
Remove unused and obsolete code.
2020-07-02 23:45:34 +02:00
Matthias Schiffer
7360e97a9c
gluon-web-*: remove non-existing CSS classes 2020-07-02 23:43:23 +02:00
Matthias Schiffer
c2f9c28e0e
gluon-config-mode-theme: indent scss using tabs 2020-07-02 22:57:13 +02:00
Matthias Schiffer
02c8650bae gluon-scheduled-domain-switch: use gluon-switch-domain 2020-07-02 22:35:05 +02:00
Matthias Schiffer
6ab9d3415d gluon-hoodselector: use gluon-switch-domain 2020-07-02 22:35:05 +02:00
Matthias Schiffer
6750aef017 gluon-core: add gluon-switch-domain utility 2020-07-02 22:35:05 +02:00
Matthias Schiffer
e32fa5bc64
gluon-radv-filterd: add string.h and guard to mac.h
- #pragma once include guard
- include string.h to get memset and memcmp prototypes to fix respondd
  provider build warning
2020-07-02 00:17:50 +02:00
Matthias Schiffer
fcd07de676
gluon-radv-filterd: downgrade frequent messages to DEBUG_MSG
When the network connectivity is bad, routers may not appear in the
translation tables, or there may be no originator with TQ >0. Such
conditions to not warrant spamming the log with error messages.
2020-07-02 00:10:45 +02:00
Matthias Schiffer
e384f899b7
gluon-radv-filterd: remove unneeded memset 2020-07-02 00:10:29 +02:00
Matthias Schiffer
ee5ec5afe5 build: rewrite features.sh in Lua
The `features` file is converted to a Lua-based DSL.

A helper function `_` is used in the DSL; this will return the original
string for enabled features, and nil for disabled features. This allows
to use boolean operations on features without making the code too
verbose.

Besides having more readable and robust code, this also fixes the bug
that all files `packages/*/features` were evaluated instead of only
using the feature definitions of currently active feeds.
2020-07-01 20:35:22 +02:00
Matthias Schiffer
8a79d0249f
gluon-scheduled-domain-switch: move gluon-switch-domain to /lib/gluon/scheduled-domain-switch
This script is an implementation detail - let's not clutter the global
$PATH namespace with a script with such a generic name.
2020-06-30 23:49:01 +02:00
Matthias Schiffer
60351a1f19
gluon-core: allow to switch domains during reconfiguration
When gluon.core.switch_domain is set, it replaces the old domain.

This also replaces an unnecessary uci:commit() with uci:save().
2020-06-30 23:49:01 +02:00
Matthias Schiffer
62e71fbc40
gluon-core: run gluon-reconfigure on boot when gluon.core.need_reconfigure is set 2020-06-30 23:49:00 +02:00
Matthias Schiffer
cf0dc24463
gluon-setup-mode: create symlinks in install script
The package rebuild logic of OpenWrt only checks regular files. Avoid
symlinks in the files directory to make rebuilds more robust.
2020-06-30 23:48:55 +02:00
David Bauer
9be7a5cad7
gluon-wan-dnsmasq: read interfaces to update from flag-files (#2060)
This commit changes the behavior for the wan-dnsmasq to read the
interfaces to update the DNS servers on from flag-files.

This way, external custom packages which add a custom VPN WAN interface
can update the DNS server gluon is using for WAN resolving.
2020-06-30 16:37:09 +02:00
Matthias Schiffer
fa0e2d06b6
gluon-core: lantiq: use WAN interface from switch0 configuration
On lantiq, the default WAN ifname is 'dsl0' even on devices that have a
separate WAN port. At least on devices using swconfig we can override
this with the switch port labelled as 'wan'.
2020-06-21 17:47:45 +02:00
Matthias Schiffer
5e44f7cdde
gluon-core: get LAN and WAN interfaces from board.json
Instead of looking at the initial UCI config, we can read this
information from board.json.
2020-06-14 12:38:53 +02:00
David Bauer
baa53b4d8b
Merge pull request #2052 from blocktrron/rt2x00-80211w
mac80211: rt2800: enable MFP support unconditionally
2020-06-13 19:07:52 +02:00
Matthias Schiffer
92647cd47a
gluon-mesh-batman-adv: do not delete bat0 during hardif teardown (#2057)
With very bad timing, it is possible that the teardown script of a
gluon_mesh interface runs when bat0 was just created, but primary0 is not
yet added to it. Although there is no hardif to remove in this case,
bat0 will still be deleted, because there is no hardif in bat0.

Disable the interface removal logic by passing `-M` to `batctl interface`.
2020-06-13 18:44:46 +02:00
Matthias Schiffer
17bc622892
gluon-config-mode-outdoor: enable 5GHz mesh interfaces when disabling outdoor mode
There is no setting to explicitly enable mesh interfaces in the config
wizard, so we need to enable mesh interfaces by default when the outdoor
mode is disabled (unless site.conf dictates otherwise).

The simplest way to achieve this is to delete the 5GHz mesh interface
sections when outdoor mode is disabled: 200-wireless would delete and
recreate them a moment later anyways, but by deleting them earlier we
ensure that the disabled status is initialized from site.conf again.
2020-06-12 19:27:01 +02:00
Matthias Schiffer
d2052431dd
gluon-web-wifi-config: default to enabled 5GHz mesh interfaces when disabling outdoor mode
When disabling outdoor mode, 5GHz mesh interfaces should be enabled by
default again (unless disabled in site.conf).
2020-06-12 19:13:20 +02:00
Matthias Schiffer
3c2593b684
gluon-core: fix handling of 'disabled' site.conf attributes for mesh interfaces
Because is_disabled() was always returning true or false, the
first_non_nil() would never actually check the default setting from
site.conf. This was broken since v2017.1.

Fixes: 6cf03bab37 ("treewide: replace normal uses of luci.model.uci with simple-uci to reduce LuCI dependencies")
2020-06-11 23:52:22 +02:00
David Bauer
2611e86438 gluon-core: allow WPA3 features on ramips-mt7620
Backporting the MFP patch allows us to utilize WPA3 features on this
target.

Tested on TP-Link Archer C20i
2020-06-10 22:45:01 +02:00
David Bauer
5d51b7dc2a
Merge pull request #2049 from freifunk-gluon/outdoor-mode-commit
Fix /etc/config/network commit for outdoor mode change, and related fixes
2020-06-07 03:09:00 +02:00
Matthias Schiffer
e8c65ef75f
gluon-web-model: fix conflicting table fields "reset"
With 11a3b56617 ("gluon-web-model: add dependency support for
sections"), a "reset" function was added to all model nodes. This
conflicts with the "reset" field of the Form object, making reset
buttons show labels like "function: 0xbb8d50" and possibly breaking form
processing when packages override the reset field.
2020-06-06 17:23:21 +02:00
Matthias Schiffer
b15b008e69
gluon-core: create disabled mesh interface sections in outdoor mode
The interfaces should always exist and just be disabled when outdoor
mode is enabled. Not creating them at all leads to an issue in the
advanced wifi settings where an additional reload of the page is
necessary after enabling or disabling the ourdoor mode to make the mesh
VIF options appear or disappear.
2020-06-06 17:12:13 +02:00
Matthias Schiffer
d012d7d32f
gluon-web-wifi-config: make mesh VIF options depend on outdoor=false
Instead of relying on the existence of interface sections only (which is
still used for the case of interface types that are not configured at
all in the site config), add a proper dependency.

This fixes section visiblity with enabled outdoor mode after the following
fix, and gives the user immediate feedback (allowing to disable outdoor
mode and enable meshing in a single step).
2020-06-06 17:12:13 +02:00
Matthias Schiffer
53c33acaf9
gluon-web-wifi-config: rename and simplify filter_active_interfaces()
- Return early
- Rename to has_active_interfaces(), as it returns a boolean
2020-06-06 17:12:12 +02:00
Matthias Schiffer
600ab99f80
gluon-config-mode-outdoor, gluon-web-wifi-config: commit network config
200-wireless will add or remove the mesh network sections of
/etc/config/network. Commit this file, so the modified setting doesn't
get lost on reboot.

Fixes: #2048
2020-06-06 16:47:35 +02:00
Matthias Schiffer
45b518df11 gluon-web-model: remove unused field error message code
Validation errors are mostly handled in the frontend (by displaying
invalid fields with a red background). There was some code left in the
backend for handling different kinds of errors, and returning custom
error messages from validate(), but the resulting value was not used
anywhere.
2020-06-05 21:46:30 +02:00
Matthias Schiffer
5adbaf2907 gluon-web-model: remove dead code for section errors 2020-06-05 21:46:30 +02:00
Matthias Schiffer
e6859ca031 gluon-web-model: remove unused tag_invalid and tag_missing fields 2020-06-05 21:46:30 +02:00
Matthias Schiffer
11a3b56617 gluon-web-model: add dependency support for sections
- Add a dependency array to section template
- Lift dependency handling from AbstractValue to Node
- Split resolve_depends() into a function handling dependencies of a
  node itself (resolve_node_depends()), which now is used for all nodes,
  and the existing recursive descent through the node tree
- When any node's dependencies are not satisfied, all descendents are
  reset recursively, meaning that an option in a section that is hidden
  will always be ignored, as if the option's own dependencies were
  unsatisfied

Fixes: #1349
2020-06-04 22:54:28 +02:00
Matthias Schiffer
35950b44b7 gluon-web-model: fix passing additional variables from form template to sections
This is currently unused in our packages.
2020-06-04 22:54:28 +02:00
Matthias Schiffer
3951607e53 gluon-web-model: fix deplist() argument list
Fixes dependency tracking for individual <option> elements (currently
unused).
2020-06-04 22:54:28 +02:00
Matthias Schiffer
50adb097fa
build: make GluonSrcDiet simpler and more robust (#2033)
- If luasrcdiet fails for a Lua script, this is a bug that should be
  noticed rather than including the unminified script
- Use .tmp suffix for temporary file rather than .o
- Replace chmod + stat + mv with simpler cp + rm to overwrite file while
  preserving file mode
2020-06-04 22:53:14 +02:00
Matthias Schiffer
3fda210f85
gluon-mesh-{batman-adv,babel}: respondd: use libgluonutil to determine interface type
Also make babel match batman-adv and only emit the wireless/tunnel/other
fields when they are non-empty.

Fixes: #1783
2020-06-01 21:45:33 +02:00
Matthias Schiffer
41b3c91284
libgluonutil: introduce gluonutil_get_interface_lower() and gluonutil_get_interface_type()
gluonutil_get_interface_lower() recursively determines the lower of an
interface until the base interface is found.

gluonutil_get_interface_type() tries do distinguish wired, wireless and
tunnel interfaces. For tunnel interfaces, TUN/TAP, L2TPETH and Wireguard
are supported at the moment.
2020-06-01 21:15:47 +02:00
Matthias Schiffer
72c71d35ac
gluon-mesh-babel: clean up link-local address handling
- Rename obtain_if_addr() to get_linklocal_address()
- Pass buffer of size INET6_ADDRSTRLEN instead of the oversized NI_MAXHOST
- Check if an address is link-local before converting to a string
- Replace an incorrect use of strncmp() with strcmp()
- Return status to caller
- Streamline control flow

While we're at it, the function handle_neighbour(), which is one of the
callers of get_linklocal_address() is slightly cleaned up as well.
2020-06-01 14:50:40 +02:00
David Bauer
6a15c704cd gluon-wireless-encryption-wpa3: switch to hostapd-wolfssl
This switches hostapd variant used for SAE and OWE from hostapd-openssl
to hostapd-wolfssl.

The bug shich one broke the wolfssl implementation was resolved upstream
with commit 631c437a91c2 ("hostapd: backport wolfssl bignum fixes").
This particular commit also got backported to OpenWrt 19.07.
2020-06-01 11:24:24 +02:00
Jan-Jonas Sämann
ed094bc68c
gluon-core: firewall: Allow custom gluon_wired interfaces (#2041)
This allows for multiple mesh legs out of one box. Useful for offloaders
and networks using vlan for separate mesh transport.
Custom mesh interfaces in a VXLAN domain are otherwise firewalled.

This fixes #1479
2020-05-31 10:57:58 +02:00
David Bauer
e951ff6e21 gluon-core: add support for configuring the beacon interval
This adds support for the beacon interval to be set on a per-band base.
This has the potential to reduce the amount of airtime used up for
sending beacon frames.
2020-05-30 00:47:33 +02:00
Jan-Tarek Butt
22847e4986
gluon-reload: add missing service restarts on domain switching
[Matthias Schiffer: fix up start/stop order and file permissions]
2020-05-28 23:30:25 +02:00
Matthias Schiffer
20c7fd9881
Merge pull request #2011 from freifunk-gluon/board-json-addresses
Look up primary MAC address through board.json for LAN/WAN
2020-05-28 22:30:14 +02:00
David Bauer
b1de28bab1 gluon-core: move wireless-related utils to wireless module
Separate wireless-related helper methods from the util module to a
new wireless module. This keeps them separated, as the amount of
wireless helpers increased in the past, justifying a separate module.
2020-05-28 21:46:23 +02:00
Matthias Schiffer
fcc6877c8b gluon-core: build in xt_CT with GLUON_SPECIALIZE_KERNEL
xt_CT was added to kmod-ipt-conntrack a while back. Update our
GLUON_SPECIALIZE_KERNEL rules accordingly.

When building xt_CT into the kernel, one of the symbols IP_NF_RAW and
IP6_NF_RAW must be enabled as well, even though there is no runtime
dependency when building as modules. The kernel grows by less than 1KB
even when both IP_NF_RAW and NETFILTER_XT_TARGET_CT are enabled, making
this change a (very slight) net win in both flash and RAM usage.
2020-05-28 19:40:29 +02:00
Ruben Barkow-Kuder
891bfc77ac
gluon-client-bridge: simplify boolean expressions (#2031) 2020-05-25 01:13:30 +02:00
lemoer
14481851f6
gluon-status-page: show primary_domain 2020-05-21 18:09:08 +02:00
lemoer
b9c1a026b1
gluon-respondd: emit "primary_domain_code" in nodeinfo
Closes #1974

Situation:
==========

$ ls -l /lib/gluon/domains/lindennord.json
lrwxrwxrwx    1 root     root            10 Jan  6 03:42 /lib/gluon/domains/lindennord.json -> dom17.json

Before:
=======

$ gluon-neighbour-info -d ::1 -p 1001 -r nodeinfo -c 1
{
   "node_id": "525400123456",
   "system": {
     "domain_code": "lindennord",
     "site_code": "ffh"
   },
...
}

After:
======

$ gluon-neighbour-info -d ::1 -p 1001 -r nodeinfo -c 1
{
   "node_id": "525400123456",
   "system": {
     "primary_domain_code": "dom17",
     "domain_code": "lindennord",
     "site_code": "ffh"
   },
...
}
2020-05-21 18:09:05 +02:00
lemoer
bcf57467dd libgluonutil: implement gluonutil_get_primary_domain()
Implemented using readlink() and basename() to the selected domain in
/lib/gluon/domains/${DOMAIN}.json.
2020-05-21 18:08:36 +02:00
lemoer
0c2a52c19f
libgluonutil: fix double free of domain_code when domain is not existing 2020-05-21 18:03:58 +02:00
lemoer
57516fe4e7
Add GLUON_MINIFY flag to allow skipping the minification process (#1916) 2020-05-13 00:45:06 +02:00
Matthias Schiffer
3daacfb92e
Merge pull request #2013 from freifunk-gluon/outdoor-setup-ifname
Reuse outdoor device logic for setup mode interface selection, plus some cleanup
2020-05-12 20:39:30 +02:00
Matthias Schiffer
b842ec43ff gluon-mesh-batman-adv: do not override WAN MAC address with VXLAN
As a partial fix to #496, do not touch the MAC address of the WAN
interface when using VXLANs (as only the MAC address of the VXLAN
interface matters to batman-adv).
2020-05-12 17:02:37 +02:00
Matthias Schiffer
8807c76a34
gluon-setup-mode: remove obsolete sysconfig.config_ifname migration
config_ifname was renamed to setup_ifname in Gluon v2015.1.
2020-05-10 16:38:42 +02:00
Matthias Schiffer
e9687d7ef1
gluon-setup-mode: use is_outdoor_device() for setup_ifname selection
On PoE-powered devices, we usually want to use WAN for the setup mode.
As all outdoor devices are PoE-powered, we can reuse this function. This
switches the setup mode interface for new installations / after config
reset on a few devices that were missing in this list before.
2020-05-10 16:38:42 +02:00
Matthias Schiffer
0dd9a3e07c
gluon-core: platform: add 2.4GHz-only outdoor devices 2020-05-10 16:38:41 +02:00
Matthias Schiffer
f4fe58cfd7
gluon-core: ignore is_outdoor_device() value on devices without 5GHz radio 2020-05-10 16:38:41 +02:00
Matthias Schiffer
5ec08d841d
gluon-core: platform: clean up device_supports_mfp()
- Use util.find_phy()
- Stop foreach() as soon as the result is known
2020-05-10 16:38:41 +02:00
Matthias Schiffer
3ccf7fdd96
gluon-mesh-vpn-fastd: clean up peers and groups on update
The 'preserve' flag can be used to mark a peer so it is not removed or
modified on upgrades. In addition, groups containing preserved peers are
not removed.

Fixes: #557
2020-05-10 14:30:25 +02:00
Matthias Schiffer
b019c703c9
gluon-mesh-vpn-fastd: reduce complexity of upgrade script 2020-05-10 13:06:00 +02:00