batman-adv: bat0_ip UCI section vs netdev operstate ??? status reporting gotcha
OpenWrt
openwrt at optimcloud.com
Mon Sep 7 23:30:00 PDT 2026
We're running a USP/TR-369 agent (ac-client) on OpenWrt with batman-adv mesh,
and hit a status-reporting bug worth sharing.
`bat0_ip` is a UCI section, not a netdev. The real kernel interface is the
netdev named by `network.bat0_ip.device` (`bat0`). Reading
`/sys/class/net/bat0_ip/operstate` always fails, so the agent reported the mesh
as "Down" when it was actually up. Fix: resolve the netdev from the section's
`device` option, falling back to `br-{section}` for bridges.
Second: OpenWrt virtual ifaces report operstate `unknown` even when up. bat0
(and bridges) show `unknown` with carrier=1. We treat `unknown` + carrier=1 as
"Up", else "Unknown". Otherwise every mesh node reads as Down.
Anyone else hit this? Curious how others handle operstate for batman-adv /
bridge interfaces. (Agent is at github.com/optim-enterprises-bv/ac-client if
useful.)
More information about the openwrt-devel
mailing list