From b85f0c17c39eb5f294b862bfe0c9d5ad08e1fd42 Mon Sep 17 00:00:00 2001 From: peelz Date: Thu, 3 Jul 2025 16:36:25 -0400 Subject: [PATCH] fix(network): ignore carrier state when the interface is down I'm not sure why, but my network card (mt7921e) sometimes will report having a carrier when the interface is down. This usually happens when rfkill was active before rebooting. --- src/modules/network.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/network.cpp b/src/modules/network.cpp index 35ba18fd..9271aecb 100644 --- a/src/modules/network.cpp +++ b/src/modules/network.cpp @@ -494,6 +494,11 @@ int waybar::modules::Network::handleEvents(struct nl_msg *msg, void *data) { net->ifname_ = new_ifname; net->ifid_ = ifi->ifi_index; if (ifi->ifi_flags & IFF_POINTOPOINT) net->is_p2p_ = true; + if ((ifi->ifi_flags & IFF_UP) == 0) { + // With some network drivers (e.g. mt7921e), the interface may + // report having a carrier even though interface is down. + carrier = false; + } if (carrier.has_value()) { net->carrier_ = carrier.value(); }