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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
Use common function to toggle ip address in /var/state/mwan3.
Change also to use toggle function and not set function. If ip address
is often changed every change is saved to /var/state/mwan3.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
If enough tracking ip are pinged skip the reset. They are not needed
anymore to mark the interface as up.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Fixes the following bugs introduced in commit 815e83d4:
- hotplug: invalid parameter order when initial interface state is "online",
mwan3track expects initial state to be the third argument
- hotplug: missing source ip address when initial interface state is "offline"
- mwan3track: source ip address should be the fourth argument
Signed-off-by: Marcin Jurkowski <marcin1j@gmail.com>