Skip to content

mwan3: prefer default route source address#29801

Open
dhrm1k wants to merge 1 commit into
openwrt:masterfrom
dhrm1k:mwan3-prefer-route-src
Open

mwan3: prefer default route source address#29801
dhrm1k wants to merge 1 commit into
openwrt:masterfrom
dhrm1k:mwan3-prefer-route-src

Conversation

@dhrm1k

@dhrm1k dhrm1k commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Prefer the src address from the interface default route before falling back
to the interface address from netifd.

This fixes the diagnostics/tracking case where an interface has one address,
but the default route explicitly selects a different source address.

Fixes: #29055

Package Details

Maintainer: @feckert

Description:
Fix mwan3_get_src_ip() so it uses the default route's preferred source
address when one is present.


Run Testing Details

  • OpenWrt Version: 25.12.2
  • OpenWrt Target/Subtarget: x86/64
  • OpenWrt Device: libvirt OpenWrt VM

Tested the source address selection on an OpenWrt VM with mocked route and
netifd values.

With a default route containing src 203.0.113.50, mwan3_get_src_ip() now
returns:

route_src_case=203.0.113.50

When the default route does not contain src, it still falls back to the
interface address:

fallback_case=100.64.1.2

Local checks:

busybox ash -n feeds/packages/net/mwan3/files/lib/mwan3/common.sh
git -C feeds/packages diff --check
make package/feeds/packages/mwan3/check V=s

Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

If your PR contains a patch:

  • Not applicable, this PR does not add or modify an upstream source patch.

Comment thread net/mwan3/files/lib/mwan3/common.sh Outdated
@dhrm1k dhrm1k force-pushed the mwan3-prefer-route-src branch from 6f0a0dc to 7b6ba4e Compare June 24, 2026 15:30

@feckert feckert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM See my comments

Comment thread net/mwan3/Makefile Outdated
PKG_NAME:=mwan3
PKG_VERSION:=2.12.1
PKG_RELEASE:=1
PKG_RELEASE:=2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a feature change. So we have to bump the PKG_VERSION by one and not the PKG_RELEASE.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will do that.

Comment thread net/mwan3/files/lib/mwan3/common.sh Outdated
Prefer the source address from the interface default route before falling
back to the interface address from netifd.

This fixes diagnostics and tracking in setups where the route-selected
source address differs from the interface address.

Fixes: openwrt#29055
Signed-off-by: Dharmik Parmar <dharmikparmar2004@yahoo.com>
@dhrm1k dhrm1k force-pushed the mwan3-prefer-route-src branch from 7b6ba4e to b264471 Compare June 26, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mwan3: default route src ip should be preferred over interface ip when get_src_ip

2 participants