Commit graph

325 commits

Author SHA1 Message Date
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
27492f64f8 mwan3: use MWAN3TRACK_STATUS_DIR variable throughout
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
Paul Spooren
30ea917518 treewide: replace which with command -v
Fix shellcheck SC2230
> which is non-standard. Use builtin 'command -v' instead.

Once applied to everything concerning OpenWrt we can disable the busybox
feature `which` and save 3.8kB.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2020-08-09 13:58:14 -10:00
Florian Eckert
85e91377cf mwan3: update version to 2.8.12
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-28 06:53:24 +02: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
ab747fe0fb mwan3: remove lock file entirely
Removing the lock file ist not necessary

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-28 06:53:24 +02:00
Florian Eckert
b5bd6d757b mwan3: revert: also cleanup lock on mwan3 stop
This reverts commit cde2a77ed3.

Applying this change has shown that it is even quicker to provoke the
race condtition on simultan mwan3 commands execution.
By reversing the change we have the same behaviour as before.

But the race condition on mwan3 execute at the same time still exists.

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
f601e6cfa4 mwan3: update version to 2.8.11
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-20 08:15:50 +02:00
Florian Eckert
b0acbf057e mwan3: add online and uptime to detail output
Add also online time value and uptime time value from netifd to the
detail output view.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-20 08:13:34 +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
Florian Eckert
cde2a77ed3 mwan3: also cleanup lock on mwan3 stop
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-20 08:12:31 +02:00
Florian Eckert
bcd13ba95c mwan3: fix rtmon routing table function generation
If the uci option family is not set in the interface section, then there
is no default value set as in the `config_load / config_get` API.
The problem here is that if the family is not set, the default value ipv4
is normaly assumed. But the comparison fails here because the value is empty
and therefore the dedicated routing table for this interface is not compared
with the other routes from the main table and so not updated.

To fix this set the default value for this config option which is`false`
for enabled and `ipv4` for family.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-20 08:11:20 +02:00
Florian Eckert
8e3e6f8dde mwan3: fix IPv6 routing add handling
This fixes routing handling. Introduced with the last version update.
The following message disappears on the shell
when mwan3 is called with 'mwna3 restart`.

`Error: Invalid gateway address.`

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
[aaronjg@stanford.edu: fully unset variable and handle ipv4 as well]
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-07-19 23:24:13 -04:00
Florian Eckert
a796b7a84e mwan3: fix idx calculation
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
[aaronjg@stanford.edu: fix syntax error]
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-07-19 23:24:13 -04:00
Aaron Goodman
ca8bc3d115 mwan3: version bump
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-07-19 23:24:13 -04:00
Aaron Goodman
30a46bdc9e mwan3: cleanup duplicate ipv4 and ipv6 logic
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-07-19 23:24:13 -04:00
Aaron Goodman
702a104f9c mwan3: don't send iptable setup failures to /dev/null
silencing failing rules makes debugging more difficult

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-07-19 23:18:22 -04: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
Aaron Goodman
a0d66d4eeb mwan3: don't try to use ipv6 if not installed
fix issue  #11826

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-07-19 23:18:18 -04:00
Aaron Goodman
84a53b7c79 mwan3: be more efficient with sleep after killing trackers
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-07-16 02:03:21 -04:00
Aaron Goodman
da9a626f78 mwan3: don't add single ipv4 to connected list if already covered by a cidr
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-07-16 02:03:21 -04:00
Florian Eckert
2594258c4b mwan3: update version to 2.8.9
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-15 10:23:47 +02:00
Florian Eckert
d0c248a7da mwan3: cleanup function mwan3_create_iface_route
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-15 10:23:47 +02:00
Florian Eckert
feae9e5742 mwan3: fix shellcheck warning SC2086
Add double quote to prevent globbing and word splitting where there is
no regression.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-15 10:22:26 +02:00
Florian Eckert
c0fdfaa174 mwan3: fix shellcheck warning SC2166
Replace -o boolean check with ||.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-15 10:21:54 +02:00
Florian Eckert
644d9a25df mwan3: remove unused variable complained by shellcheck
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-15 10:21:54 +02:00
Florian Eckert
0ed7524f81 mwan3: fix shellcheck warning SC2039
Replace all `==` with `=`.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-15 10:21:54 +02:00
Florian Eckert
facf8ea299 mwan3: move redirect error output to trash
This suppress the following output on `mwan3 restart`:
> Dump terminated

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-07-15 10:21:54 +02:00
Michiel Blokzijl
acfbd98ce0 mwan3: Fix mwan3 start not doing anything
Due to a missing config load function call, mwan3 start runs ifup for an empty
list of interfaces, thus not calling ifup at all.

