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.
This commit is contained in:
parent
b02694caef
commit
b85f0c17c3
|
|
@ -494,6 +494,11 @@ int waybar::modules::Network::handleEvents(struct nl_msg *msg, void *data) {
|
||||||
net->ifname_ = new_ifname;
|
net->ifname_ = new_ifname;
|
||||||
net->ifid_ = ifi->ifi_index;
|
net->ifid_ = ifi->ifi_index;
|
||||||
if (ifi->ifi_flags & IFF_POINTOPOINT) net->is_p2p_ = true;
|
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()) {
|
if (carrier.has_value()) {
|
||||||
net->carrier_ = carrier.value();
|
net->carrier_ = carrier.value();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue