-
Notifications
You must be signed in to change notification settings - Fork 3.8k
mwan3: add rules for router initiated traffic #25121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Please bump the PKG_RELEASE. |
Add ip rules to enable route selection for traffic from the router itself using the source IP address of the uplinks. Signed-off-by: Filippo Carletti <[email protected]>
92175a6 to
601681a
Compare
|
PKG_RELEASE bumped. |
Cosmetic: silence warning messages when stopping mwan3:
```
~# /etc/init.d/mwan3 restart
{}{}{}grep: warning: stray \ before :
grep: warning: stray \ before :
```
Signed-off-by: Filippo Carletti <[email protected]>
|
@feckert do you think it's ready for merging? |
|
Sorry, I don't have time to investigate and verify this right now :-( |
|
|
||
| mwan3_delete_iface_rules "$1" | ||
|
|
||
| network_get_ipaddr wan_addr "${1}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the following?
--- mwan3.sh 2024-09-23 12:34:46.000000000 +0000
+++ /lib/mwan3/mwan3.sh 2024-12-23 18:09:25.564820431 +0000
@@ -519,15 +519,16 @@
if [ "$family" = "ipv4" ]; then
IP="$IP4"
+ network_get_ipaddr wan_addr "${1}"
elif [ "$family" = "ipv6" ] && [ $NO_IPV6 -eq 0 ]; then
IP="$IP6"
+ network_get_subnet6 wan_addr "${1}"
else
return
fi
mwan3_delete_iface_rules "$1"
- network_get_ipaddr wan_addr "${1}"
$IP rule add pref $((id+1000)) iif "$2" lookup "$id"
$IP rule add pref $((id+1500)) from ${wan_addr} lookup "$id"There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
network_get_subnet6 may fail, we could skip the rule if it returns 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you want to use the network_get_subnet6 function and not the function network_get_ipaddr6 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not experienced in IPv6, I think that you always get a subnet from the ISP (opposed to a single IPv4 address).
|
The mwan3 is written in |
|
This PR is missing the deletion of IP rules when a WAN uplink goes down. |
Maintainer: @feckert
Compile tested: x86-64, snapshot
Run tested: x86-64, 23.05.4
Description:
Router-initiated traffic can select the uplink to use via the
mwan3 usecommand or the socket wrapper.This PR adds ip rules to enable route selection using the uplink's source IP address.
Additional information:
Given that eth0.1 is the backup wan, the
ping -c 1 -I eth0.1 www.google.comcommand used by the documentation now only works before mwan3 is configured. With this patch, it will work even after mwan3 has been configured.See this forum thread for discussion.