aboutsummaryrefslogtreecommitdiff
path: root/net/mwan3/files/etc/hotplug.d
Commit message (Collapse)AuthorAge
* mwan3: make mwan3.user executableFlorian Eckert2022-12-19
| | | | | | | | | | | | | | | This is a fix for the the following change: https://github.com/openwrt/packages/commit/3d824ea288d907a31729c3629e884ea122c30da0 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>
* mwan3: move command definitions to common.shFlorian Eckert2022-03-14
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: fix mwan3 flush conntrack table callFlorian Eckert2021-12-22
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: Use shebang in /etc/mwan3.userBrian J. Murrell2021-09-03
| | | | | | | | | 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>
* mwna3: fix whitespaceFlorian Eckert2021-05-03
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: fix regression in ipv6 routing tablesAaron Goodman2021-01-02
| | | | Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: remove unused mwan3_unlock function callFlorian Eckert2020-12-22
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: fix MWAN3_STARTUP callerFlorian Eckert2020-12-22
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: fix whitspaceFlorian Eckert2020-12-22
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: remove unneeded ipset setup in hotplugAaron Goodman2020-11-10
| | | | | | connected ipset handled on mwan3rtmon, so not needed in hotplug Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
* mwan3: fix hotplug issues from 1f1d21Aaron 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: reload unreachable/blackhole rules on hotplugAaron Goodman2020-11-06
| | | | | | | | | 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>
* mwan3: remove not needes jshn.sh includeFlorian Eckert2020-11-06
| | | | | | Remove not needed jshn.sh include. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* 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: only update src_iface rules on ifupAaron Goodman2020-10-16
| | | | 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: 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: unify variable checkFlorian Eckert2020-07-28
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: fix race condition on mwan3 restartFlorian Eckert2020-07-28
| | | | | | | 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>
* mwan3: change flush_conntrack handling to use uci list elementFlorian Eckert2019-06-03
| | | | | | | | | 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>
* mwan3: add locking debug possibilityFlorian Eckert2019-01-22
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: set interface unknown to offlineFlorian Eckert2019-01-14
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: fix initial_state offline issueFlorian Eckert2019-01-14
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: remove deprecated local_source config optionFlorian Eckert2018-11-08
| | | | | | | This feature is not needed anymore. This feature is replaced by the change 46ed09408e554f182a688e0a7c47cdf85fc6c15d Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: revert add online_metric for local_source noneFlorian Eckert2018-11-08
| | | | | | This is not necessary. This reverts commit be91e71805116ac1fd852a1ac0480737538d0b04.
* net/mwan3: add online_metric for local_source noneFlorian Eckert2018-10-23
| | | | | | | | | | | | | | | | | | | | | 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>
* net/mwan3: add custom address from ip tables to connected ipsetFlorian Eckert2018-10-23
| | | | | | | | | | | 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>
* mwan3: refine link selectionChen Minqiang2018-08-09
| | | | | | | | | - 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>
* net/mwan3: fix update on connected ip networksFlorian Eckert2018-05-30
| | | | | | | | | 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>
* net/mwan3: add mwan3_init functionFlorian Eckert2018-02-05
| | | | | | | 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>
* net/mwan3: add init script to enable/disable mwan3 globallyFlorian Eckert2018-02-05
| | | | | | | 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>
* net/mwan3: change usleep to sleep commandFlorian Eckert2017-11-16
| | | | | | fix bug use sleep instead of usleep Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: reduce dependency on src_ipDavid Yang2017-11-08
| | | | | | | 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>
* mwan3: fix empty gateway when creating routing tableDavid Yang2017-11-08
| | | | | | | | 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>
* net/mwan3: fix mwan3track STATUS if initial_state is offlineFlorian Eckert2017-09-12
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: fix interface-bound traffic when interface is offlineMarcin Jurkowski2017-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* net/mwan3: fix /var/state issue in 14-mwan3 hotplugFlorian Eckert2017-09-01
| | | | | | | | 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>
* mwan3: fix bugs introduced in 815e83d4Marcin Jurkowski2017-08-17
| | | | | | | | | | 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>
* net/mwan3: add hotplug script for hidden self interface generationFlorian Eckert2017-08-10
| | | | | | | | | | | | | | Add new globals config section with option local_source. With this config option the self interface generation will be done now automatically on hotplug event. You can specify which interface (ip) sould be used for router traffic. To replace the self intereface in the config set local_source to "lan". The default option is none, so it will not change default behavior if a "self" interface is configured in the network section. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* net/mwan3: fix ipset generation in hotplug script with an lockFlorian Eckert2017-08-10
| | | | | | Fix critical section during hotplug events. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* net/mwan3: on startup mark interface online only if track_ip are reachableFlorian Eckert2017-08-10
| | | | | | | | | | | | | | | | Add new interface config option "inital_state". If interface comeing up the first time(mwan3 start, boot), there are now two option for interface behaviour: - online (default as is now) Set up interface regardless wether tracking ip are reachable or not. - offline Set up interface first to ping tracking ip and if they are reachable set up the interface completely. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* net/mwan3: fix ping issue if last interface recovers from failureFlorian Eckert2017-08-10
| | | | | | | | | | | Even though error was fixed the interface checks still fails, if last_resort was set to blackhole or unreachable. To fix this issue do not remove failure interface from iptables change on down event. Reported-by: Colby Whitney <colby.whitney@luxul.com> Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* net/mwan3: change logging output on hotplug interface eventFlorian Eckert2017-08-10
| | | | | | Change logging output on hotplug interface event Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* mwan3: support various interface tracking methodsMarcin Jurkowski2017-08-02
| | | | | | | | | | | | Adds support for interface tracking using either ping, arping or httping. This allows to track interface status on networks with filtered ICMP traffic or simply to monitor data link layer etc. To facilitate binding to a specified interface its IP address is passed as a new mwan3track parameter. It's currently required by httping and possibly by other tools that may be added in the future. Signed-off-by: Marcin Jurkowski <marcin1j@gmail.com>
* net/mwan3: add lock for mwan3 hotplug scriptFlorian Eckert2017-06-22
| | | | | | | | | | If more then one interface get up/down at once mwan3 could be in a undefined state, because more then one mwan3 hotplug script are running and editing the iptables. Lock the critical section should solve this issue. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* net/mwan3: remove absolute path for bin filesFlorian Eckert2017-05-12
| | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de>