Invert the order of SO_RCVBUFFORCE and SO_RCVBUFF
This change swaps the order of SO_RCVBUFFORCE and SO_RCVBUFF, because the latter is silently capped to sysctl_rmem_max. So, just try SO_RCVBUFF if the former failed. Bug: 62417946 Test: Run android in a new user and network namespace, vold does not abort here. Change-Id: Iac2ddae6fbb80ba84afe5414eade978cd795ef3c
This commit is contained in:
parent
92052aa582
commit
d1b00de2c1
1 changed files with 5 additions and 4 deletions
|
@ -64,10 +64,11 @@ int NetlinkManager::start() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
// When running in a net/user namespace, SO_RCVBUFFORCE is not available.
|
||||
// Try using SO_RCVBUF first.
|
||||
if ((setsockopt(mSock, SOL_SOCKET, SO_RCVBUF, &sz, sizeof(sz)) < 0) &&
|
||||
(setsockopt(mSock, SOL_SOCKET, SO_RCVBUFFORCE, &sz, sizeof(sz)) < 0)) {
|
||||
// When running in a net/user namespace, SO_RCVBUFFORCE will fail because
|
||||
// it will check for the CAP_NET_ADMIN capability in the root namespace.
|
||||
// Try using SO_RCVBUF if that fails.
|
||||
if ((setsockopt(mSock, SOL_SOCKET, SO_RCVBUFFORCE, &sz, sizeof(sz)) < 0) &&
|
||||
(setsockopt(mSock, SOL_SOCKET, SO_RCVBUF, &sz, sizeof(sz)) < 0)) {
|
||||
SLOGE("Unable to set uevent socket SO_RCVBUF/SO_RCVBUFFORCE option: %s", strerror(errno));
|
||||
goto out;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue