Commit Graph

994 Commits

Author SHA1 Message Date
Jan-Philipp Litza
dd0ff02344 Merge 1c7ce32e6f into 7ae8a51126 2018-01-25 01:46:28 +00:00
Matthias Schiffer
7ae8a51126
gluon-core: allow zero VXLAN UDP checksum on RX
Also disabling TX checksums and not only allowing incoming packets without
checksum will provide another small speedup. As doing so would break wired
meshing with VXLAN-enabled nodes that require non-zero checksums, we will
wait a few days before this step.
2018-01-24 22:41:29 +01:00
Matthias Schiffer
e54b37d835
gluon-core: firewall: move VXLAN rules to the top
Evaluating these rules before all the ICMPv6 rules improves wired mesh
throughput measurably.
2018-01-24 22:41:29 +01:00
Matthias Schiffer
2950cc3f59
gluon-core: only use a bridge for wired meshing when necessary
On most devices, there is only a single LAN interface connected to all LAN
ports, so no bridge is necessary.
2018-01-24 22:16:09 +01:00
Matthias Schiffer
c84820cb08
package/gluon.mk: add to PKG_FILE_DEPENDS
Ensure packages get rebuilt when gluon.mk changes.
2018-01-19 13:22:26 +01:00
Matthias Schiffer
775028475b
check_site: move site loading logic to check_site_lib (which is renamed to check_site.lua) 2018-01-19 12:33:52 +01:00
Matthias Schiffer
7ccdacd294
treewide: rework check_site_lib.lua
In addition to significant internal differences in check_site_lib.lua (in
particular unifying error handling to a single place for the upcoming
multi-domain support), this changes the way fields are addressed in site
check scripts: rather than providing a string like 'next_node.ip6', the
path is passed as an array {'next_node', 'ip6'}.

Other changes in site check scripts:
* need_array and need_table now pass the full path to the sub fields to the
subcheck instead of the key and value
* Any check referring to a field inside a table implies that all higher
levels must be tables if they exist: a check for {'next_node', 'ip6'} adds
an implicit (optional) check for {'next_node'}, which allows to remove many
explicit checks for such tables
2018-01-19 10:12:43 +01:00
Matthias Schiffer
414dfa8155
libgluonutil: simplify CMakeLists.txt
libgluonutil is not usable outside the OpenWrt/LEDE environment anyways, so
it doesn't make much sense to make the CMakeLists.txt overly generic.
2018-01-19 06:23:29 +01:00
Matthias Schiffer
020afc856f
gluon-site: install domain configs
The domain configs are not checked yet, and not used for anything.

Based-on-patch-by: lemoer <git@irrelefant.net>
2018-01-19 05:44:25 +01:00
lemoer
50812b162c
treewide: forbid use of selected site variables in domain specific or site configs
[Matthias schiffer: rebase, add a few more restrictions]
2018-01-19 04:05:27 +01:00
lemoer
b520bf5c50
gluon-core: rename site_seed to domain_seed
[Matthias Schiffer: rebase]
2018-01-19 03:30:06 +01:00
Matthias Schiffer
1dd9845db1
package/gluon.mk: use nicer escaping in GluonCheckSite 2018-01-19 01:38:56 +01:00
lemoer
adcd5b7311
gluon-core: add gluon-reconfigure script
Not useful by itself except for testing; will be used for multi-domain
support.

[Matthias Schiffer: rename script, use for initial configuration]
2018-01-19 01:10:39 +01:00
lemoer
0f5d932c4f
gluon-core: add util gluon-show-site to print merged site config
This should not convert JSON to a Lua table and back, as this loses the
distinction between arrays and objects, but as our site.conf is defined in
Lua anyways (for now), this can be fixed in a later revision.

