mwan3 package and MMX_MASK using so many bits

Jonas Lochmann openwrt at jonaslochmann.de
Mon May 5 10:17:45 PDT 2025


On Mon, May 05, 2025 at 09:06:02AM -0600, Philip Prindeville via openwrt-devel wrote:
> > The mask encodes the selected uplink that is used in a policy based
> > routing. One bit could encode only "no decision" and "uplink 1".
> 
> Is that a fixed map?  I.e. (1) there is a max of 6 possible egress paths and
> (2) any of the other bits could be used without risk of conflict with mwan3?

That would not work. It is more complicated.

mwan3 wants at least three bits [1]. Zero is used for "no decision".
Then a table is generated that maps the used interfaces to numbers [2].
However, there are three internally used actions (default, blackhole,
unreachable) that need a number too. They start from the maximum value
that the bitmask permits. Due to this, theoretically "unused" bits can
be one or zero depending on internal actions or regular interfaces.

For the 3 internally actions and "no decision", you already need 2 bits.
Add at least two uplinks and the third bit is consumed. So running it with
3 bits only is possible but adds some limitations (different interfaces
for IPv6 or more uplinks - you need more bits).

[1] https://github.com/openwrt/packages/blob/b98fb60/net/mwan3/files/lib/mwan3/common.sh#L124
[2] https://github.com/openwrt/packages/blob/b98fb60/net/mwan3/files/lib/mwan3/mwan3.sh#L31
[3] https://github.com/openwrt/packages/blob/b98fb60/net/mwan3/files/lib/mwan3/common.sh#L145



More information about the openwrt-devel mailing list