OSDN Git Service

Fix NetdHidlTest.TestAddRemoveInterfaces()
authorBernie Innocenti <codewiz@google.com>
Fri, 27 Apr 2018 08:34:30 +0000 (17:34 +0900)
committerBernie Innocenti <codewiz@google.com>
Mon, 14 May 2018 12:00:25 +0000 (21:00 +0900)
commit84777b06df82dbff70abf1922f31dfbff4c83f4a
tree3d0d557e6aa369fa48297e41db3d2e5031ed2c26
parent94832f94dc902b130bf3b2814e9addc2f27a2840
Fix NetdHidlTest.TestAddRemoveInterfaces()

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
(cherry picked from commit 64848957ba49275896c80790ceeeb6219930f687)
net/netd/testutils/VtsHalNetNetdTestUtils.cpp