[netd] fix -Wreorder-init-list
C++20 will require members in a designated initializer to be in order
unlike C99.
Bug: 139945549
Test: mm
Change-Id: I4b856942f5c323898cf572dc60622d62c6ffed94
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
diff --git a/server/TrafficController.cpp b/server/TrafficController.cpp
index 951226b..86f1f53 100644
--- a/server/TrafficController.cpp
+++ b/server/TrafficController.cpp
@@ -588,8 +588,10 @@
UidOwnerMatchType match) {
auto oldMatch = map.readValue(uid);
if (isOk(oldMatch)) {
- UidOwnerValue newMatch = {.rule = static_cast<uint8_t>(oldMatch.value().rule & ~match),
- .iif = (match == IIF_MATCH) ? 0 : oldMatch.value().iif};
+ UidOwnerValue newMatch = {
+ .iif = (match == IIF_MATCH) ? 0 : oldMatch.value().iif,
+ .rule = static_cast<uint8_t>(oldMatch.value().rule & ~match),
+ };
if (newMatch.rule == 0) {
RETURN_IF_NOT_OK(map.deleteValue(uid));
} else {
@@ -611,11 +613,16 @@
}
auto oldMatch = map.readValue(uid);
if (isOk(oldMatch)) {
- UidOwnerValue newMatch = {.rule = static_cast<uint8_t>(oldMatch.value().rule | match),
- .iif = iif ? iif : oldMatch.value().iif};
+ UidOwnerValue newMatch = {
+ .iif = iif ? iif : oldMatch.value().iif,
+ .rule = static_cast<uint8_t>(oldMatch.value().rule | match),
+ };
RETURN_IF_NOT_OK(map.writeValue(uid, newMatch, BPF_ANY));
} else {
- UidOwnerValue newMatch = {.rule = static_cast<uint8_t>(match), .iif = iif};
+ UidOwnerValue newMatch = {
+ .iif = iif,
+ .rule = static_cast<uint8_t>(match),
+ };
RETURN_IF_NOT_OK(map.writeValue(uid, newMatch, BPF_ANY));
}
return netdutils::status::ok;