Commit Graph

2456 Commits

Author SHA1 Message Date
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
Jan-Philipp Litza
8d4a7bdaf9
gluon-radv-filterd: Fix parenthesis in foreach macros 2018-01-03 15:20:21 +01:00
Sven Eckelmann
779f17af89
gluon-radv-filterd: Fix use-after-free in expire_routers
The macro foreach is dereferencing router to get the next node in list.
This even happens when the node was just freed in the last iteration (and
thus could crash the program).

To avoid this crash, the next pointer has to be saved before the node is
freed.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:19:44 +01:00
Sven Eckelmann
c9eccb9c47
gluon-radv-filterd: Use _GNU_SOURCE by default
Both source files require the _GNU_SOURCE preprocessor. But for one file it is
defined in the source and for the other one in the Makefile. It is better
to have it in the Makefile to avoid that different source files in the same
project use different.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-01-03 15:19:26 +01:00
Jan-Philipp Litza
93e2820f61
gluon-radv-filterd: Some minor fixes and cleanup 2018-01-03 14:59:51 +01:00
Jan-Philipp Litza
0aca838f37
gluon-radv-filterd: rename error() -> error_message() 2018-01-03 14:59:51 +01:00
Jan-Philipp Litza
5b34931a97
gluon-radv-filterd: Fix bug in BPF router lifetime filter
The router lifetime field actually is 2 bytes long, but we only checked
the first one, thus falsely discarding RAs with router lifetime < 256
seconds.
2018-01-03 14:59:50 +01:00
Jan-Philipp Litza
31660c7402
gluon-radv-filterd: Seperate macros for printf() and scanf() 2018-01-03 14:59:49 +01:00
Jan-Philipp Litza
ccfd102780
gluon-radv-filterd: Remove all UCI options except threshold 2018-01-03 14:59:48 +01:00
Jan-Philipp Litza
66a26d0d23
gluon-radv-filterd: Various small fixes due to NeoRaider 2018-01-03 14:59:48 +01:00
Jan-Philipp Litza
20d83bca76
gluon-radv-filterd: Refactor packet checking
Move more to BPF code and do not try to parse extension headers in C that
wouldn't have made it through BPF anyway.
2018-01-03 14:59:47 +01:00
Jan-Philipp Litza
5f3f371ee8
gluon-radv-filterd: Fix and simplify originators parsing
Previously, only one nexthop was recognized. The parsing of the whole file
failed immediately when two or more hops were possible for *any* originator (not
only for one with a router behind it).

This makes the parser ignore most of the line in the originators table.
2018-01-03 14:59:46 +01:00
Jan-Philipp Litza
a1fea711da
gluon-radv-filterd: Add respondd module reporting the chosen gateway 2018-01-03 14:59:45 +01:00
Jan-Philipp Litza
3bf4d12911
gluon-radv-filterd: Ship with own implementation of error() 2018-01-03 14:59:45 +01:00
Jan-Philipp Litza
5a4dc1f983
gluon-radv-filterd: Avoid use of GLUONDIR variable 2018-01-03 14:59:44 +01:00
Julian Labus
43664bf383
gluon-radv-filterd: updated socket filter 2018-01-03 14:59:43 +01:00
Jan-Philipp Litza
a313af733d
gluon-radv-filterd: Always output a message when choosing new router 2018-01-03 14:59:42 +01:00
Jan-Philipp Litza
c887960e90
gluon-radv-filterd: Tweak constants
As I have seen instances of ebtables being killed with a timeout of 100ms,
increasing it to 500ms.

Also, to ease the straint on the CPU, increasing minimum time between TQ checks
to 15 seconds.
2018-01-03 14:59:41 +01:00
Jan-Philipp Litza
bd85e99078
gluon-radv-filterd: Use fscanf() instead of getline() & sscanf() for BATMAN data
This reduces the average CPU consumption (on a WDR4300) from 3% to 1%.

