aboutsummaryrefslogtreecommitdiff
path: root/net/mwan3/files/lib
Commit message (Collapse)AuthorAge
* mwan3: change log message on already added routeFlorian Eckert2022-10-17
| | | | | | Only show message on already set route, if debugging is enabled. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: support offload routing modifierDenys Yarkovyi2022-10-05
| | | | Signed-off-by: Denys Yarkovyi <dyarkovoy@gmail.com>
* mwan3: fix sticky chain lengthFlorian Eckert2022-03-28
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: dump iptables and ipset command for debuggingFlorian Eckert2022-03-14
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: unify error messagesFlorian Eckert2022-03-14
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: Split ipsets into separate ipv4 and ipv6 setsFlorian Eckert2022-03-14
| | | | | | | | | | 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>
* mwan3: use mwan3_push_update function for mwan3_delete_iface_iptablesFlorian Eckert2022-03-14
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: remove ipset generation from mwan3_set_general_iptablesFlorian Eckert2022-03-14
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: use sticky ipset generation mwan3_push_update patternFlorian Eckert2022-03-14
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: do not create dynamic ipset for IPv6 if not supportedFlorian Eckert2022-03-14
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: do not add mwan3_custom_v6 set if ipv6 is not availableFlorian Eckert2022-03-14
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: use also ipset restore for connected ipv4 setsFlorian Eckert2022-03-14
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: move command definitions to common.shFlorian Eckert2022-03-14
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: use default routes from additional tablesDaniel Golle2021-07-05
| | | | | | | | | | Until now the additional tables listed in gobal 'rt_table_lookup' were not considered for interfaces. In order to be able to also use interface-defined routes from tables other than main, consider also tables listed in 'rt_table_lookup'. Update version to 2.10.10 as requested by maintainer. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* mwan3: fix regression in ipv6 routing tablesAaron Goodman2021-01-02
| | | | Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: fix tabFlorian Eckert2020-12-22
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: fix linkdown routes not being addedAaron Goodman2020-12-16
| | | | Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: don't call rpcd on 'mwan3 interfaces'Aaron Goodman2020-11-16
| | | | | | | Allow `mwan3 interfaces` to get uptime via an internal function and thus remove the dependency on rpcd for `mwan3 interface` calls. Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: report an error code on status failureAaron Goodman2020-11-10
| | | | Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: add IPKG_INSTROOT to scriptsAaron Goodman2020-11-10
| | | | | | IPKG_INSTROOT needed for including mwan3 when building images Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: add logging for ipset errorsAaron Goodman2020-11-10
| | | | Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: make it clearer who initiated the startFlorian Eckert2020-11-06
| | | | | | | | | 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>
* mwan3: use procd for locking everywhereAaron Goodman2020-11-06
| | | | | | | | | | | | | | | | | | | 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)
* mwan3: fix rpcd with for routers with no IPv6 supportAaron Goodman2020-10-29
| | | | Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: add "use" function to mwan3 utilsAaron Goodman2020-10-16
| | | | | | | | | | | | | | | Use "mwan3 use" to wrap a command with interface bindings so that you can avoid the mwan3 rules and test behavior on a specific interface. eg "mwan3 use wan ping -c1 1.1.1.1" Additional binding arguments to the command will have their system calls intercepted and ignored. eg "mwan3 use wan ping -c1 -I tun0 1.1.1.1" will use the device associated with "wan", rather than "tun0". Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: use helper library for mwan3trackAaron Goodman2020-10-16
| | | | | | | | | | | | | | | | | Rather than using a special mwan3 user to manage mwan3track's tracking packets, this commit implements a small helper library to bind to device and to set a fwmark so that the tracking packets can be routed out of the correct interface. This provides a consistent method for binding to a device rather than relying on various packages potentially buggy implementations. For example: #8139 and #12836 This helper issue also allows for more tracking methods to be added even if they do not have a command line option to bind to device, such as iperf3 (eg #13050). Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: give warning if ip of incorrect family specified in a ruleAaron Goodman2020-10-16
| | | | | | also use global IPv4_REGEX environment variable as consistent IPv4 regex Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: use procd for mwan3rtmon and mwan3trackAaron Goodman2020-10-16
| | | | | | | | | | | 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>
* mwan3: fix bug when one interface is a prefix of anotherAaron Goodman2020-10-16
| | | | | | | | correctly terminate interface status checks with new lines so that interface status does not get confused when one interface is a prefix of another interface. Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: improvements to route creationAaron Goodman2020-10-16
| | | | | | | | | | | | | | | | | | 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>
* mwan3: use MWAN3TRACK_STATUS_DIR variable throughoutAaron Goodman2020-10-16
| | | | Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: fixup some extra spaces and shellcheck warningsAaron Goodman2020-10-16
| | | | Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: improve startup performance; version 2.9.0Aaron Goodman2020-08-17
| | | | | | | | | | | | | | | | | | | | | | 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>
* mwan3: use ip monitor route to detect routing changesAaron Goodman2020-08-15
| | | | | | | | | | | 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>
* mwan3: remove lock file entirelyFlorian Eckert2020-07-28
| | | | | | Removing the lock file ist not necessary Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: revert: also cleanup lock on mwan3 stopFlorian Eckert2020-07-28
| | | | | | | | | | | | This reverts commit cde2a77ed3b3b0df9e693e121dccdc97ef163156. 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>
* mwan3: add online and uptime to detail outputFlorian Eckert2020-07-20
| | | | | | | 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>
* mwan3: also cleanup lock on mwan3 stopFlorian Eckert2020-07-20
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: fix rtmon routing table function generationFlorian Eckert2020-07-20
| | | | | | | | | | | | | | 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>
* mwan3: fix IPv6 routing add handlingFlorian Eckert2020-07-19
| | | | | | | | | | | | 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>
* mwan3: fix idx calculationFlorian Eckert2020-07-19
| | | | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de> [aaronjg@stanford.edu: fix syntax error] Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: cleanup duplicate ipv4 and ipv6 logicAaron Goodman2020-07-19
| | | | Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: don't send iptable setup failures to /dev/nullAaron Goodman2020-07-19
| | | | | | silencing failing rules makes debugging more difficult Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: don't try to use ipv6 if not installedAaron Goodman2020-07-19
| | | | | | fix issue #11826 Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: be more efficient with sleep after killing trackersAaron Goodman2020-07-16
| | | | Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: don't add single ipv4 to connected list if already covered by a cidrAaron Goodman2020-07-16
| | | | Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: cleanup function mwan3_create_iface_routeFlorian Eckert2020-07-15
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: fix shellcheck warning SC2086Florian Eckert2020-07-15
| | | | | | | Add double quote to prevent globbing and word splitting where there is no regression. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: fix shellcheck warning SC2166Florian Eckert2020-07-15
| | | | | | Replace -o boolean check with ||. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: remove unused variable complained by shellcheckFlorian Eckert2020-07-15
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>