Lines Matching refs:binary
217 static std::vector<std::string> listIptablesRule(const char *binary, const char *chainName) { in listIptablesRule() argument
218 std::string command = StringPrintf("%s -w -n -L %s", binary, chainName); in listIptablesRule()
222 static int iptablesRuleLineLength(const char *binary, const char *chainName) { in iptablesRuleLineLength() argument
223 return listIptablesRule(binary, chainName).size(); in iptablesRuleLineLength()
226 static bool iptablesRuleExists(const char *binary, in iptablesRuleExists() argument
229 std::vector<std::string> rules = listIptablesRule(binary, chainName); in iptablesRuleExists()
469 static int bandwidthDataSaverEnabled(const char *binary) { in bandwidthDataSaverEnabled() argument
470 std::vector<std::string> lines = listIptablesRule(binary, "bw_data_saver"); in bandwidthDataSaverEnabled()
492 size_t minSize = (std::string(binary) == IPTABLES_PATH) ? 3 : 9; in bandwidthDataSaverEnabled()
1006 for (const auto& binary : { IPTABLES_PATH, IP6TABLES_PATH }) { in expectNoTestCounterRules()
1007 std::string command = StringPrintf("%s -w -nvL tetherctrl_counters", binary); in expectNoTestCounterRules()
1095 static std::vector<std::string> listIptablesRuleByTable(const char* binary, const char* table, in listIptablesRuleByTable() argument
1097 std::string command = StringPrintf("%s -t %s -w -n -v -L %s", binary, table, chainName); in listIptablesRuleByTable()
1102 bool iptablesIdleTimerInterfaceRuleExists(const char* binary, const char* chainName, in iptablesIdleTimerInterfaceRuleExists() argument
1105 std::vector<std::string> rules = listIptablesRuleByTable(binary, table, chainName); in iptablesIdleTimerInterfaceRuleExists()
1120 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectIdletimerInterfaceRuleExists()
1121 EXPECT_TRUE(iptablesIdleTimerInterfaceRuleExists(binary, IDLETIMER_RAW_PREROUTING, ifname, in expectIdletimerInterfaceRuleExists()
1123 EXPECT_TRUE(iptablesIdleTimerInterfaceRuleExists(binary, IDLETIMER_MANGLE_POSTROUTING, in expectIdletimerInterfaceRuleExists()
1132 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectIdletimerInterfaceRuleNotExists()
1133 EXPECT_FALSE(iptablesIdleTimerInterfaceRuleExists(binary, IDLETIMER_RAW_PREROUTING, ifname, in expectIdletimerInterfaceRuleNotExists()
1135 EXPECT_FALSE(iptablesIdleTimerInterfaceRuleExists(binary, IDLETIMER_MANGLE_POSTROUTING, in expectIdletimerInterfaceRuleNotExists()
1175 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectStrictSetUidAccept()
1176 EXPECT_FALSE(iptablesRuleExists(binary, STRICT_OUTPUT, uidRule)); in expectStrictSetUidAccept()
1177 EXPECT_FALSE(iptablesRuleExists(binary, STRICT_CLEAR_CAUGHT, uidRule)); in expectStrictSetUidAccept()
1178 EXPECT_EQ(0, iptablesRuleLineLength(binary, perUidChain.c_str())); in expectStrictSetUidAccept()
1186 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectStrictSetUidLog()
1187 EXPECT_TRUE(iptablesRuleExists(binary, STRICT_OUTPUT, uidRule)); in expectStrictSetUidLog()
1188 EXPECT_TRUE(iptablesRuleExists(binary, STRICT_CLEAR_CAUGHT, uidRule)); in expectStrictSetUidLog()
1189 EXPECT_TRUE(iptablesRuleExists(binary, perUidChain.c_str(), logRule)); in expectStrictSetUidLog()
1197 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectStrictSetUidReject()
1198 EXPECT_TRUE(iptablesRuleExists(binary, STRICT_OUTPUT, uidRule)); in expectStrictSetUidReject()
1199 EXPECT_TRUE(iptablesRuleExists(binary, STRICT_CLEAR_CAUGHT, uidRule)); in expectStrictSetUidReject()
1200 EXPECT_TRUE(iptablesRuleExists(binary, perUidChain.c_str(), rejectRule)); in expectStrictSetUidReject()
1474 bool iptablesTargetsExists(const char* binary, int expectedCount, const char* table, in iptablesTargetsExists() argument
1477 std::vector<std::string> rules = listIptablesRuleByTable(binary, table, chainName); in iptablesTargetsExists()
1503 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectBandwidthInterfaceQuotaRuleExists()
1504 EXPECT_TRUE(iptablesTargetsExists(binary, 1, FILTER_TABLE, BANDWIDTH_INPUT, ifname, in expectBandwidthInterfaceQuotaRuleExists()
1506 EXPECT_TRUE(iptablesTargetsExists(binary, 1, FILTER_TABLE, BANDWIDTH_OUTPUT, ifname, in expectBandwidthInterfaceQuotaRuleExists()
1508 EXPECT_TRUE(iptablesTargetsExists(binary, 2, FILTER_TABLE, BANDWIDTH_FORWARD, ifname, in expectBandwidthInterfaceQuotaRuleExists()
1510 EXPECT_TRUE(iptablesRuleExists(binary, BANDWIDTH_COSTLY_IF.c_str(), BANDWIDTH_NAUGHTY)); in expectBandwidthInterfaceQuotaRuleExists()
1511 EXPECT_TRUE(iptablesRuleExists(binary, BANDWIDTH_COSTLY_IF.c_str(), quotaRule)); in expectBandwidthInterfaceQuotaRuleExists()
1520 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectBandwidthInterfaceQuotaRuleDoesNotExist()
1521 EXPECT_FALSE(iptablesTargetsExists(binary, 1, FILTER_TABLE, BANDWIDTH_INPUT, ifname, in expectBandwidthInterfaceQuotaRuleDoesNotExist()
1523 EXPECT_FALSE(iptablesTargetsExists(binary, 1, FILTER_TABLE, BANDWIDTH_OUTPUT, ifname, in expectBandwidthInterfaceQuotaRuleDoesNotExist()
1525 EXPECT_FALSE(iptablesTargetsExists(binary, 2, FILTER_TABLE, BANDWIDTH_FORWARD, ifname, in expectBandwidthInterfaceQuotaRuleDoesNotExist()
1527 EXPECT_FALSE(iptablesRuleExists(binary, BANDWIDTH_COSTLY_IF.c_str(), BANDWIDTH_NAUGHTY)); in expectBandwidthInterfaceQuotaRuleDoesNotExist()
1528 EXPECT_FALSE(iptablesRuleExists(binary, BANDWIDTH_COSTLY_IF.c_str(), quotaRule)); in expectBandwidthInterfaceQuotaRuleDoesNotExist()
1537 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectBandwidthInterfaceAlertRuleExists()
1538 EXPECT_TRUE(iptablesRuleExists(binary, BANDWIDTH_COSTLY_IF.c_str(), alertRule)); in expectBandwidthInterfaceAlertRuleExists()
1547 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectBandwidthInterfaceAlertRuleDoesNotExist()
1548 EXPECT_FALSE(iptablesRuleExists(binary, BANDWIDTH_COSTLY_IF.c_str(), alertRule)); in expectBandwidthInterfaceAlertRuleDoesNotExist()
1556 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectBandwidthGlobalAlertRuleExists()
1557 EXPECT_TRUE(iptablesRuleExists(binary, BANDWIDTH_ALERT, globalAlertRule)); in expectBandwidthGlobalAlertRuleExists()
1565 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectBandwidthManipulateSpecialAppRuleExists()
1566 EXPECT_TRUE(iptablesTargetsExists(binary, 1, FILTER_TABLE, chain, target, uidRule)); in expectBandwidthManipulateSpecialAppRuleExists()
1573 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectBandwidthManipulateSpecialAppRuleDoesNotExist()
1574 EXPECT_FALSE(iptablesRuleExists(binary, chain, uidRule)); in expectBandwidthManipulateSpecialAppRuleDoesNotExist()
1754 bool iptablesNetworkPermissionIptablesRuleExists(const char* binary, const char* chainName, in iptablesNetworkPermissionIptablesRuleExists() argument
1758 std::vector<std::string> rules = listIptablesRuleByTable(binary, table, chainName); in iptablesNetworkPermissionIptablesRuleExists()
1784 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectNetworkPermissionIptablesRuleExists()
1786 binary, ROUTECTRL_INPUT, ifName, networkIncomingPacketMarkRule, MANGLE_TABLE)); in expectNetworkPermissionIptablesRuleExists()
2128 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectFirewallWhitelistMode()
2129 EXPECT_TRUE(iptablesRuleExists(binary, FIREWALL_INPUT, dropRule)); in expectFirewallWhitelistMode()
2130 EXPECT_TRUE(iptablesRuleExists(binary, FIREWALL_OUTPUT, rejectRule)); in expectFirewallWhitelistMode()
2131 EXPECT_TRUE(iptablesRuleExists(binary, FIREWALL_FORWARD, rejectRule)); in expectFirewallWhitelistMode()
2136 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectFirewallBlacklistMode()
2137 EXPECT_EQ(2, iptablesRuleLineLength(binary, FIREWALL_INPUT)); in expectFirewallBlacklistMode()
2138 EXPECT_EQ(2, iptablesRuleLineLength(binary, FIREWALL_OUTPUT)); in expectFirewallBlacklistMode()
2139 EXPECT_EQ(2, iptablesRuleLineLength(binary, FIREWALL_FORWARD)); in expectFirewallBlacklistMode()
2143 bool iptablesFirewallInterfaceFirstRuleExists(const char* binary, const char* chainName, in iptablesFirewallInterfaceFirstRuleExists() argument
2146 std::vector<std::string> rules = listIptablesRuleByTable(binary, FILTER_TABLE, chainName); in iptablesFirewallInterfaceFirstRuleExists()
2163 bool iptablesFirewallInterfaceRuleExists(const char* binary, const char* chainName, in iptablesFirewallInterfaceRuleExists() argument
2166 std::vector<std::string> rules = listIptablesRuleByTable(binary, FILTER_TABLE, chainName); in iptablesFirewallInterfaceRuleExists()
2179 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectFirewallInterfaceRuleAllowExists()
2180 EXPECT_TRUE(iptablesFirewallInterfaceFirstRuleExists(binary, FIREWALL_INPUT, ifname, in expectFirewallInterfaceRuleAllowExists()
2182 EXPECT_TRUE(iptablesFirewallInterfaceFirstRuleExists(binary, FIREWALL_OUTPUT, ifname, in expectFirewallInterfaceRuleAllowExists()
2189 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectFireWallInterfaceRuleAllowDoesNotExist()
2191 iptablesFirewallInterfaceRuleExists(binary, FIREWALL_INPUT, ifname, returnRule)); in expectFireWallInterfaceRuleAllowDoesNotExist()
2193 iptablesFirewallInterfaceRuleExists(binary, FIREWALL_OUTPUT, ifname, returnRule)); in expectFireWallInterfaceRuleAllowDoesNotExist()
2197 bool iptablesFirewallUidFirstRuleExists(const char* binary, const char* chainName, in iptablesFirewallUidFirstRuleExists() argument
2200 std::vector<std::string> rules = listIptablesRuleByTable(binary, FILTER_TABLE, chainName); in iptablesFirewallUidFirstRuleExists()
2211 bool iptablesFirewallUidLastRuleExists(const char* binary, const char* chainName, in iptablesFirewallUidLastRuleExists() argument
2214 std::vector<std::string> rules = listIptablesRuleByTable(binary, FILTER_TABLE, chainName); in iptablesFirewallUidLastRuleExists()
2227 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) in expectFirewallUidFirstRuleExists()
2228 EXPECT_TRUE(iptablesFirewallUidFirstRuleExists(binary, chainName, targetReturn, uidRule)); in expectFirewallUidFirstRuleExists()
2233 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) in expectFirewallUidFirstRuleDoesNotExist()
2234 EXPECT_FALSE(iptablesFirewallUidFirstRuleExists(binary, chainName, targetReturn, uidRule)); in expectFirewallUidFirstRuleDoesNotExist()
2239 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) in expectFirewallUidLastRuleExists()
2240 EXPECT_TRUE(iptablesFirewallUidLastRuleExists(binary, chainName, targetDrop, uidRule)); in expectFirewallUidLastRuleExists()
2245 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) in expectFirewallUidLastRuleDoesNotExist()
2246 EXPECT_FALSE(iptablesFirewallUidLastRuleExists(binary, chainName, targetDrop, uidRule)); in expectFirewallUidLastRuleDoesNotExist()
2249 bool iptablesFirewallChildChainsLastRuleExists(const char* binary, const char* chainName) { in iptablesFirewallChildChainsLastRuleExists() argument
2251 listIptablesRuleByTable(binary, FILTER_TABLE, FIREWALL_INPUT); in iptablesFirewallChildChainsLastRuleExists()
2253 listIptablesRuleByTable(binary, FILTER_TABLE, FIREWALL_OUTPUT); in iptablesFirewallChildChainsLastRuleExists()
2267 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) in expectFirewallChildChainsLastRuleExists()
2268 EXPECT_TRUE(iptablesFirewallChildChainsLastRuleExists(binary, chainRule)); in expectFirewallChildChainsLastRuleExists()
2272 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectFirewallChildChainsLastRuleDoesNotExist()
2273 EXPECT_FALSE(iptablesRuleExists(binary, FIREWALL_INPUT, chainRule)); in expectFirewallChildChainsLastRuleDoesNotExist()
2274 EXPECT_FALSE(iptablesRuleExists(binary, FIREWALL_OUTPUT, chainRule)); in expectFirewallChildChainsLastRuleDoesNotExist()
2751 int iptablesCountRules(const char* binary, const char* table, const char* chainName) { in iptablesCountRules() argument
2752 return listIptablesRuleByTable(binary, table, chainName).size(); in iptablesCountRules()
2755 bool iptablesChainMatch(const char* binary, const char* table, const char* chainName, in iptablesChainMatch() argument
2757 std::vector<std::string> rules = listIptablesRuleByTable(binary, table, chainName); in iptablesChainMatch()
2803 for (const auto& binary : {IPTABLES_PATH, IP6TABLES_PATH}) { in expectNatEnable()
2804 EXPECT_TRUE(iptablesTargetsExists(binary, 2, FILTER_TABLE, TETHER_COUNTERS_CHAIN, intIf, in expectNatEnable()