Commit graph

100 commits

Author SHA1 Message Date
Florian Eckert
0434407428 mwan3: make mwan3.user executable
This is a fix for the the following change:
3d824ea288

Before the change, it was only possible to execute a shell script. To
remove this restriction, a binary or other script language can now also
be used for 'mwan3.user'. Unfortunately, the old shell script was not
executable for older mwan3 version. During a sysupgrade with config transfer,
this 'mwan3.user' script could not be executed for newer mwan3 versions.
To fix this, the calling script checks whether the 'mwan3.user' is executable,
and if not, this executable bit is now set.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2022-12-19 08:34:54 +01:00
James White
1a703ed6a6 mwan3: Switch default track_ip targets from Google DNS to Cloudflare DNS
Signed-off-by: James White <james@jmwhite.co.uk>
2022-09-25 09:06:05 +01:00
Florian Eckert
0ed8450d2f mwan3: fix balanced default config
The metrics and weight need to be the same. A 50% balanced would be
require member policies of the same metric and weight value.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2022-09-14 15:27:16 +02:00
Florian Eckert
ed2e0b33ed mwan3: add sleep to release ipset reference
It turns out that under high system load, ipsets cannot be deleted. This
is because there is still a reference in iptables. A short sleep should
give the system time to clean this up.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2022-03-14 09:34:49 +01:00
Florian Eckert
13c2604eb1 mwan3: remove not needed ipset del cmd
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2022-03-14 09:34:49 +01:00
Florian Eckert
408458a72f mwan3: Split ipsets into separate ipv4 and ipv6 sets
Nft does not directly support ipsets, nft sets must be used instead.
The mwan3 uses ipsets for certain tasks. They can be combinded. So called
an ipset of ipsets. This list type is not available in nft. So that
mwan3 could be ported to nft in the feature, the ipset handling should be
split. So we have for each ipset an iptables rule.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2022-03-14 09:34:49 +01:00
Florian Eckert
a49d0953dc mwan3: move command definitions to common.sh
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2022-03-14 09:34:49 +01:00
Florian Eckert
e1f321150d mwan3: fix mwan3 flush conntrack table call
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-12-22 09:28:12 +01:00
Brian J. Murrell
3d824ea288 mwan3: Use shebang in /etc/mwan3.user
To allow the script to define what it should be run with.
This let's the user use bash if it's available, or python, or perl, etc.

Signed-off-by: Brian J. Murrell <brian@interlinx.bc.ca>
Update PKG_VERSION to 2.10.11
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-09-03 11:46:28 +02:00
Florian Eckert
58027efed1
Merge pull request #15537 from aaronjg/mwan3/notrack
mwan3: allow interfaces with no tracking IPs
2021-05-06 12:16:09 +02:00
Florian Eckert
cbc5f0916c mwna3: fix whitespace
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-05-03 10:51:44 +02:00
Aaron Goodman
b7ea19bc96 mwan3: allow interfaces with no tracking IPs
In the procd refactor, support for interfaces with no tracking IPs was
inadvertentiy removed. This commit restores the previous behavior

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2021-05-02 19:13:44 -04:00
Aaron Goodman
267b65ad9f mwan3: fix regression in ipv6 routing tables
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2021-01-02 21:37:37 -05:00
Florian Eckert
6133d5a0e9 mwan3: remove unused mwan3_unlock function call
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-12-22 08:38:30 +01:00
Florian Eckert
c085f2648f mwan3: fix MWAN3_STARTUP caller
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-12-22 08:38:30 +01:00
Florian Eckert
8f697b45c8 mwan3: fix whitspace
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-12-22 08:38:30 +01:00
Florian Eckert
8d41e5477f mwan3: fix logger tag in mwan3 init
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-12-22 08:38:25 +01:00
Aaron Goodman
24e1504b0b mwan3: improve route flushing on mwan3 stop
only attempt to flush routes for the relevant family

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-12-16 09:32:33 +01:00
James White
8608afa75f
mwan3: Update documentation information for mwan3.user file
Signed-off-by: James White <james@jmwhite.co.uk>
2020-11-16 10:42:45 +00:00
Aaron Goodman
b849fc73fb mwan3: add IPKG_INSTROOT to scripts
IPKG_INSTROOT needed for including mwan3 when building images

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-11-10 08:46:55 -05:00
Aaron Goodman
a870bd70a9 mwan3: restore +x flag to mwan3 executables
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-11-10 08:45:46 -05:00
Aaron Goodman
9df64276e1 mwan3: remove unneeded ipset setup in hotplug
connected ipset handled on mwan3rtmon, so not needed in hotplug

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-11-10 08:43:32 -05:00
Aaron Goodman
eb3acf926f mwan3: fix hotplug issues from 1f1d21
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-11-10 08:42:02 -05:00
Florian Eckert
1f1d21ed28 mwan3: make it clearer who initiated the start
It was somewhat opaque how the variable a is questioned. To show this
better the variable is now a string and not a boolean. So you can see
directly what should happen. With a boolean you always have to think
about what it means when 0 or 1 is used.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-11-06 10:41:28 +01:00
Aaron Goodman
59d12598b5 mwan3: use procd for locking everywhere
Replace locks on /var/run/mwan3.lock with locks via procd.

