Snap for 5949240 from 6b35750fd5fe0066460c322374576b9c25ee967e to sdk-release
Change-Id: Ib9acad3ead275af1fc4674c46817fa627e7187c6
diff --git a/server/ClatdController.cpp b/server/ClatdController.cpp
index 6039d9a..bf29693 100644
--- a/server/ClatdController.cpp
+++ b/server/ClatdController.cpp
@@ -140,7 +140,11 @@
// Attempt to connect to the address. If the connection succeeds and getsockname returns the
// same then the address is already assigned to the system and we can't use it.
- struct sockaddr_in sin = {.sin_family = AF_INET, .sin_addr = {addr}, .sin_port = 53};
+ struct sockaddr_in sin = {
+ .sin_family = AF_INET,
+ .sin_port = 53,
+ .sin_addr = {addr},
+ };
socklen_t len = sizeof(sin);
bool inuse = connect(s, (struct sockaddr*)&sin, sizeof(sin)) == 0 &&
getsockname(s, (struct sockaddr*)&sin, &len) == 0 && (size_t)len >= sizeof(sin) &&
diff --git a/server/IptablesRestoreControllerTest.cpp b/server/IptablesRestoreControllerTest.cpp
index c9028df..20f6183 100644
--- a/server/IptablesRestoreControllerTest.cpp
+++ b/server/IptablesRestoreControllerTest.cpp
@@ -55,9 +55,7 @@
int mIptablesLock = -1;
std::string mChainName;
- static void SetUpTestCase() {
- blockSigpipe();
- }
+ static void SetUpTestSuite() { blockSigpipe(); }
void SetUp() {
ASSERT_EQ(0, createTestChain());
diff --git a/server/RouteController.cpp b/server/RouteController.cpp
index 1abca4b..a62ed6b 100644
--- a/server/RouteController.cpp
+++ b/server/RouteController.cpp
@@ -399,11 +399,11 @@
// Assemble a rtmsg and put it in an array of iovec structures.
rtmsg route = {
- .rtm_protocol = RTPROT_STATIC,
- .rtm_type = type,
- .rtm_family = family,
- .rtm_dst_len = prefixLength,
- .rtm_scope = static_cast<uint8_t>(nexthop ? RT_SCOPE_UNIVERSE : RT_SCOPE_LINK),
+ .rtm_family = family,
+ .rtm_dst_len = prefixLength,
+ .rtm_protocol = RTPROT_STATIC,
+ .rtm_scope = static_cast<uint8_t>(nexthop ? RT_SCOPE_UNIVERSE : RT_SCOPE_LINK),
+ .rtm_type = type,
};
rtattr rtaDst = { U16_RTA_LENGTH(rawLength), RTA_DST };
diff --git a/server/SockDiag.cpp b/server/SockDiag.cpp
index fde56d7..3e1f384 100644
--- a/server/SockDiag.cpp
+++ b/server/SockDiag.cpp
@@ -499,8 +499,8 @@
};
struct nlattr nla = {
- .nla_type = INET_DIAG_REQ_BYTECODE,
- .nla_len = sizeof(struct nlattr) + bytecodelen,
+ .nla_len = sizeof(struct nlattr) + bytecodelen,
+ .nla_type = INET_DIAG_REQ_BYTECODE,
};
iovec iov[] = {
diff --git a/server/SockDiagTest.cpp b/server/SockDiagTest.cpp
index 312f2c8..b79471a 100644
--- a/server/SockDiagTest.cpp
+++ b/server/SockDiagTest.cpp
@@ -199,14 +199,15 @@
inet_diag_msg makeDiagMessage(__u8 family, const sockaddr *src, const sockaddr *dst) {
inet_diag_msg msg = {
- .idiag_family = family,
- .idiag_state = TCP_ESTABLISHED,
- .idiag_uid = AID_APP + 123,
- .idiag_inode = 123456789,
- .id = {
- .idiag_sport = 1234,
- .idiag_dport = 4321,
- }
+ .idiag_family = family,
+ .idiag_state = TCP_ESTABLISHED,
+ .id =
+ {
+ .idiag_sport = 1234,
+ .idiag_dport = 4321,
+ },
+ .idiag_uid = AID_APP + 123,
+ .idiag_inode = 123456789,
};
EXPECT_TRUE(fillDiagAddr(msg.id.idiag_src, src));
EXPECT_TRUE(fillDiagAddr(msg.id.idiag_dst, dst));
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;
diff --git a/server/main.cpp b/server/main.cpp
index cbdc899..bedb173 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -88,9 +88,9 @@
bool initDnsResolver() {
ResolverNetdCallbacks callbacks = {
+ .check_calling_permission = &checkCallingPermissionCallback,
.get_network_context = &getNetworkContextCallback,
.log = &logCallback,
- .check_calling_permission = &checkCallingPermissionCallback,
.tagSocket = &tagSocketCallback,
};
return RESOLV_STUB.resolv_init(callbacks);
diff --git a/tests/binder_test.cpp b/tests/binder_test.cpp
index 02e9eaf..8fad188 100644
--- a/tests/binder_test.cpp
+++ b/tests/binder_test.cpp
@@ -3111,7 +3111,11 @@
android::base::unique_fd testSocket(socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0));
if (testSocket < 0) return false;
- const sockaddr_in6 dst6 = {.sin6_family = AF_INET6, .sin6_addr = dstAddr, .sin6_port = 42};
+ const sockaddr_in6 dst6 = {
+ .sin6_family = AF_INET6,
+ .sin6_port = 42,
+ .sin6_addr = dstAddr,
+ };
int res = connect(testSocket, (sockaddr*)&dst6, sizeof(dst6));
socklen_t fwmarkLen = sizeof(fwmark->intValue);
EXPECT_NE(-1, getsockopt(testSocket, SOL_SOCKET, SO_MARK, &(fwmark->intValue), &fwmarkLen));