Also, this commit adds error messages when the parsing fails and makes matching
more flexible after all relevant fields have been found.
2018-01-03 14:59:41 +01:00
Jan-Philipp Litza
2f8eed6f9a
gluon-radv-filterd: Add more debugging messages and more detailed errors 2018-01-03 14:59:40 +01:00
Jan-Philipp Litza
e4457f2f68
gluon-radv-filterd: Fix use-after-free when best router expires 2018-01-03 14:59:39 +01:00
Jan-Philipp Litza
3667d6061d
gluon-radv-filterd: Add license to source file 2018-01-03 14:59:38 +01:00
Jan-Philipp Litza
615fb91159
gluon-radv-filterd: Fix upgrade script permissions and compilation 2018-01-03 14:59:38 +01:00
Jan-Philipp Litza
7d20a24608
gluon-radv-filterd: Work with newer batman-adv versions 2018-01-03 14:59:37 +01:00
Jan-Philipp Litza
e3b4dc5031
gluon-radv-filterd: Update originators only if one is unknown 2018-01-03 14:59:36 +01:00
Jan-Philipp Litza
f963e054df
Add package gluon-radv-filterd
This package drops all incoming router advertisements except for the
default router with the best metric according to B.A.T.M.A.N. advanced.

Note that advertisements originating from the node itself (for example
via gluon-radvd) are not affected.
2018-01-03 14:59:35 +01:00
Christof Schulze
621eaf3c91 modules: update url to lede-project git repository after upstream move (#1292) 2018-01-03 12:42:18 +01:00
Christof Schulze
bc2fb8cc69 gluon-respondd: firewall should allow access for devices in zone local_client (#1291) 2017-12-31 19:57:57 +01:00
Christof Schulze
910a6c8bb3 gluon-respondd: add current unix time to statistics (#1287) 2017-12-29 23:49:28 +01:00
Matthias Schiffer
d531289dee
Backport patches for rx buffer stalls on QCA953x and QCA956x
Fixes #1101
2017-12-29 16:12:52 +01:00
Matthias Schiffer
21b3dd3259
build: add file size field to manifest lines
We would like to check the file size instead of downloading indefinitely.
The file size is added in another copy of the manifest lines, which is
ignored by older autoupdater implementations.
2017-12-28 22:57:37 +01:00
Matthias Schiffer
245e0f9ecc
Merge pull request #1280 from FreifunkVogtland/libbatadv
libbatadv: Add common batman-adv helper functions library
2017-12-28 14:50:13 +01:00
Christof Schulze
41ab551518
libgluonutil: add function that retrieves the node prefix from site.conf 2017-12-27 23:50:31 +01:00
Ruben Barkow
a92cfa3194 docs: standardize package descriptions and add missing example in site-example (#1179) 2017-12-27 21:48:21 +01:00
Matthias Schiffer
8e6e06c4b8
modules: update Gluon packages
57c6796 tunneldigger: clean up version variables in Makefile
90ecf80 tunneldigger: Update to newest upstream commit: (#178)
8769d07 L3roamd bump (#180) -- use all-nodes mac
79583b3 l3roamd: bump version, fix memleaks, adjust output (#177)
030be55 l3roamd: bump version to 2017-12-11
ffd793a libbabelhelper: update version
e0e4fa2 mmfd: bump version (compile fix) (#176)
25123fe bumping versions of l3roamd, mmfd, libbabelhelper
2017-12-27 17:53:18 +01:00
Sven Eckelmann
6701aa81a5 gluon-status-page-api: Use genl helpers from libbatadv
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2017-12-27 17:40:41 +01:00
Sven Eckelmann
a267cc7ee7 gluon-mesh-batman-adv: Use genl helpers from libbatadv
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2017-12-27 17:40:35 +01:00
Sven Eckelmann
624cffc744 libbatadv: Add library for common batman-adv helpers
Interacting with batman-adv's genl interface requires some code and
definitions which could be shared between different packages. libbatadv is
trying to do this without providing any guarantee for ABI or API stability.
It is only useful in very controlled environments like gluon.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2017-12-27 17:40:30 +01:00
Matthias Schiffer
f799518194
gluon-ebtables-filter-multicast: do not filter out Bridge Loop Avoidance
batman-adv uses gratuitous ARP packets with certain target addresses for
BLA.

Fixes #1198
2017-12-27 17:22:37 +01:00
Karsten
35237c2ca1 gluon-web-network: make 'PoE Power Port[0-9]' translatable (#1173) 2017-12-27 03:11:49 +01:00
Jan-Tarek Butt
f514ec13b5
brcm2708-bcm2709: add manifest_alias for raspberry-pi-2-model-b-rev-1.1 2017-12-27 03:06:19 +01:00
Jan-Tarek Butt
7b61cb16f8
brcm2708-bcm2708: add manifest_alias for raspberry-pi-model-b-rev-2
Signed-off-by: Jan-Tarek Butt <tarek@ring0.de>
2017-12-27 03:05:53 +01:00