Merge "Try SO_RCVBUF before SO_RCVBUFFORCE." am: 3f8fa0c215
am: dfcc7dbad0
Change-Id: I742ebc5174d809fa6f70324659f6e03798710679
diff --git a/NetlinkManager.cpp b/NetlinkManager.cpp
index b5069a6..0ad182e 100644
--- a/NetlinkManager.cpp
+++ b/NetlinkManager.cpp
@@ -64,8 +64,11 @@
return -1;
}
- if (setsockopt(mSock, SOL_SOCKET, SO_RCVBUFFORCE, &sz, sizeof(sz)) < 0) {
- SLOGE("Unable to set uevent socket SO_RCVBUFFORCE option: %s", strerror(errno));
+ // 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)) {
+ SLOGE("Unable to set uevent socket SO_RCVBUF/SO_RCVBUFFORCE option: %s", strerror(errno));
goto out;
}