network: Parse whole RTM_NEWROUTE msg before interpreting it

The check to figure out if we have the default route should be after
the for loop that parses the route attributes, to avoid acting on
incomplete information. We are going to use more fields from the
message.
This commit is contained in:
Anthony PERARD 2021-05-30 15:56:56 +01:00
parent 5444a66e71
commit 23b9923eeb
1 changed files with 37 additions and 39 deletions

View File

@ -623,10 +623,9 @@ int waybar::modules::Network::handleEvents(struct nl_msg *msg, void *data) {
default:
break;
}
}
/* If this is the default route, and we know the interface index,
* we can stop parsing this message.
*/
// Check if we have a default route.
if (has_gateway && !has_destination && temp_idx != -1) {
if (!is_del_event) {
net->ifid_ = temp_idx;
@ -667,7 +666,6 @@ int waybar::modules::Network::handleEvents(struct nl_msg *msg, void *data) {
net->askForStateDump();
}
}
}
break;
}
}