diff options
author | Bernie Innocenti <codewiz@google.com> | 2018-04-27 17:34:30 +0900 |
---|---|---|
committer | Bernie Innocenti <codewiz@google.com> | 2018-04-27 17:47:45 +0900 |
commit | 64848957ba49275896c80790ceeeb6219930f687 (patch) | |
tree | 5349b4fbe79f4bbfb9aee8a49b3d4fa72435e2ac | |
parent | 9a9a0772bc04427f3cc23289501a6b56463d1db1 (diff) | |
download | interfaces-pie-qpr1-s2-release.tar.gz |
Fix NetdHidlTest.TestAddRemoveInterfaces()android-vts-9.0_r9android-vts-9.0_r8android-vts-9.0_r7android-vts-9.0_r6android-vts-9.0_r5android-vts-9.0_r4android-vts-9.0_r19android-vts-9.0_r18android-vts-9.0_r17android-vts-9.0_r16android-vts-9.0_r15android-vts-9.0_r14android-vts-9.0_r13android-vts-9.0_r12android-vts-9.0_r11android-vts-9.0_r10android-9.0.0_r47android-9.0.0_r46android-9.0.0_r45android-9.0.0_r44android-9.0.0_r43android-9.0.0_r42android-9.0.0_r41android-9.0.0_r40android-9.0.0_r39android-9.0.0_r38android-9.0.0_r37android-9.0.0_r36android-9.0.0_r35android-9.0.0_r34android-9.0.0_r33android-9.0.0_r32android-9.0.0_r31android-9.0.0_r30android-9.0.0_r22android-9.0.0_r21android-9.0.0_r20android-9.0.0_r19android-9.0.0_r16android-9.0.0_r12android-9.0.0_r11pie-vts-releasepie-vts-devpie-qpr3-s1-releasepie-qpr3-releasepie-qpr3-b-releasepie-qpr2-releasepie-qpr1-s3-releasepie-qpr1-s2-releasepie-qpr1-s1-releasepie-qpr1-releasepie-dr1-releasepie-dr1-devpie-devpie-b4s4-releasepie-b4s4-dev
The regex in countRulesForFwmark() overeagerly matched rules ending
in the same hex digit. For instance, fwmark=3 would match both these
lines:
from all fwmark 0xd0003/0xdffff iif lo lookup netd13474_27190
from all fwmark 0x10063/0x1ffff iif lo lookup local_network
This fix consists in matching either just 0x3, or the zero-padded 0003.
Bug: 74922133
Test: as follows:
m VtsHalNetNetdV1_1TargetTest && \
adb push out/.../VtsHalNetNetdV1_1TargetTest /data/ && \
adb shell /data/VtsHalNetNetdV1_1TargetTest
Change-Id: If6df9fa6cf843a5593ce61d87366c23383bb4d81
-rw-r--r-- | net/netd/testutils/VtsHalNetNetdTestUtils.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/netd/testutils/VtsHalNetNetdTestUtils.cpp b/net/netd/testutils/VtsHalNetNetdTestUtils.cpp index da377c4..0d4189d 100644 --- a/net/netd/testutils/VtsHalNetNetdTestUtils.cpp +++ b/net/netd/testutils/VtsHalNetNetdTestUtils.cpp @@ -88,7 +88,8 @@ int countMatchingIpRules(const std::string& regexString) { int countRulesForFwmark(const uint32_t fwmark) { // Skip top nibble, which differs between rules. - std::string regex = StringPrintf("from all fwmark 0x[0-9a-f]+%x/.* lookup ", fwmark); + std::string regex = + StringPrintf("from all fwmark 0x(%x|[0-9a-f]+%04x)/.* lookup ", fwmark, fwmark); return countMatchingIpRules(regex); } |