From 52e9f624be726a3fbad83d552df501eccd1f9495 Mon Sep 17 00:00:00 2001 From: User Date: Thu, 15 Sep 2022 14:03:32 +0300 Subject: [PATCH 1/2] added checking router id in handleEvent function, because module doesn't update state --- src/modules/network.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/network.cpp b/src/modules/network.cpp index 3fe4a8b..4bf0092 100644 --- a/src/modules/network.cpp +++ b/src/modules/network.cpp @@ -646,7 +646,11 @@ int waybar::modules::Network::handleEvents(struct nl_msg *msg, void *data) { if (has_gateway && !has_destination && temp_idx != -1) { // Check if this is the first default route we see, or if this new // route have a higher priority. - if (!is_del_event && ((net->ifid_ == -1) || (priority < net->route_priority))) { + /** Module doesn`t update state, because RTA_GATEWAY call before enable new router and set higher priority. + Disable router -> RTA_GATEWAY -> up new router -> set higher priority + added checking route id + **/ + if (!is_del_event && ((net->ifid_ == -1) || (priority < net->route_priority) || (net->ifid_ != temp_idx)) { // Clear if's state for the case were there is a higher priority // route on a different interface. net->clearIface(); From d1700bf202c2fc22f284449e24a53822a6ba9ff2 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 15 Sep 2022 15:47:14 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Revert=20"added=20checking=20router=20id=20?= =?UTF-8?q?in=20handleEvent=20function,=20because=20module=20does=E2=80=A6?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/network.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/modules/network.cpp b/src/modules/network.cpp index 4bf0092..3fe4a8b 100644 --- a/src/modules/network.cpp +++ b/src/modules/network.cpp @@ -646,11 +646,7 @@ int waybar::modules::Network::handleEvents(struct nl_msg *msg, void *data) { if (has_gateway && !has_destination && temp_idx != -1) { // Check if this is the first default route we see, or if this new // route have a higher priority. - /** Module doesn`t update state, because RTA_GATEWAY call before enable new router and set higher priority. - Disable router -> RTA_GATEWAY -> up new router -> set higher priority - added checking route id - **/ - if (!is_del_event && ((net->ifid_ == -1) || (priority < net->route_priority) || (net->ifid_ != temp_idx)) { + if (!is_del_event && ((net->ifid_ == -1) || (priority < net->route_priority))) { // Clear if's state for the case were there is a higher priority // route on a different interface. net->clearIface();