summaryrefslogtreecommitdiff
path: root/server/BandwidthControllerTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'server/BandwidthControllerTest.cpp')
-rw-r--r--server/BandwidthControllerTest.cpp34
1 files changed, 26 insertions, 8 deletions
diff --git a/server/BandwidthControllerTest.cpp b/server/BandwidthControllerTest.cpp
index 7a960e84..027e90b6 100644
--- a/server/BandwidthControllerTest.cpp
+++ b/server/BandwidthControllerTest.cpp
@@ -208,20 +208,38 @@ TEST_F(BandwidthControllerTest, TestDisableBandwidthControl) {
TEST_F(BandwidthControllerTest, TestEnableDataSaver) {
mBw.enableDataSaver(true);
- std::vector<std::string> expected = {
+ std::string expected4 =
"*filter\n"
- "-R bw_data_saver 1 --jump REJECT\n"
- "COMMIT\n"
- };
- expectIptablesRestoreCommands(expected);
+ ":bw_data_saver -\n"
+ "-A bw_data_saver --jump REJECT\n"
+ "COMMIT\n";
+ std::string expected6 =
+ "*filter\n"
+ ":bw_data_saver -\n"
+ "-A bw_data_saver -p icmpv6 --icmpv6-type packet-too-big -j RETURN\n"
+ "-A bw_data_saver -p icmpv6 --icmpv6-type router-solicitation -j RETURN\n"
+ "-A bw_data_saver -p icmpv6 --icmpv6-type router-advertisement -j RETURN\n"
+ "-A bw_data_saver -p icmpv6 --icmpv6-type neighbour-solicitation -j RETURN\n"
+ "-A bw_data_saver -p icmpv6 --icmpv6-type neighbour-advertisement -j RETURN\n"
+ "-A bw_data_saver -p icmpv6 --icmpv6-type redirect -j RETURN\n"
+ "-A bw_data_saver --jump REJECT\n"
+ "COMMIT\n";
+ expectIptablesRestoreCommands({
+ {V4, expected4},
+ {V6, expected6},
+ });
mBw.enableDataSaver(false);
- expected = {
+ std::string expected = {
"*filter\n"
- "-R bw_data_saver 1 --jump RETURN\n"
+ ":bw_data_saver -\n"
+ "-A bw_data_saver --jump RETURN\n"
"COMMIT\n"
};
- expectIptablesRestoreCommands(expected);
+ expectIptablesRestoreCommands({
+ {V4, expected},
+ {V6, expected},
+ });
}
const std::vector<std::string> makeInterfaceQuotaCommands(const std::string& iface, int ruleIndex,