summaryrefslogtreecommitdiff
path: root/server/TetherControllerTest.cpp
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2018-07-26 17:20:57 +0900
committerChenbo Feng <fengc@google.com>2018-08-16 19:09:39 +0000
commit436efdbe22381506c9f174f8b098fc22c0675373 (patch)
tree2c9b9ff989e14a3c750eb2dea2d78a254dc43755 /server/TetherControllerTest.cpp
parent065b765fb78371a0c8dd94bf487eba2d5ca3df4e (diff)
Avoid infinite loop in NetlinkListener.
Currently, NetlinkListener only reads from its socket if it gets POLLIN. This means that if the kernel returns POLLERR without POLLIN, it will get into an infinite loop. Fix this by responding to POLLERR by issuing a recvfrom, which clears the socket error, and continuing. The only error we expect to see here is ENOBUFS, and there's nothing we can do about that. There is no functional change because before we'd just call forEachNetlinkMessage on an empty Slice, which does nothing. Also increase the socket buffer to 1MB to reduce the chance of getting ENOBUFS and thus leaking some mCookieTagMap entries. This buffer size is equivalent to half the buffer size of a single TCP socket on LTE. While we're at it, don't pass POLLRDHUP, POLLERR, and POLLHUP to poll, since these are ignored in events and are only meaningful in revents. Bug: 111479770 Test: netd_{unit,integration}_test pass Test: builds, boots, cell and wifi work Test: stress test does not cause infinite loop in netd Change-Id: I847aeb9a53095c1dfdeddadcd20c0e750b6513ff Merged-In: I847aeb9a53095c1dfdeddadcd20c0e750b6513ff
Diffstat (limited to 'server/TetherControllerTest.cpp')
0 files changed, 0 insertions, 0 deletions