[Matthias Schiffer: rename to gluon-show-site, rebase]
2018-01-19 01:07:44 +01:00
lemoer
5817170821
gluon-core: introduce "gluon" uci package
[Matthias Schiffer: change section name and commit message]
2018-01-19 00:41:25 +01:00
Matthias Schiffer
0b80f1b5ce
gluon-core: reimplement gluon.site module in C
By basing the Lua gluon.site module on gluonutil_load_site_config(), the
config load implementation needs to changed only in a single place for
multi-domain support.
2018-01-18 16:29:00 +01:00
Matthias Schiffer
6cf88c3b03
Replace luci-lib-jsonc with our own lua-jsonc 2018-01-18 16:28:59 +01:00
Matthias Schiffer
12103d9638
gluon-web: remove useless serialize_json alias 2018-01-18 07:49:00 +01:00
Matthias Schiffer
01336f70ec
gluon-core: firewall: make the default input policy REJECT
Fixes #1311
2018-01-17 09:51:10 +01:00
Matthias Schiffer
a32fddf38c
gluon-core: firewall: accept inbound VXLAN traffic on wired mesh interfaces
Fixes #1308
2018-01-17 09:51:10 +01:00
Matthias Schiffer
454555a030
gluon-alfred: firewall: allow alfred server announces from mesh 2018-01-17 08:06:42 +01:00
Matthias Schiffer
18feb29b29
gluon-autoupdater: don't reference old autoupdater util library
Fixes #1310
2018-01-17 01:06:15 +01:00
David Bauer
99b02701cc ar71xx: add support for TP-Link Archer C58/C59/C60 (#1281) 2018-01-16 18:51:12 +01:00
Matthias Schiffer
18b9174d03
Use 'disabled' attribute instead of 'auto' to disable wired mesh interfaces
The 'auto' attribute still allows enabling the interface using ifup, which
is not intended when wired mesh is disabled.
2018-01-11 23:06:36 +01:00
Jan-Philipp Litza
f1a9196deb
gluon-radv-filterd: Move readme to docs/package/ 2018-01-03 23:16:57 +01:00
Jan-Philipp Litza
f6f1ae9c4f
gluon-radv-filterd: Return null via respondd without chosen gateway 2018-01-03 22:44:04 +01:00
Sven Eckelmann
9b3a2f2be2
gluon-radv-filterd: Use ebtables locking
This enables the ebtables internal locking mechanism which will avoid race
conditions between multiple, concurrent ebtables calls.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 22:12:08 +01:00
Linus Lüssing
4911da56e1
gluon-ebtables: Enable concurrent ebtables updates
This enables the ebtables internal locking mechanism which
will avoid race conditions between multiple, concurrent
ebtables calls.

This is a preparation for the upcoming gluon-arp-limiter
daemon, to avoid issues if upon restarting gluon-ebtables
the gluon-arp-limiter daemon tries to modify the tables.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
2018-01-03 19:58:53 +01:00
Jan-Philipp Litza
4cc2ba26a6
gluon-radv-filterd: Mention respondd module in readme 2018-01-03 19:23:21 +01:00
David Bauer
9273e56c63 ar71xx: add support for TP-Link Archer C7 v4 (#1289) 2018-01-03 16:50:23 +01:00
Sven Eckelmann
2394ad0c07
gluon-radv-filterd: Call cleanup when stopping daemon
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 16:31:21 +01:00
Sven Eckelmann
2d3614c1a9
gluon-radv-filterd: Trigger config reload checks on interface.* events
The init scripts adds the br-client as netdev for the daemon. The daemon
will automatically be restarted when the netdev's ifindex is changed and
the reload target of the init script is called. But something has to call
this script first.

This can be done the procd triggers interface which can simply wait for all
events from type "interface.*". The reload target will always be called but
the daemon will only be restarted when the br-client ifindex actually
changed.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:45:22 +01:00
Sven Eckelmann
e3cb03010d
gluon-radv-filterd: Fix sock initialization check
A socket with the value 0 is valid (and it the first opened socket). It is
therefore a bad idea to check for 0 when wanting to find out whether a
socket was initialized.

Instead initialize it with -1 and check for < 0 to find out whether the
socket was initialized or not.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:45:21 +01:00
Sven Eckelmann
b06f12669a
gluon-radv-filterd: Use generic netlink to request batman-adv data
The correct way to get the data from batman-adv is not to try to parse the
freeform debugfs files. Instead, the generic netlink family "batadv" should
be used to request the tables in binary form.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:45:21 +01:00
Sven Eckelmann
34daf35529
gluon-radv-filterd: Initialize router->originator after alloc
The memory returned after malloc is not initialized. It must be initialized
before it is accessed in update_tqs and compared against 00:00:00:00:00:00.
Otherwise the TQ retrievel could fail because the originator address is
never updated.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:45:20 +01:00
Sven Eckelmann
c39a62a63a
gluon-radv-filterd: Reset chain when daemon shuts down
The daemon must make sure that it doesn't filter any incoming router
advertisement when it was shut down. This can be achieved by flushing all
current rules and/or adding an ACCEPT all rule at the end. When both
commands work, the state of the chain will be the same as
/lib/gluon/ebtables/400-radv-filter created it.

This doesn't handle the problem that the daemon may have been crashed and
thus the chain is in an undefined state.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:45:19 +01:00
Sven Eckelmann
bc3b3e300f
gluon-radv-filterd: Don't kill daemon when select is interrupted
The select can be interrupted when it receives a signal. But the signal
might be handled and thus it should not result in an kill.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:34:32 +01:00
Sven Eckelmann
dc70f244c8
gluon-radv-filterd: Use monotonic time source
The value returned by time is not monotonic. It can jump around because it
depends on a user configurable clock. This can lead to hangs in the
processing of routers.

A monotonic clock must be used instead to avoid this problem.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:34:32 +01:00
Sven Eckelmann
8251de682a
gluon-radv-filterd: Fix integer underflow with low TQs
The TQ of the best router can be lower than the hysteresis_thresh. The
check could cause an integer underflow which then causes an election which
is not necessary.

This can be avoided by reordering the check slightly and only substracting
values which will not cause underflows.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:34:31 +01:00
Sven Eckelmann
c9f661740c
gluon-radv-filterd: Move election prereq checks into function
The check of prerequisitions is rather long and becomes unreadable. Having
it in an extra function makes the code slightly more structured and better
readable.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:34:30 +01:00
Sven Eckelmann
a6298493f7
gluon-radv-filterd: Fix size argument of recvfrom
The 6th argument to recvfrom is not an unsigned int pointer. This may work
on systems where socklen_t and unsigned int are both 4 byte but other
systems may use 8 byte for that (glibc uses size_t as type for socklen_t
and size_t is 8 byte on amd64 and similar architectures).

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:34:29 +01:00
Sven Eckelmann
1633c7c005
gluon-radv-filterd: Check for recvfrom errors
The recvfrom can fail and return -1. The caller must check for this error
to avoid that it reads uninitialized data from pkt.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:34:28 +01:00
Sven Eckelmann
3c8b9fd281
gluon-radv-filterd: Finish va_start with va_end
All invocations of va_start must have a corresponding va_end.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:34:28 +01:00
Sven Eckelmann
07a760494b
gluon-radv-filterd: Fix byte order of nd_ra_router_lifetime
The ICMPv6 packet is stored in network byte order. It must therefore always
be converted to host byteorder before it can be used in calculations.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:34:27 +01:00
Sven Eckelmann
2d6cd71f82
gluon-radv-filterd: Handle malloc errors
The allocation of a new router object can fail. It must therefore be
handled to avoid segfaults.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:34:26 +01:00
Sven Eckelmann
7014d9eb14
gluon-radv-filterd: Move router code to extra functions
The router access code is spread throughout the program. It is easier to
modify it when the common functionality is encapsulated in some helper
functions.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:34:25 +01:00
Sven Eckelmann
86c3fa879a
gluon-radv-filterd: Use existing type ether_addr for mac addresses
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:34:16 +01:00
Sven Eckelmann
9d194c3f7f
gluon-radv-filterd: Handle bind errors
The bind to an interface can fail and the socket then isn't working as
expected. The daemon must therefore handle this problem.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:25:43 +01:00
Sven Eckelmann
f9b3b2438c
gluon-radv-filterd: Keep global variables static
These variables are only used in the the same file. They can therefore be
static and don't have to be exported by the executable.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:20:59 +01:00
Sven Eckelmann
87bf15ec09
gluon-radv-filterd: Remove unused variable
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:20:47 +01:00