mwan3rtmon rewrite in ucode (Re: ucode for scripts)

Jonas Lochmann openwrt at jonaslochmann.de
Sat Nov 8 13:52:05 PST 2025


Am Sat, Nov 08, 2025 at 01:11:17PM -0500, schrieb Etienne Champetier:
> I also had a look at rewriting mwan3rtmon in ucode recently and I'm
> wondering if we could just get rid of it.
> Basically this script watches the main routing table to copy all non
> default routes, and also fill an ipset,

It does this per interface and keeps the default rules of that
particular interface while also removing source based routing in case
of IPv6. (Well, this can be disabled, but I would not recommend that.)

> but I think using rules like 'lookup main suppress_prefixlength 0' we
> should be able to remove mwan3rtmon.

But where do we get the default routes from then? I see no possibility
to skip mwan3rtmon.

I thought of trying to put this into netifd, but it looks like it does
not recognize routes added by other services (e.g. openvpn).

> Also found some example rtnl code in
> https://github.com/jow-/ucode/issues/184 if you are looking for some

I consider https://github.com/jow-/ucode/blob/master/lib/rtnl.c more
interesting. But it feels like many things in OpenWrt where the source
code is the documentation/things are not documented. Same for mwan3
where I know the architecture from working with the source code, but
I don't know any description telling how mwan3, its parts and the linux
network stack work together.



More information about the openwrt-devel mailing list