diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2019-11-04 23:54:55 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-11-04 23:54:55 +0000 |
commit | dfc4f7c2547eeb26be2e7b2f63318933eec1fb75 (patch) | |
tree | 0b0dfe2fa5df46011318592e8433daea840ed78c /src | |
parent | c4f88900da4a0a8f76a5ee8ec042251b5459e59b (diff) | |
parent | e17d99664880c4a9399c23b6407e6ae4f1ce7518 (diff) |
Merge "Fix RAs with different retansmission timer would be dropped by apf"
Diffstat (limited to 'src')
-rw-r--r-- | src/android/net/apf/ApfFilter.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/android/net/apf/ApfFilter.java b/src/android/net/apf/ApfFilter.java index 33f69f4..75a737d 100644 --- a/src/android/net/apf/ApfFilter.java +++ b/src/android/net/apf/ApfFilter.java @@ -514,9 +514,9 @@ public class ApfFilter { public final Type type; /** Offset into the packet at which this section begins. */ public final int start; - /** Length of this section. */ + /** Length of this section in bytes. */ public final int length; - /** If this is a lifetime, the ICMP option that the defined it. 0 for router lifetime. */ + /** If this is a lifetime, the ICMP option that defined it. 0 for router lifetime. */ public final int option; /** If this is a lifetime, the lifetime value. */ public final long lifetime; @@ -785,8 +785,9 @@ public class ApfFilter { addLifetimeSection(ICMP6_RA_ROUTER_LIFETIME_LEN, 0, routerLifetime); builder.updateRouterLifetime(routerLifetime); - // Ensures that the RA is not truncated. - mPacket.position(ICMP6_RA_OPTION_OFFSET); + // Add remaining fields (reachable time and retransmission timer) to match section. + addMatchUntil(ICMP6_RA_OPTION_OFFSET); + while (mPacket.hasRemaining()) { final int position = mPacket.position(); final int optionType = getUint8(mPacket, position); @@ -797,7 +798,7 @@ public class ApfFilter { mPrefixOptionOffsets.add(position); // Parse valid lifetime - addMatchSection(ICMP6_PREFIX_OPTION_VALID_LIFETIME_LEN); + addMatchSection(ICMP6_PREFIX_OPTION_VALID_LIFETIME_OFFSET); lifetime = getUint32(mPacket, mPacket.position()); addLifetimeSection(ICMP6_PREFIX_OPTION_VALID_LIFETIME_LEN, ICMP6_PREFIX_OPTION_TYPE, lifetime); |