Commit Graph

30 Commits

Author SHA1 Message Date
Adrian Schmutzler 858930547b treewide: use SPDX license identifiers
The SPDX license identifier provides a standardized way for specifying
licenses that is both human- and machine-readable. It is used upstream
both in OpenWrt and the Linux kernel.

Replace licenses in our repository by those identifiers.

The full-text licenses corresponding to these identifiers are
provided in the LICENSES folder.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Fabian Bläse <fabian@blaese.de>
2021-03-06 18:53:26 +01:00
Adrian Schmutzler bd15c7e178 fff-network: don't hardcode eth0 for one-ports in configurenetwork
We use the one-port implementation also on two-ports like the
Nanostation M. Therefore, hard-coding eth0 in configurenetwork
will break if the port implemented for the one-port setup
(SWITCHDEV/WANDEV) is not eth0.

Just use SWITCHDEV instead, like done for the rest of the one-port
setup.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
Tested-by: Fabian Bläse <fabian@blaese.de>
2021-02-18 01:19:06 +01:00
Adrian Schmutzler 0092713196 treewide: replace IP string manipulation by owipcalc tool
The owipcalc tool provides an "add" algorithm which can be used
to concateneted IPv6 addresses from prefix and suffix.

Since it's available upstream and our string manipulation is ugly,
let's replace our IP concatenation with that tool. The package
consists of a single .c file with about 1000 lines resulting in
about 4 kB for the ipk package.

This patch does _not_ introduce any conceptual changes yet. Thus,
the "wrong" IPv6 prefix from KeyXchange will be expected in the
same format, it is just healed for the new code for now.

The change allows to get rid of some bloat, i.e. some quite trivial
custom functions on the way. This also drops the ipTidyColon()
function, as owipcalc seems to return the collapsed version by default.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
2021-01-27 19:44:07 +01:00
Adrian Schmutzler 3214388680 treewide: rename br-mesh to br-client
The name br-mesh is actually quite misleading, since the bridge
actually includes the "client" interfaces. In order to make this
obvious, and to prevent confusion with the properly named wXmesh
interfaces, rename them to br-client.

Note that br-mesh is also particularly disturbing for the layer 3
firmware without batman-adv.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Fabian Bläse <fabian@blaese.de>
Acked-by: Christian Dresel <freifunk@dresel.systems>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
2020-12-22 13:41:44 +01:00
Adrian Schmutzler 24be8ecdda fff-network: fix unintended wan=eth1 for two-port devices
For historic reasons, the wan interface is set to eth1 as default
value. When updating the config for one-port devices in
configurenetwork, the same value is put there again if the mode
is switched to something != WAN, instead of just removing the
value.

While ifname actually is a mandatory value, this has been handled
inconsistently in the past, where ethmesh ifname was deleted, and
wan ifname was just changed back to eth1, when assigning the
actually relevant eth0 to a different task.

This concept was set up with a one-port device in mind, i.e. a
device where there is no eth1. However, this very setup routine
got applied to the Nanostation M as well (which is treated as
as one-port), where we suddenly have two interfaces and the eth1
exists.
So, while the user assumes it's unconfigured, the second port
actually becomes set up as WAN if the first one is != WAN.
If connected to a second device with CLIENT (=default) to provide
PoE there, this will create a loop.

So, finally, in order to somehow fix this mess, this patch just
changes the hardcoded "eth1" to "eth2". While this is no proper
fix, it perpetuates the original idea of keeping wan set to
something, but nothing which actually exists. However, there are
no sideeffects and we keep this minimal-invasive.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
2020-09-15 13:05:49 +02:00
Adrian Schmutzler 30c3b46127 fff-network: fix broken statement in configurenetwork
This seems to be a copy/paste error, what we want here is to
delete the entry from ethmesh, as we use WAN.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
2020-09-15 13:05:49 +02:00
Fabian Bläse b5563caa23 fff-network: Improve IPv6 WAN connectivity
Until now, IPv6 connectivity was only ensured by some custom sysctls.
OpenWrt has a proper way of enabling IPv6 client (SLAAC, as well as DHCPv6)
for an interface. Switching to OpenWrt's way of configuring client addresses
for an interface might also make configuration more reliable, as the appropriate
sysctls are now set by netifd. Especially OnePort and TwoPort devices will
benefit from this change, as IPv6 auto configuration does not have to be manually
enabled and disabled for a physical interface, but rather is set as an option for
our logical wan interface.

At the same time this change enables DHCPv6 client support for WAN.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
[bump PKG_RELEASE]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-01 01:09:10 +02:00
Fabian Bläse ccfde6c655 fff-network: Remove dependency to uradvd
As odhcpd is used as router advertisement server in layer3 variant,
but configurenetwork is still necessary, the dependency to fff-uradvd has
to be removed.

This is done by first checking, if the fff-uradvd service exists, before it
is restarted.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
2019-11-10 14:22:56 +01:00
Robert Langhammer d989f435e6 fff-network: Have WAN sysctl commands executing after global ones
On layer3 variant ("gateway firmware"), 60-fff-gateway.conf
changes "forwarding" for all interfaces, overwriting the
changes from 51-fff-network-$iface.conf.

By putting the WAN-specific commands after 60-fff-gateway.conf
this patch should provide the correct device-specific value
for WAN interface now.

