summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChiachang Wang <chiachangwang@google.com>2019-12-05 17:37:26 +0800
committerChiachang Wang <chiachangwang@google.com>2019-12-06 03:12:19 +0000
commit902842d32c32dac570e8d51c5c90d7276ae9eac7 (patch)
tree0ef29be350dba8d1797b00bb8d04852379705405 /src
parent4a8d1d42b52223cb81ecacb60cc578aeb4452fd5 (diff)
Parse extra un-used TcpInfo
Parse tcp info only until tcpi_sndbuf_limited now. If device kernel version >= 4.18, there will be some un-parsed bytes left because the tcp_info struct was expanded. Skip the remaining un-parsed part. Bug: 145275899 Bug: 145328512 Test: atest NetworkStackTests NetworkStackNextTests Change-Id: I56aa6be183b8b804898926dae2c47a497c49f893
Diffstat (limited to 'src')
-rw-r--r--src/com/android/networkstack/netlink/TcpInfo.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/com/android/networkstack/netlink/TcpInfo.java b/src/com/android/networkstack/netlink/TcpInfo.java
index f2812e4..e6036b5 100644
--- a/src/com/android/networkstack/netlink/TcpInfo.java
+++ b/src/com/android/networkstack/netlink/TcpInfo.java
@@ -112,6 +112,10 @@ public class TcpInfo {
}
}
mFieldsValues = Collections.unmodifiableMap(fields);
+ // tcp_info structure grows over time as new fields are added. Jump to the end of the
+ // structure, as unknown fields might remain at the end of the structure if the tcp_info
+ // struct was expanded.
+ bytes.position(Math.min(infolen + start, bytes.limit()));
}
@VisibleForTesting