diff options
author | Aaron Huang <huangaaron@google.com> | 2019-10-28 19:22:05 +0800 |
---|---|---|
committer | Aaron Huang <huangaaron@google.com> | 2019-11-04 15:29:00 +0800 |
commit | e17d99664880c4a9399c23b6407e6ae4f1ce7518 (patch) | |
tree | 99bf51c08762ad485a717c2f3711a3e98429daf4 /src | |
parent | 0945160ae3ee6e0cc38b675d4558c7271fb54df4 (diff) |
Fix RAs with different retansmission timer would be dropped by apf
When firmware receives RAs with different retransmission
timer, it is expected the RAs should be accepted by apf
filter. However, they are currently dropped since missing
fields which should be added into match section. It causes
to apf filter treats those RAs as the same and then drops.
This change adds the remaining fields to match section to
compare reachable time and retransmission timer with incoming
RAs.
Also, add test to check that RIOs differing only in the
first 4 bytes are different should be passed.
Bug: 143186590
Test: sent RAs with different rtt and check RAs are accepted
Change-Id: I7e2de29740f96b212634b5aeffe709d57afafc68
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); |