Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion net/mwan3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=mwan3
PKG_VERSION:=2.12.1
PKG_VERSION:=2.12.2
PKG_RELEASE:=1

PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>
Expand Down
8 changes: 6 additions & 2 deletions net/mwan3/files/lib/mwan3/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ mwan3_get_true_iface()

mwan3_get_src_ip()
{
local family _src_ip interface true_iface device addr_cmd default_ip IP sed_str
local family _src_ip interface true_iface device addr_cmd default_ip IP sed_str route_target
interface=$2
mwan3_get_true_iface true_iface $interface

Expand All @@ -64,15 +64,19 @@ mwan3_get_src_ip()
addr_cmd='network_get_ipaddr'
default_ip="0.0.0.0"
sed_str='s/ *inet \([^ \/]*\).*/\1/;T;p;q'
route_target="0.0.0.0"
IP="$IP4"
elif [ "$family" = "ipv6" ]; then
addr_cmd='network_get_ipaddr6'
default_ip="::"
sed_str='s/ *inet6 \([^ \/]*\).* scope.*/\1/;T;p;q'
route_target="::"
IP="$IP6"
fi

$addr_cmd _src_ip "$true_iface"
__network_ifstatus _src_ip "$true_iface" ".route[@.target='$route_target'].source" "" 1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This default-route selector omits the && !@.table filter that the in-tree netifd helper network_get_gateway at network.sh:219 uses for the same default-route lookup. Without it, .route[@.target='0.0.0.0'/'::'] can also match a default route that belongs to a non-main routing table (e.g. an interface configured with option table), and return that route's source instead of the main-table default. Since mwan3 revolves around policy routing, matching the helper convention seems safer. Is the omission intentional?

Suggested change
__network_ifstatus _src_ip "$true_iface" ".route[@.target='$route_target'].source" "" 1
__network_ifstatus _src_ip "$true_iface" ".route[@.target='$route_target' && !@.table].source" "" 1

Generated by Claude Code

[ -n "$_src_ip" ] && _src_ip="${_src_ip%%/*}"
[ -z "$_src_ip" ] && $addr_cmd _src_ip "$true_iface"
if [ -z "$_src_ip" ]; then
if [ "$family" = "ipv6" ]; then
# on IPv6-PD interfaces (like PPPoE interfaces) we don't
Expand Down
Loading