openwrt / packages

Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
GNU General Public License v2.0
4.01k stars 3.49k forks source link

mwan3: route updates ignored unless tracking is enabled #20571

Open lowjoel opened 1 year ago

lowjoel commented 1 year ago

Maintainer: @feckert @aaronjg Environment: Linksys E8450 / aarch64 / OpenWrt 22.03.3

Description:

Hello, I have mwan3 running on a router with Strongswan with xfrm. When a new road warrior Strongswan client connects, a /32 route is added to send traffic to the xfrm interface where the Strongswan client lives. The local networks attached to the router are fine, but WAN is inaccessible (packet leaves router, but the returning packets from wan cannot be routed back to road warrior. tcpdump shows egress packet to wan, response packet from wan ingress, then the router sends ICMP destination unreachable back to wan after 1sec). A /etc/init.d/mwan3 restart then grants access to wan for the client.

I found that adding track_ip to the wan interface fixes the problem. I think that's because of https://github.com/openwrt/packages/commit/8d4e202fa4aa7c3a549472ead942c976e218dd31#diff-8a37c6770c4fcad6a416392044a5e3bc4a9624592ca319cb9a4036c60a49e7f5R110-R114.

        if [ -n "$iface" ] && [ "$(mwan3_get_mwan3track_status $iface)" != "active" ]; then
            LOG debug "interface $iface is disabled - skipping '$route_line'";
            return
        fi

The original code that was there was checking if the interface is online, so I believe the code should be calling mwan3_report_iface_status instead of mwan3_get_mwan3track_status? I'm not sure if this is intended; if it is unintended, I'd be happy to try to come up with a PR to fix - I didn't want to change intended behaviour.

feckert commented 1 year ago

I will summarize this now. Previously the internal status of the mwan3track was used. The routes are discarded when the interface is not online. Now the routes are discarded when the tracking is not active. See the commit message off https://github.com/openwrt/packages/commit/8d4e202fa4aa7c3a549472ead942c976e218dd31

- add routes even when iface is down

I don't know your use case now.