This fixes a deadlock issue where mwan3 stop would have a procd
lock, but a hotplug script would have the /var/run/mwan3.lock

Locking can be removed from mwan3rtmon since:
1) procd will have sent the KILL signal to the process during
shutdown, so it will not add routes to already removed interfaces on
mwan3 shutdown and
2) mwan3rtmon checks if an interface is active based on the
mwan3_iface_in_<IFACE> entry in iptables, and the hotplug script
always adds this before creating the route table and removes it
before deleting the route table

Fixes github issue #13704
(https://github.com/openwrt/packages/issues/13704)
2020-11-06 10:40:57 +01:00
Aaron Goodman
bec7a1086f mwan3: reload unreachable/blackhole rules on hotplug
when the network procd service restarts, it flushes the ip rules. We
need to add these rules back. Since hotplug events are triggered when
the networks come back online, adding this call to the hotplug script
is the most convenient place to refresh the rules.

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-11-06 10:40:54 +01:00
Florian Eckert
6834f8e3a6 mwan3: use common makefile install wrappers
With this change you can see at a glance which files will be installed on
the system.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-11-06 10:35:55 +01:00
Florian Eckert
ca7625ef11 mwan3: remove not needes jshn.sh include
Remove not needed jshn.sh include.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-11-06 10:34:53 +01:00
Florian Eckert
c374711e60 mwan3: fix reload handling
When the interface section was changed, the changed configuration
options were not applied.
This commit adds the service reload handling again.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-10-23 08:15:57 +02:00
James White
14d62d6599 mwan3: Simplify default configuration, mostly use defaults
Signed-off-by: James White <james@jmwhite.co.uk>
2020-10-16 09:55:40 -04:00
Aaron Goodman
566293d228 mwan3: use procd for mwan3rtmon and mwan3track
start all mwan3mon and mwan3track instances on mwan3 start
if an interface is down when mwan3track starts, it waits
for a signal from the hotplug script to start

procd can then handle stopping all of the scripts when mwan3
is halted

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-10-16 09:54:48 -04:00
Aaron Goodman
189f92da4a mwan3: only update src_iface rules on ifup
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-10-16 09:54:48 -04:00
Aaron Goodman
c8deccc0e7 mwan3: improvements to route creation
handle creation of routing tables in mwan3rtmon to avoid race
conditions and potentially missing routes

handle ipv6 routes that have expiry

update directly connected ipset when routes are added or deleted

add fall through rules so that the default routing table is not
used if no rule in the interface-specific routing table matches

add option to comply with mwan3 source based routing

get default route parameters from main routing table

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-10-16 09:54:48 -04:00
Aaron Goodman
b7e26dd431 mwan3: fixup some extra spaces and shellcheck warnings
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-10-16 09:54:48 -04:00
Aaron Goodman
c07f5230be mwan3: improve startup performance; version 2.9.0
improve startup and runtime performance by

1) moving common startup procedures out of hotplug script when called
from mwan3 start
2) reducing calls to iptables to check status of rules
3) consolidating iptables updates and updating with iptables-restore
4) do not wait for kill if nothing was killed
5) running interface hotplug scripts in parallel
6) eliminate operations in hotplug script that check status on every
single interface unnecessarily
7) consolidate how mwan3track makes hotplug calls
8) do not restart mwan3track on connected events

