diff options
Diffstat (limited to 'server/FirewallControllerTest.cpp')
| -rw-r--r-- | server/FirewallControllerTest.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/server/FirewallControllerTest.cpp b/server/FirewallControllerTest.cpp index b909833b..7e3686bb 100644 --- a/server/FirewallControllerTest.cpp +++ b/server/FirewallControllerTest.cpp @@ -35,11 +35,12 @@ protected: } FirewallController mFw; - std::string makeUidRules(const char *a, bool b, const std::vector<int32_t>& c) { - return mFw.makeUidRules(a, b, c); + std::string makeUidRules(IptablesTarget a, const char* b, bool c, + const std::vector<int32_t>& d) { + return mFw.makeUidRules(a, b, c, d); } - int createChain(const char* a, const char*b , FirewallType c) { + int createChain(const char* a, const char* b , FirewallType c) { return mFw.createChain(a, b, c); } }; @@ -109,6 +110,13 @@ TEST_F(FirewallControllerTest, TestReplaceWhitelistUidRule) { std::string expected = "*filter\n" ":FW_whitechain -\n" + "-A FW_whitechain -p tcp --tcp-flags RST RST -j RETURN\n" + "-A FW_whitechain -p icmpv6 --icmpv6-type packet-too-big -j RETURN\n" + "-A FW_whitechain -p icmpv6 --icmpv6-type router-solicitation -j RETURN\n" + "-A FW_whitechain -p icmpv6 --icmpv6-type router-advertisement -j RETURN\n" + "-A FW_whitechain -p icmpv6 --icmpv6-type neighbour-solicitation -j RETURN\n" + "-A FW_whitechain -p icmpv6 --icmpv6-type neighbour-advertisement -j RETURN\n" + "-A FW_whitechain -p icmpv6 --icmpv6-type redirect -j RETURN\n" "-A FW_whitechain -m owner --uid-owner 0-9999 -j RETURN\n" "-A FW_whitechain -m owner --uid-owner 10023 -j RETURN\n" "-A FW_whitechain -m owner --uid-owner 10059 -j RETURN\n" @@ -121,19 +129,19 @@ TEST_F(FirewallControllerTest, TestReplaceWhitelistUidRule) { "COMMIT\n\x04"; std::vector<int32_t> uids = { 10023, 10059, 10124, 10111, 110122, 210153, 210024 }; - EXPECT_EQ(expected, makeUidRules("FW_whitechain", true, uids)); + EXPECT_EQ(expected, makeUidRules(V6, "FW_whitechain", true, uids)); } TEST_F(FirewallControllerTest, TestReplaceBlacklistUidRule) { std::string expected = "*filter\n" ":FW_blackchain -\n" + "-A FW_blackchain -p tcp --tcp-flags RST RST -j RETURN\n" "-A FW_blackchain -m owner --uid-owner 10023 -j DROP\n" "-A FW_blackchain -m owner --uid-owner 10059 -j DROP\n" "-A FW_blackchain -m owner --uid-owner 10124 -j DROP\n" - "-A FW_blackchain -j RETURN\n" "COMMIT\n\x04"; std::vector<int32_t> uids = { 10023, 10059, 10124 }; - EXPECT_EQ(expected, makeUidRules("FW_blackchain", false, uids)); + EXPECT_EQ(expected, makeUidRules(V4 ,"FW_blackchain", false, uids)); } |
