fix(network): detect ethernet cable unplug again (carrier/operstate)

PR #4190 (merged as 93d85a0) reworked getNetworkState() so the rfkill
"disabled" state is evaluated whenever the module has no carrier. Because
the module always watches an RFKILL_TYPE_WLAN switch, a wired ethernet
module whose cable is unplugged (carrier lost) would return "disabled"
instead of "disconnected" whenever the system's WLAN radio happened to be
rfkill-blocked. With no format-disabled configured, that state falls back
to plain "format", so the interface kept looking connected after unplug.

rfkill only concerns wireless radios, so only honor it when there is no
interface at all or the current interface is actually wireless (detected
via /sys/class/net/<if>/phy80211 or /wireless). A wired interface that
lost its carrier now correctly reports "disconnected", while wifi rfkill
display from #4190 is preserved.

Fixes #4364.
This commit is contained in:
Alex
2026-07-04 13:43:01 +02:00
parent b0b46ec039
commit faf6a62bcf
2 changed files with 23 additions and 1 deletions
+1
View File
@@ -51,6 +51,7 @@ class Network : public ALabel {
bool matchInterface(const std::string& ifname, const std::vector<std::string>& altnames,
std::string& matched) const;
auto getInfo() -> void;
bool isWireless() const;
const std::string getNetworkState() const;
void clearIface();
std::optional<std::pair<unsigned long long, unsigned long long>> readBandwidthUsage();