This is a significant refactor, but should not result in any breaking
changes or require users to update their configurations.

version bump to 2.9.0

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-08-17 22:02:36 -04:00
Aaron Goodman
39f58789e6 mwan3: use ip monitor route to detect routing changes
use only committed uci changes for updating routing table

use functions.sh functions rather than uci command line tool
to find interfaces for routing table.

consolidate rtmon_ipv4 and rtmon_ipv6 functions into a single function

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-08-15 20:19:56 -04:00
Florian Eckert
981d1eb83a mwan3: unify variable check
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-28 06:53:24 +02:00
Florian Eckert
2dac1bcdc9 mwan3: fix race condition on mwan3 restart
This adjustment of the locks fixes the race condition when a mwan3
hotplug script and a mwan3 command are running at the same time.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-28 06:53:24 +02:00
Florian Eckert
058a2b6f30 mwan3: add workaround for procd change
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-20 08:12:48 +02:00
Aaron Goodman
2a5e9be83e mwan3: add default rule for ipv6 in example config
default rule only applied to ipv4 with dest_ip 0.0.0.0/0
and error was hidden when trying to apply it in ip6table

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-07-19 23:18:21 -04:00
Florian Eckert
a6dc75428c mwan3: switch to procd init script
This enables the procd handling for mwan3 on config change.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-06-17 13:00:48 +02:00
Daniel A. Maierhofer
1e97156adc mwan3: Add missing IPs to wanb
Maintainer: Florian Eckert @feckert
Compile tested: not needed
Run tested: x86_64

Description:
Only two of the four IPs defined for wan are found in wanb, adding it so it is the same.

Signed-off-by: Daniel A. Maierhofer <git@damadmai.at>
2019-08-04 18:47:25 +02:00
Florian Eckert
8d3c8dadcf mwan3: add migration script for flush_conntrack config
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-07-04 12:03:23 +02:00
Florian Eckert
171cb17694 mwan3: change flush_conntrack handling to use uci list element
With this change it is now possible to combine interface action events.
If an interface action is generated by netifd or mwan3 for example ifup,
ifdown, connectd or disconnected and this action is configured in the inteface
uci section, then the conntrack table is flushed by mwan3.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-06-03 14:16:05 +02:00
Florian Eckert
2ff9c8ecb7 mwan3: add locking debug possibility
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-01-22 14:29:04 +01:00
Florian Eckert
10cadcb2af mwan3: set interface unknown to offline
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-01-14 08:28:53 +01:00
Florian Eckert
9362ef30ff mwan3: fix initial_state offline issue
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-01-14 08:28:52 +01:00
Florian Eckert
ac5895cd7f mwan3: remove deprecated local_source config option
This feature is not needed anymore. This feature is replaced by the
change 46ed09408e

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-11-08 12:29:15 +01:00
Florian Eckert
85a6d89b8e mwan3: revert add online_metric for local_source none
This is not necessary.

This reverts commit be91e71805.
2018-11-08 12:29:12 +01:00
Florian Eckert
be91e71805 net/mwan3: add online_metric for local_source none
If we set the option "local_source" in the globals mwan3 section to "none",
traffic generated by the router it self will always use the default route from
the wan interface with the lowest metric. If this interface is down
the router traffic still uses the connection with the lowest metric but
this is disconnected. Load balancing and failover from the lan site is
still possible. Only router generated traffic is not load balanced and
could not use failover.

To solve this issue with router initiated traffic add the additional
option "online_metric" to the mwan3 interface section.

If the interface is connected then this lower "online metric" is set in the
default routing table.

With this change we have at least a failover with router initiated
traffic.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-10-23 15:00:11 +02:00