Merge "Invert the order of SO_RCVBUFFORCE and SO_RCVBUFF"

gugelfrei
Treehugger Robot 7 years ago committed by Gerrit Code Review
commit a3258252ad

@ -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…
Cancel
Save