This commit introduces the missing config_load call.

Signed-off-by: Michiel Blokzijl <code@m01.eu>
2020-07-03 20:03:42 +01:00
Florian Eckert
8030814267 mwan3: update version to 2.8.7
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-06-17 13:04:38 +02:00
Florian Eckert
e30f16beef mwan3: set status to unknown in rpcd if status file not found
If the status file is not found then set then return the value unknown.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-06-17 13:01:49 +02: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
Aaron Goodman
38be40843b mwan3: address reviewer comments on 5147dfc7
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-06-13 15:29:32 -04:00
Aaron Goodman
4efaa44b21 mwan3: Use /128 for ipv6 if no other source address was found
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-05-29 09:44:20 -04:00
Aaron Goodman
5147dfc73a mwan3: Allow user to specify rules based on source interface
Add an option for adding rules based on source interface.
The default 0.0.0.0/0 src and destination ip addresses has been removed. It is unclear
how the 'any' family of rules would have worked, as it appears each rule always required an
ipv4 or ipv6 address src and destination address.  With this change, the any family will work
again.

I also cleaned up a bunch of repeated code around adding the iptables rules for
ipv4/ipv6/any in making the change.

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-05-29 09:42:29 -04:00
Aaron Goodman
cf38136b00 mwan3: Do not mangle outgoing ipv6 pings
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-05-29 01:24:57 -04:00
Aaron Goodman
b7d1f81f10 mwan3: version bump to 2.8.6
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-05-22 20:01:49 -04:00
Aaron Goodman
35a86bdc11 mwan3: force busybox ping
openwrt 19.07 uses iputils 20101006-1

This ancient version of iputils has a bug where the -I option is not respected.

https://github.com/iputils/iputils/issues/55
https://github.com/iputils/iputils/issues/56
https://bugs.openwrt.org/index.php?do=details&task_id=1486

