Network: fix: delete correct address type
Only delete the corresponding address type (IPv4 or IPv6) when an event about a specific type (AF_INET or AF_INET6) is received This fixes situations where only one type of the address is deleted (and possibly added again) but Waybar still thinks the interface is in "linked" (no IP) state.
This commit is contained in:
@@ -677,12 +677,15 @@ int waybar::modules::Network::handleEvents(struct nl_msg* msg, void* data) {
|
||||
changed_cidr);
|
||||
}
|
||||
} else {
|
||||
if (ifa->ifa_family == AF_INET) {
|
||||
net->ipaddr_.clear();
|
||||
net->ipaddr6_.clear();
|
||||
net->cidr_ = 0;
|
||||
net->cidr6_ = 0;
|
||||
net->netmask_.clear();
|
||||
} else if (ifa->ifa_family == AF_INET6) {
|
||||
net->ipaddr6_.clear();
|
||||
net->cidr6_ = 0;
|
||||
net->netmask6_.clear();
|
||||
}
|
||||
spdlog::debug("network: {} addr deleted {}/{}", net->ifname_,
|
||||
inet_ntop(ifa->ifa_family, RTA_DATA(ifa_rta), ipaddr, sizeof(ipaddr)),
|
||||
ifa->ifa_prefixlen);
|
||||
|
||||
Reference in New Issue
Block a user