Signed-off-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
[Rephrased commit title and added message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-10-07 16:20:35 +02:00
Adrian Schmutzler d0d8fc57af configurenetwork: Tidy-up auto configuration functions
This fixes a typo in description and introduces a single variable
for the sysctlfile.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
2019-02-10 22:44:26 +01:00
Robert Langhammer 62fd2b71e0 Remove double square bracket. [[ is a bash or ksh built-in, and cannot be used in a #!/bin/sh script.
Signed-off-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2018-07-26 21:57:57 +02:00
Adrian Schmutzler b4ab6ed3e9 configurenetwork: Improve output when setting IPv6 addresses
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2018-06-17 17:55:38 +02:00
Tim Niemeyer bd5985e99e fff-network: enable forwarding; filter forwarding
Fixes #83
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
Tested-by: Christian Dresel <fff@chrisi01.de>
2018-03-03 21:34:36 +01:00
Tim Niemeyer 6863c6235d fff-network: rework sysctl's
Just disable autoconf.

Some sysctl's are currently not available due some missing kernel
features. Maybe some day they reappear.

Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
Tested-by: Christian Dresel <fff@chrisi01.de>
2018-03-03 21:34:36 +01:00
Tim Niemeyer 7cb79452fd fff-network: move sysctl settings to a function
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
Tested-by: Christian Dresel <fff@chrisi01.de>
2018-03-03 21:34:36 +01:00
Adrian Schmutzler 90c8526873 fff-network: Calculate IPv6 using ROUTERMAC variable
If the mac is read from /sys/class/net/${iface}/address, some
devices (WA860RE, Picostation) will not set the fdff addresses.

This can be fixed by using the $ROUTERMAC in configurenetwork.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2018-01-20 14:48:19 +01:00
Adrian Schmutzler 6ad42be496 fff-network/fff-hoods: Only use MAC address in network lib
Previously, IPv6 addresses were constructed by reading from
the device config file in the function. To have more options,
it is better to use the address itself as parameter.

By this way we can decide what we use for getting the MAC when
calling.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2018-01-20 14:47:58 +01:00
Adrian Schmutzler de36cb4c17 configurenetwork: Put One- and Two-Port pre-setup into function
This is a cosmetical patch, however it does increase the overview
a lot in my opinion.

We cannot drop the special case of the two-port devices, because
we need the current setup to enable setting port mode in the Web
UI.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2018-01-20 13:35:21 +01:00
Adrian Schmutzler f9e98f3ebf fff-network: Commit only network
Since we change only the network part of uci, we only need to
commit this part and not the whole config five times.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
- Rebased
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
2017-12-23 12:59:07 +01:00
Adrian Schmutzler eff6b0a305 fff-network: Fix second occurrence of ROUTERMAC and ETHMESHMAC
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
2017-12-22 14:26:10 +01:00
Fabian Bläse 1eaa0075fd Use SWITCHDEV variable for mac address fixing
This makes use of the SWITCHDEV variable to ensure that the
correct interface is used for mac address fixing on devices,
that do not use eth0 for the switch.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
2017-11-12 17:28:42 +01:00
Fabian Bläse 5120b9a59d fff-network: evaluate macaddress in device config
This allows for more latitude when evaluating the addresses needed for br-mesh and ethmesh.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
Tested-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2017-11-03 22:28:46 +01:00
Adrian Schmutzler 566d762148 fff-network/fff-hoods: Create functions for IPv6 rewriting
This puts the code for creating IPv6 addresses from MAC
address and EUI into functions, so it can be reused.

This should be particularly helpful if code is rewritten later.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2017-11-03 09:30:14 +01:00
Adrian Schmutzler 4dbf136a31 fff-network: Make custom port configuration update-safe
This writes CLIENT/BATMAN/WAN port configurations for devices
with switches to a separate file. This file can be changed
based on the desired setup and is then preserved during
firmware upgrade. In case of a future bugfix concerning the
entries of a specific network.* file, this will still be
effective as only the port configurations reside in the
new file, while the other settings could be overwritten by
the upgrade.

For one- and two-port devices, adjustments have been made so
that their relevant settings also reside in the new file now.

This also adds a WebUI interface for setting the two-port
devices (CPE210 and CPE510).

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
 - Changed doc in network.mode
2017-09-17 16:09:28 +02:00
Adrian Schmutzler b0974e0afc fff-network: Prevent resetting network config on each reboot
This only sets the switch configs if they are not set yet.
If the network.* file is edited, add FORCEPARSE=1 to apply
the changes.

Fixes #56

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tobias Klaus <tk+ff@meskal.net>
2017-09-17 15:37:45 +02:00
Christian Dresel 9cd2738b36 Add support for wr1043 v4
Dieses Patch fügt den Support für den WR1043 v4 hinzu. Dieses Patch
baut auf den LEDE Patch auf und darf erst nach dem LEDE Patch
applied werden.

Signed-off-by: Christian Dresel <fff@chrisi01.de>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2017-02-18 13:55:42 +01:00
Jan Kraus c739a6c0c3 Added support for Archer C7 v2
5Ghz AdHoc is not working with current ath10k driver.

Signed-off-by: Jan Kraus <mayosemmel@gmail.com>
Reviewed-by: Michael Fritscher <michael@fritscher.net>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2016-10-30 13:25:56 +01:00
Jan Kraus b78e5b4ac0 Fixed Problems with Port mode changing
cleaned up config files (moved commands to script)

Signed-off-by: Jan Kraus <mayosemmel@gmail.com>
Tested-by: Christian Dresel <fff@chrisi01.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
Tested-by: Jan Kraus <mayosemmel@gmail.com>
2016-10-08 23:19:06 +02:00
Tim Niemeyer 92dc0c647d fff-nodewatcher: self-detect client interfaces
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
2016-06-11 14:13:13 +02:00
Jan Kraus 4e145b83b9 Moved network configuration script to own package
Signed-off-by: Jan Kraus <mayosemmel@gmail.com>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
Changed mode of configurenetwork to 755
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
2016-05-16 14:33:22 +02:00