Merge "[TCPKeepalive] Fill correct TOS and TTL value" am: 13cc9e442e am: 52ffa51e7f
am: 73062f4600
Change-Id: I80c56a14a0be2e6b7996f2bcb9a1a320f0c2c058
This commit is contained in:
@@ -23,7 +23,10 @@ import static android.os.MessageQueue.OnFileDescriptorEventListener.EVENT_ERROR;
|
||||
import static android.os.MessageQueue.OnFileDescriptorEventListener.EVENT_INPUT;
|
||||
import static android.system.OsConstants.ENOPROTOOPT;
|
||||
import static android.system.OsConstants.FIONREAD;
|
||||
import static android.system.OsConstants.IPPROTO_IP;
|
||||
import static android.system.OsConstants.IPPROTO_TCP;
|
||||
import static android.system.OsConstants.IP_TOS;
|
||||
import static android.system.OsConstants.IP_TTL;
|
||||
import static android.system.OsConstants.TIOCOUTQ;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
@@ -193,6 +196,12 @@ public class TcpKeepaliveController {
|
||||
trw = NetworkUtils.getTcpRepairWindow(fd);
|
||||
tcpDetails.rcvWnd = trw.rcvWnd;
|
||||
tcpDetails.rcvWndScale = trw.rcvWndScale;
|
||||
if (tcpDetails.srcAddress.length == 4 /* V4 address length */) {
|
||||
// Query TOS.
|
||||
tcpDetails.tos = Os.getsockoptInt(fd, IPPROTO_IP, IP_TOS);
|
||||
// Query TTL.
|
||||
tcpDetails.ttl = Os.getsockoptInt(fd, IPPROTO_IP, IP_TTL);
|
||||
}
|
||||
} catch (ErrnoException e) {
|
||||
Log.e(TAG, "Exception reading TCP state from socket", e);
|
||||
if (e.errno == ENOPROTOOPT) {
|
||||
|
||||
Reference in New Issue
Block a user