Thus, we should force using busybox ping at "/bin/ping" until the iputils
version gets an upgrade in the next major release

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-05-22 20:01:45 -04:00
Aaron Goodman
aafdd0730c mwan3: don't add ipv6 link local address to routing tables
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-05-20 05:37:40 -04:00
Aaron Goodman
02ebd831c1 mwan3: reduce calls to `ip route list'
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
2020-05-20 05:37:39 -04:00
Brian J. Murrell
b017fe34dd mwan3: Update Makefile
Signed-off-by: Brian J. Murrell <brian@interlinx.bc.ca>
2020-04-30 14:55:20 +02:00
Brian J. Murrell
49cf5eac5c mwan3: Don't use /128 address for ping source
An interface can have both a /64 and a /128 from a provider.

In such a case, use the address from the /64 to do the ping check, not
the /128.

Signed-off-by: Brian J. Murrell <brian@interlinx.bc.ca>
2020-04-30 14:55:20 +02:00
Florian Eckert
3c34b151f6 mwan3: fix whitespace issue
fixes #11965

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-04-27 17:58:12 +02:00
Brian J. Murrell
6721587e8b mwan3: Ping IPv6 hosts using address not interface
Pinging IPv6 hosts using an interface as a source specifier seems
troublesome.  See https://bugs.openwrt.org/index.php?do=details&task_id=2897
for more detail.

Use the desired source interface's IP address instead.

Signed-off-by: Brian J. Murrell <brian@interlinx.bc.ca>
2020-03-13 15:24:57 +01:00
Florian Eckert
6d638c3e23 mwan3: change license to SPDX compatible identifier
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-11-18 09:26:51 +01:00
Florian Eckert
14dd084662 mwan3: update version to 2.8.2
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-11-14 08:01:52 +01:00
Florian Eckert
a689e168aa mwan3: add httping_ssl option
Till now we could only ping http targets on port 80. With this change by
adding the config boolean config option httping_ssl we could also ping
https ping targets on port 443.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-11-14 07:57:11 +01:00
Florian Eckert
581d7df844 mwan3: fix variable naming
The variable IPT is not valid at this point. Set the variable usage to IPT4
fixes this issue.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-11-14 07:57:11 +01:00
yurtesen
94e0c78826 mwan3: Fix json_load fails with some data
Sometimes the return value of `ubus -S call network.interface.wan status`
cause `json_load` to return `Failed to parse message data` error.

To avoid this, the JSON data always should be quoted with double quotes.

Signed-off-by: Evren Yurtesen <eyurtese@abo.fi>
Removed quoatation marks from commit heading
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-11-14 07:43:18 +01: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
e100de8bd8 mwan3: update version to 2.8.0
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-07-04 12:06:27 +02:00
Florian Eckert
27db561752 mwan3: add netifd up info to mwan3 ubus status output
Add the netifd up status output to the mwan3 ubus status output.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-07-04 12:03:43 +02:00
Florian Eckert
cfba93a203 mwan3: add enabled info to mwan3 ubus status
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-07-04 12:03:40 +02:00
Florian Eckert
bfa849c14e mwan3: add interface uptime netifd value to ubus mwan3 status output
Add missing netifd uptime info to ubus status call.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-07-04 12:03:37 +02:00
Florian Eckert
6c2cd78c6f mwan3: rename downtime to offline
Rename downtime ubus output from mwan3 to offline.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-07-04 12:03:34 +02:00
Florian Eckert
3be40786f5 mwan3: rename uptime to online
Rename uptime ubus output from mwan3 to online.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-07-04 12:03:30 +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
Chen Minqiang
a004d07632 mwan3: fix logical/typo bug in mwan3rtmon
This bug was introduced since dd206b7d0b
mwan3_remon_ipv4 and mwan3_remon_ipv6 is command to run not a variable
I add some comments on them hopefully people will notice it

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2019-03-22 18:11:07 +08:00
Florian Eckert
27e7e88966 mwan3: fix disconnected event generation in mwan3track
Before this change two disconnected events were generated. This is wrong!
The disconnected event is impliciet generated by the hotplug script on ifdown
event. The mwan3track script is notified by a USR1 signal which
generates the disconnectd event. The additional "disconnectd" event on
ifdown is not required.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-02-27 13:50:51 +01:00
Florian Eckert
7b4c075cc2 mwan3: update version to 2.7.10
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-01-22 14:29:34 +01: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
d167e3718d mwan3: lock critical section on mwan3 down
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-01-22 14:29:01 +01:00
Florian Eckert
dd206b7d0b mwan3: lock critical mwan3rtmon section
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-01-22 14:28:58 +01:00
Florian Eckert
b2c4f2b135 mwan3: update version to 2.7.9
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-01-14 08:28:58 +01:00
Florian Eckert
46b2593ce4 mwan3: mwan3rtmon interrupt sleep on signal (trap) event
Sleep will be aborted if a signal is send to this process.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-01-14 08:28:55 +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
a974558cfa mwan3: add syslog debug possibility to rules
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-01-14 08:28:50 +01:00
Florian Eckert
cb37a0e15b mwan3: update version to 2.7.8
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-12-25 18:27:49 +01:00
Florian Eckert
a49d609635 mwan3: remove duplicated global enable check
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-12-25 18:25:38 +01:00
Florian Eckert
f54c2f3157 mwan3: remove local_source deprecated code artefacts
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-12-25 18:24:16 +01:00
Michael Stoll
7acb0c3e38 mwan3: add nping to tracking method
Signed-off-by: Michael Stoll <michael.stoll@meadow-robotics.com>
2018-12-21 11:21:31 +01:00
Florian Eckert
ce123d3e83 mwan3: add policies view to ubus interface
Add to ubus the missing output information "policies" which could already
be observed with the command "mwan3 status".

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-11-13 16:04:26 +01:00
Florian Eckert
5d0406915e mwan3: update version to 2.7.6
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-11-08 12:29:15 +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
8b28ab282b net/mwan3: update version to 2.7.5
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-10-23 15:18:45 +02: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
Florian Eckert
181174b64b net/mwan3: add dynamic ipsets to mwan3_connected ipsets
During runntime of mwan3 we could add dynamicly networks to this ipset
which would then treated as connected networks by mwan3.

This is also usefull for ipsec.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-10-23 14:57:33 +02:00
Florian Eckert
dcb7ad17ba net/mwan3: add custom address from ip tables to connected ipset
With the list param "rt_table_lookup" in the mwan3 section globals,
it is now possible to add a additional routing table numbers which would get
also parsed and will be added to the connected network.
So mwan3 will treat them as they are directly connected to this device.

This could be usefull if we use ipsec.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-10-23 14:49:34 +02:00
Florian Eckert
1335e4f3dd net/mwan3: cleanup egrep ipv6 regex
The IPv6 egrep regex is confusing and hard to maintain.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-10-23 14:47:50 +02:00
Florian Eckert
84007a2723 net/mwan3: enhance ipset status generation
This change should optimize and speed up the status output generation.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-10-23 14:47:10 +02:00
Florian Eckert
ac8c4512d1 net/mwan3: reduce duplicate code
The generation for reporting the policies uses the same code add a
common function to reduce duplication.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-10-23 14:44:29 +02:00
Florian Eckert
952f3e1361 net/mwan3: cleanup/prettify 80 characters code boundary
Prettify and cleanup source

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-10-23 14:43:37 +02:00
Florian Eckert
eeef66cec2 net/mwan3: update version to 2.7.4
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-10-12 08:15:38 +02:00
Florian Eckert
1ee9fb4aff net/mwan3: add downtime ubus information
Get downtime information for the tracked mwan3 wan interfaces.
The information shows how long this interface is in disconnected state.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-10-12 08:15:36 +02:00
Florian Eckert
1236003733 net/mwan3: add uptime ubus information
Get uptime information for the tracked mwan3 wan interfaces.
The information shows how long this interface is in connected state.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-10-12 08:15:33 +02:00
Florian Eckert
3a5c3e03e2 net/mwan3: also add the metric to the default interface routing table
This is now the same route as in the main table.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-10-12 08:13:46 +02:00
Kyson Lok
8c0ed00c39 net/mwan3: fixup parse json_load an null message
If a interface is down, call ubus will return an null message which is
used to json_load, it causes json_get_vars gets value from last load and
l3_device various is nonzero.

Signed-off-by: Kyson Lok <kysonlok@gmail.com>
2018-10-12 08:13:42 +02:00
Chen Minqiang
dbebe3d6f9 net/mwan3: update version to 2.7.3
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2018-10-10 15:54:42 +08:00
Chen Minqiang
8ae2889674 mwan3: rtmon: filter out linkdown routing table
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2018-10-10 07:30:47 +08:00
Florian Eckert
692ed62382 net/mwan3: update version to 2.7.2
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-09-24 10:21:43 +02:00
Florian Eckert
2cd5442a11 net/mwan3: fix start/stop/restart execution
Move setting global enabled flag from /etc/init.d/mwan3 to mwan3
command. So we could start mwan3 from the cmd mwan3 as well.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-09-24 10:20:35 +02:00
Florian Eckert
d338131f40 net/mwan3: mwan3track should also send disconnected action on signal USR1
Also send disconnected action on system signal USR1.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-09-24 10:20:35 +02:00
Florian Eckert
c9d8fceb63 net/mwan3: add ttl check
Add the additional optional ttl check to test the connection.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-09-24 10:20:35 +02:00
Chen Minqiang
6a5836db32 mwan3: optimize the process of copying routing tables
- The original copy process is to delete all routing tables first,
   then add new routing table. This process is too slow and very dirty.
 - We use grep to identify the changes and apply them.
 - ignore ipv6 unreachable routes
 - update version number

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2018-09-21 15:35:39 +08:00
Chen Minqiang
9e75edcf2c mwan3: fix missing device in mwan3_set_policy()
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2018-08-29 22:54:42 +08:00
Chen Minqiang
7817aced2b mwan3: mwan3rtmon sleep time configurable
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2018-08-09 05:06:17 +08:00
Chen Minqiang
46ed09408e mwan3: refine link selection
- globals src_ip to none
 - ip route back to source
 - add mwan3rtmon
 - update version to 2.7

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2018-08-09 05:06:17 +08:00
Florian Eckert
b6249f1781 net/mwan3: fix NDP on ipv6 for ra services
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-06-06 10:41:38 +02:00
Florian Eckert
acf7278fb8 net/mwan3: update version to 2.6.17
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-30 12:57:49 +02:00
Florian Eckert
7ea690ea3c net/mwan3: fix update on connected ip networks
If an interface is not tracked by mwan3 or enabled and this interface is
setup by netifd, then the connected ipset is not update by mwan3.
To fix this also call connected ipset update code even if the interface
is not tracked or enabled by mwan3.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-30 12:56:50 +02:00
Florian Eckert
18022993d9 net/mwan3: update version to 2.6.16
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-16 11:24:37 +02:00
Florian Eckert
ab4e62b885 net/mwan3: execute only ifup event if l3_device is found
Only execute an ifup event with the command "mwan3 ifup <iface>" if the
l3_device is found in the ubus "network.interface.<iface>".

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-16 11:21:25 +02:00
Florian Eckert
215708a415 net/mwan3: remove logging mwan3track pid is not found
Remove unnecessary logging if mwan3track pid is not found

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-16 11:20:32 +02:00
Florian Eckert
2d9dfa3b1b net/mwan3: add/remove src_ip from routing table
Add or remove local_source ip also if mwan3 is stopped or started

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-16 11:19:24 +02:00
Florian Eckert
0d5dd6da4f net/mwan3: add missing local variables
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-11 09:00:57 +02:00
Florian Eckert
bdff2e990b net/mwan3: remove check_quality option from default config
The normal situation should be to use ping without quality_check.
If quality_check option is not set in the default option then ping
quality_check is not performed during tracking. This is and should
be the default situation.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-11 08:46:57 +02:00
Florian Eckert
21c42901e1 net/mwan3: update logging output
Unify logging output for tracking methode ping.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-11 08:46:40 +02:00
Florian Eckert
3b33e01791 net/mwan3: fix indentation
Fix indentation.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-11 08:43:34 +02:00
Florian Eckert
7962bfd3df net/mwan3: replace legancy backticks
Replace legancy backticks syntax shell execution with braces.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-11 08:42:53 +02:00
Florian Eckert
5f068b7fb3 net/mwan3: remove needless log output on mwan3track
Remove needless log output this will pollute the logging.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-11 08:42:17 +02:00
Nishant Sharma
1a33492ff8 mwan3: Packet Loss & Latency Check
1. Test link quality based on packet loss & latency w.r.t. pre-defined high and low watermark values.
2. Extended ubus support to provide packet loss & latency information per wan per track_ip

Signed-off-by: Nishant Sharma <codemarauder@gmail.com>
2018-05-11 08:21:28 +02:00
Florian Eckert
6b0a65b183 net/mwan3: update version to 2.6.14
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-04-12 11:22:26 +02:00
Florian Eckert
6f96e30829 mwan3: in ubus rpcd script fix shell local issue
To fix the shell local issue in the ubus mwan3 rpcd shell script, move
the switch case statment into a function.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-04-12 10:27:02 +02:00
Florian Eckert
1c520db1f7 net/mwan3: update version to 2.6.13
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-04-08 16:20:24 +08:00
Florian Eckert
f8cf485212 net/mwan3: also send connected action on initial_state offline
Move action into startup section will fix this.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-04-08 16:20:24 +08:00
Florian Eckert
1eae1ae3e7 net/mwan3: add logging on ping success and fail
Add logging information during state change on ping success or fail

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-04-08 16:20:24 +08:00
Luiz Angelo Daros de Luca
e6e65f3e54 mwan3: ipv6-compatible default conf
Considering that ipv6 NPT/NAT/NETMAP is done manually by user,
mwan3 can balance ipv6 interfaces as it does with ipv4.

Interface wan2 was renamed to wanb as wan2, wan3, ... will eventually
colide with OpenWrt with default wan6 interface when more than 6
interfaces are in use.

New interfaces, members for wan6 and wanb6 where created, both disabled
by default. Policies where adapted as well.

The option "family" is set respectively in each interface. When missing,
mwan3 assumes ipv4, that will fail when interface is IPv6 only.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2018-04-03 13:35:28 -03:00
Rob White
dc746a55a1
mwan3: Add missing globals config section
Add missing globals config section with default values.
Without the correctly named section, mwan3 startup will fail with the error - Warning: mwan3 is global disabled. Usage: /etc/init.d/mwan3 start.
Compile: not required
Run tested: LEDE 17.01.04
Author-name: Rob White
Maintainer: Florian Eckert <fe@dev.tdt.de>
Signed-off-by: Rob White <rob@blue-wave.net>
2018-04-01 10:04:46 +01:00
Florian Eckert
7c641a3d03 net/mwan3: update version to 2.6.12
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-03-29 14:58:02 +02:00
Florian Eckert
704ec2b064 net/mwan3: set default mask to 0x3F00
The IPsec ip route table has the default number 220.
If mwan3 has more then 7 bits set (124 interfaces) then if mwan3 down is
executed the table is also cleared. To solve this set default max 7
bits in the mmx_mask for mwan3.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-03-29 14:51:36 +02:00
Hannu Nyman
759ee14f41 mwan3: adjust dependency from ip-full to ip
Adjust the dependency from ip-full back to ip.

Returning back to "ip" is now possible as busybox does not provide
"ip" any more, making "ip" again reference to ip-tiny or ip-full.

Reference to discussion in #5747

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-03-23 16:52:27 +02:00
Florian Eckert
3c2e05d440 net/mwan3: update version to 2.6.11
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-03-16 14:45:29 +01:00
Florian Eckert
ae70008ed7 net/mwan3: update hint in mwan3.user for connected/disconnected
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-03-16 14:45:29 +01:00
Florian Eckert
270245e6d4 net/mwan3: deviate max interface value from mmx_mask value
We need always three of the firewall mask value for
* default routing table
* blackhole
* unreachable
the other will be used for the interfaces.

* If we have set the mmx_mask to max 0xFF00 (8 bit set) we could use max 252
  interfaces.
* If we have set the mmx_mask to min 0x0E00 (3 bit set) we could use max 4
  interfaces.

Only the ones are counting from the firewall mask value.
Minimal three firewall mask bit vaules must be set.
Maximal eight firewall mask bit vaules could be set.

Table overview mmx_mask value bits vs. max interfaces

mmx_mask value bits set 1 -> not usefull
mmx_mask value bits set 2 -> not usefull
mmx_mask value bits set 3 ->   4 Interfaces (mask example 0x0E)
mmx_mask value bits set 4 ->  12 Interfaces
mmx_mask value bits set 5 ->  28 Interfaces
mmx_mask value bits set 6 ->  60 Interfaces
mmx_mask value bits set 7 -> 124 Interfaces
mmx_mask value bits set 8 -> 252 Interfaces (mask example 0xFF)

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-03-16 14:45:29 +01:00
Florian Eckert
7c178353f0 net/mwan3: remove unused local variables
Remove unused local variables

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-03-16 14:45:29 +01:00
Florian Eckert
4f1e85bd8c net/mwan3: add connected/disconnected ACTION to mwan3track
Add a new ACTIONs:

* connected ACTION is called once if mwan3track reach all configured track_ips
* disconnected ACTION is called once if mwan3track is unable to reach the track_ips

The connected/disconnected will called only by mwan3track in opposite
the ACTIONs ifup/ifdown will also be called by netifd.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-03-16 14:44:04 +01:00
Florian Eckert
e12f3c8c14 net/mwan3: add jshn and ip-full to package dependency
* The mwan3 scripts sources ". /usr/share/libubox/jshn.sh"
* Mwan3 only works if ip-full is installed
  Error -> "ip: invalid argument '0xfd00/0xff00' to 'fwmark'"

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-03-12 10:14:36 +01:00
Florian Eckert
40f66cf432 net/mwan3: update to version 2.6.10
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-02-05 10:29:30 +01:00
Florian Eckert
8fa2101ea3 net/mwan3: add mwan3_init function
Move all shell commands which are executed during /lib/mwan3/mwan3.sh
sourceing into a seperate init function which must be called at first.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-02-05 10:29:28 +01:00
Florian Eckert
7cf9d9ec20 net/mwan3: send SIGKILL to mwan3track
In some situation it is not enough to send a SIGTERM to mwan3track to
ask service to stop accurate. If this does not work send him a SIGKILL
to prevent mwan3track running more then once per interface.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-02-05 10:29:25 +01:00
Florian Eckert
f9a787e8df net/mwan3: add init script to enable/disable mwan3 globally
Adding a init script to "/etc/init.d/" introduce the possibility to
enable/disable mwan3 globally.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-02-05 10:29:23 +01:00
Jakub Janco
349b90cc24 mwan3: Improve logs when member metric is too big
If metric of member interface is bigger then 256, it is not
appended to policy, now at least warn message is printed into
syslog

Signed-off-by: Jakub Janco <kubco2@gmail.com>
2017-12-07 15:41:59 +01:00
Florian Eckert
c33853dd6d net/mwan3: update to version 2.6.8
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2017-11-22 13:04:14 +01:00
Florian Eckert
3ee70a7001 net/mwan3: change usleep to sleep command
fix bug use sleep instead of usleep

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2017-11-16 09:15:28 +01:00
Florian Eckert
267c0eeaed net/mwan3: use uptime for ubus age info
If the date is changed by ntp the age value of mwan3 on ubus could jitter.
Use instead the uptime value from /proc/uptime which will not change during
system run.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2017-11-16 09:15:04 +01:00
David Yang
6f0a88f1ed mwan3: update to version 2.6.7
Signed-off-by: David Yang <mmyangfl@gmail.com>
2017-11-08 23:22:04 +08:00
David Yang
474e6bbdd7 mwan3: add check for ping
Signed-off-by: David Yang <mmyangfl@gmail.com>
2017-11-08 16:14:53 +08:00
David Yang
e094212b17 mwan3: reduce dependency on src_ip
Interfaces may be managed by 3rd-party scripts, thus src_ip may not be
always available in uci.

Signed-off-by: David Yang <mmyangfl@gmail.com>
2017-11-08 16:14:52 +08:00
David Yang
6f38affd0c mwan3: fix empty gateway when creating routing table
Interfaces of some PtP protocols do not have a real gateway. In that
case ubus may fill them with '0.0.0.0' or even leave it blank. This
will cause error when adding new routing rule.

Signed-off-by: David Yang <mmyangfl@gmail.com>
2017-11-08 16:14:50 +08:00
David Yang
5688f3e65a mwan3: reduce unnecessary comparisons
Signed-off-by: David Yang <mmyangfl@gmail.com>
2017-11-08 16:14:46 +08:00
Florian Eckert
2cf984c69e net/mwan3: fix track_ips order
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2017-09-12 16:14:32 +02:00
Florian Eckert
803f69546e net/mwan3: fix mwan3track STATUS if initial_state is offline
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2017-09-12 15:55:27 +02:00
Marcin Jurkowski
66406f98db mwan3: fix interface-bound traffic when interface is offline
This commit fixed what 6d99b602 was supposed to fix without affecting
interface-bound traffic.

Before 6d99b602 interface-bound traffic was working normally as long
as at least one interface was online. However when the last interface
went offline, it was impossible to ping and such state was
unrecoverable.

Commit 6d99b602 fixed unrecoverable offline state problem (it was
possible to ping -I iface) but messed inteface-bound traffic. Traffic
with interface source address was not working if the interface was in
"offline" state, even if another interface was online.
The problem was caused by an inconsistent "offline" interface state:
iptables-related rules were kept while routing table and policy were
deleted.

The idea behind this commit is to:
 1. Keep all the rules for each interface (iptables, routing table,
    policy) regardless of its state. This ensures consistency,
 2. Make interface state hotplug events affect only iptables'
    mwan3_policy_* rules. Interface-related iptables, routing table
    and policy is removed only when mwan3 is manually stopped.

To make such changes possible, it's necessary to change the way
mwan3_policy_* rule generator keeps track of interface state hotplug
events.
Until now, it checked for the existence of custom interface-related
routing table (table id 1, 2, 3, ...). Clearly we can no longer rely
on that so each interface state is stored explicitly in file.

Signed-off-by: Marcin Jurkowski <marcin1j@gmail.com>
2017-09-12 11:18:52 +02:00