Skip to content

Commit b85f0c1

Browse files
committed
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.
1 parent b02694c commit b85f0c1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/modules/network.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,11 @@ int waybar::modules::Network::handleEvents(struct nl_msg *msg, void *data) {
494494
net->ifname_ = new_ifname;
495495
net->ifid_ = ifi->ifi_index;
496496
if (ifi->ifi_flags & IFF_POINTOPOINT) net->is_p2p_ = true;
497+
if ((ifi->ifi_flags & IFF_UP) == 0) {
498+
// With some network drivers (e.g. mt7921e), the interface may
499+
// report having a carrier even though interface is down.
500+
carrier = false;
501+
}
497502
if (carrier.has_value()) {
498503
net->carrier_ = carrier.value();
499504
}

0 commit comments

Comments
 (0)